Validate OTG keyboard and mouse not both disabled
Validate that at least one of keyboard and mouse are enabled in OTG mode (otherwise there would be nothing to do).
This commit is contained in:
parent
10a5ccfe71
commit
0e765a5104
@ -2603,6 +2603,12 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
LOGE("In OTG mode, --mouse only supports aoa or disabled.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (kmode == SC_KEYBOARD_INPUT_MODE_DISABLED
|
||||
&& mmode == SC_MOUSE_INPUT_MODE_DISABLED) {
|
||||
LOGE("Could not disable both keyboard and mouse in OTG mode.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts->keyboard_input_mode != SC_KEYBOARD_INPUT_MODE_SDK) {
|
||||
|
@ -127,12 +127,6 @@ scrcpy_otg(struct scrcpy_options *options) {
|
||||
bool enable_mouse =
|
||||
options->mouse_input_mode == SC_MOUSE_INPUT_MODE_AOA;
|
||||
|
||||
// If neither --hid-keyboard or --hid-mouse is passed, enable both
|
||||
if (!enable_keyboard && !enable_mouse) {
|
||||
enable_keyboard = true;
|
||||
enable_mouse = true;
|
||||
}
|
||||
|
||||
if (enable_keyboard) {
|
||||
ok = sc_keyboard_aoa_init(&s->keyboard, &s->aoa);
|
||||
if (!ok) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user