Reassign -K and -M to UHID keyboard and mouse
The options were deprecated, but for convenience, reassign them to aliases for --keyboard=uhid and --mouse=uhid respectively. Their long version (--hid-keyboard and --hid-mouse) remain deprecated.
This commit is contained in:
parent
18d27d7d95
commit
068e005aa1
@ -27,6 +27,7 @@ _scrcpy() {
|
|||||||
--force-adb-forward
|
--force-adb-forward
|
||||||
--forward-all-clicks
|
--forward-all-clicks
|
||||||
-h --help
|
-h --help
|
||||||
|
-K
|
||||||
--keyboard=
|
--keyboard=
|
||||||
--kill-adb-on-close
|
--kill-adb-on-close
|
||||||
--legacy-paste
|
--legacy-paste
|
||||||
@ -37,6 +38,7 @@ _scrcpy() {
|
|||||||
--lock-video-orientation
|
--lock-video-orientation
|
||||||
--lock-video-orientation=
|
--lock-video-orientation=
|
||||||
-m --max-size=
|
-m --max-size=
|
||||||
|
-M
|
||||||
--max-fps=
|
--max-fps=
|
||||||
--mouse=
|
--mouse=
|
||||||
-n --no-control
|
-n --no-control
|
||||||
|
@ -34,6 +34,7 @@ arguments=(
|
|||||||
'--force-adb-forward[Do not attempt to use \"adb reverse\" to connect to the device]'
|
'--force-adb-forward[Do not attempt to use \"adb reverse\" to connect to the device]'
|
||||||
'--forward-all-clicks[Forward clicks to device]'
|
'--forward-all-clicks[Forward clicks to device]'
|
||||||
{-h,--help}'[Print the help]'
|
{-h,--help}'[Print the help]'
|
||||||
|
'-K[Use UHID keyboard (same as --keyboard=uhid)]'
|
||||||
'--keyboard[Set the keyboard input mode]:mode:(disabled sdk uhid aoa)'
|
'--keyboard[Set the keyboard input mode]:mode:(disabled sdk uhid aoa)'
|
||||||
'--kill-adb-on-close[Kill adb when scrcpy terminates]'
|
'--kill-adb-on-close[Kill adb when scrcpy terminates]'
|
||||||
'--legacy-paste[Inject computer clipboard text as a sequence of key events on Ctrl+v]'
|
'--legacy-paste[Inject computer clipboard text as a sequence of key events on Ctrl+v]'
|
||||||
@ -43,6 +44,7 @@ arguments=(
|
|||||||
'--list-encoders[List video and audio encoders available on the device]'
|
'--list-encoders[List video and audio encoders available on the device]'
|
||||||
'--lock-video-orientation=[Lock video orientation]:orientation:(unlocked initial 0 90 180 270)'
|
'--lock-video-orientation=[Lock video orientation]:orientation:(unlocked initial 0 90 180 270)'
|
||||||
{-m,--max-size=}'[Limit both the width and height of the video to value]'
|
{-m,--max-size=}'[Limit both the width and height of the video to value]'
|
||||||
|
'-M[Use UHID mouse (same as --mouse=uhid)]'
|
||||||
'--max-fps=[Limit the frame rate of screen capture]'
|
'--max-fps=[Limit the frame rate of screen capture]'
|
||||||
'--mouse[Set the mouse input mode]:mode:(disabled sdk uhid aoa)'
|
'--mouse[Set the mouse input mode]:mode:(disabled sdk uhid aoa)'
|
||||||
{-n,--no-control}'[Disable device control \(mirror the device in read only\)]'
|
{-n,--no-control}'[Disable device control \(mirror the device in read only\)]'
|
||||||
|
@ -171,6 +171,10 @@ By default, right-click triggers BACK (or POWER on) and middle-click triggers HO
|
|||||||
.B \-h, \-\-help
|
.B \-h, \-\-help
|
||||||
Print this help.
|
Print this help.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B \-K
|
||||||
|
Same as \fB\-\-keyboard=uhid\fR.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-keyboard " mode
|
.BI "\-\-keyboard " mode
|
||||||
Select how to send keyboard inputs to the device.
|
Select how to send keyboard inputs to the device.
|
||||||
@ -232,6 +236,10 @@ Limit both the width and height of the video to \fIvalue\fR. The other dimension
|
|||||||
|
|
||||||
Default is 0 (unlimited).
|
Default is 0 (unlimited).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B \-M
|
||||||
|
Same as \fB\-\-mouse=uhid\fR.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-max\-fps " value
|
.BI "\-\-max\-fps " value
|
||||||
Limit the framerate of screen capture (officially supported since Android 10, but may work on earlier versions).
|
Limit the framerate of screen capture (officially supported since Android 10, but may work on earlier versions).
|
||||||
|
@ -95,6 +95,8 @@ enum {
|
|||||||
OPT_ORIENTATION,
|
OPT_ORIENTATION,
|
||||||
OPT_KEYBOARD,
|
OPT_KEYBOARD,
|
||||||
OPT_MOUSE,
|
OPT_MOUSE,
|
||||||
|
OPT_HID_KEYBOARD_DEPRECATED,
|
||||||
|
OPT_HID_MOUSE_DEPRECATED,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_option {
|
struct sc_option {
|
||||||
@ -360,6 +362,10 @@ static const struct sc_option options[] = {
|
|||||||
.longopt = "help",
|
.longopt = "help",
|
||||||
.text = "Print this help.",
|
.text = "Print this help.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.shortopt = 'K',
|
||||||
|
.text = "Same as --keyboard=uhid.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_KEYBOARD,
|
.longopt_id = OPT_KEYBOARD,
|
||||||
.longopt = "keyboard",
|
.longopt = "keyboard",
|
||||||
@ -391,7 +397,8 @@ static const struct sc_option options[] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// deprecated
|
// deprecated
|
||||||
.shortopt = 'K',
|
//.shortopt = 'K', // old, reassigned
|
||||||
|
.longopt_id = OPT_HID_KEYBOARD_DEPRECATED,
|
||||||
.longopt = "hid-keyboard",
|
.longopt = "hid-keyboard",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -447,9 +454,14 @@ static const struct sc_option options[] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// deprecated
|
// deprecated
|
||||||
.shortopt = 'M',
|
//.shortopt = 'M', // old, reassigned
|
||||||
|
.longopt_id = OPT_HID_MOUSE_DEPRECATED,
|
||||||
.longopt = "hid-mouse",
|
.longopt = "hid-mouse",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.shortopt = 'M',
|
||||||
|
.text = "Same as --mouse=uhid.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_MAX_FPS,
|
.longopt_id = OPT_MAX_FPS,
|
||||||
.longopt = "max-fps",
|
.longopt = "max-fps",
|
||||||
@ -2089,20 +2101,17 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||||||
args->help = true;
|
args->help = true;
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
#ifdef HAVE_USB
|
opts->keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_UHID;
|
||||||
LOGW("-K/--hid-keyboard is deprecated, use --keyboard=aoa "
|
|
||||||
"instead.");
|
|
||||||
opts->keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_AOA;
|
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
LOGE("HID over AOA (-K/--hid-keyboard) is disabled.");
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
case OPT_KEYBOARD:
|
case OPT_KEYBOARD:
|
||||||
if (!parse_keyboard(optarg, &opts->keyboard_input_mode)) {
|
if (!parse_keyboard(optarg, &opts->keyboard_input_mode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OPT_HID_KEYBOARD_DEPRECATED:
|
||||||
|
LOGE("--hid-keyboard has been removed, use --keyboard=aoa or "
|
||||||
|
"--keyboard=uhid instead.");
|
||||||
|
return false;
|
||||||
case OPT_MAX_FPS:
|
case OPT_MAX_FPS:
|
||||||
if (!parse_max_fps(optarg, &opts->max_fps)) {
|
if (!parse_max_fps(optarg, &opts->max_fps)) {
|
||||||
return false;
|
return false;
|
||||||
@ -2114,19 +2123,17 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
#ifdef HAVE_USB
|
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_UHID;
|
||||||
LOGW("-M/--hid-mouse is deprecated, use --mouse=aoa instead.");
|
|
||||||
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_AOA;
|
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
LOGE("HID over AOA (-M/--hid-mouse) is disabled.");
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
case OPT_MOUSE:
|
case OPT_MOUSE:
|
||||||
if (!parse_mouse(optarg, &opts->mouse_input_mode)) {
|
if (!parse_mouse(optarg, &opts->mouse_input_mode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OPT_HID_MOUSE_DEPRECATED:
|
||||||
|
LOGE("--hid-mouse has been removed, use --mouse=aoa or "
|
||||||
|
"--mouse=uhid instead.");
|
||||||
|
return false;
|
||||||
case OPT_LOCK_VIDEO_ORIENTATION:
|
case OPT_LOCK_VIDEO_ORIENTATION:
|
||||||
if (!parse_lock_video_orientation(optarg,
|
if (!parse_lock_video_orientation(optarg,
|
||||||
&opts->lock_video_orientation)) {
|
&opts->lock_video_orientation)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user