2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-09-01 06:45:40 +00:00

Add gamepad support in OTG mode

Implement gamepad support for OTG.

PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>
This commit is contained in:
Romain Vimont
2024-09-06 23:08:08 +02:00
parent 3e68244dd3
commit 5fe884276b
4 changed files with 135 additions and 2 deletions

View File

@@ -2838,9 +2838,17 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
return false;
}
enum sc_gamepad_input_mode gmode = opts->gamepad_input_mode;
if (gmode != SC_GAMEPAD_INPUT_MODE_AOA
&& gmode != SC_GAMEPAD_INPUT_MODE_DISABLED) {
LOGE("In OTG mode, --gamepad only supports aoa or disabled.");
return false;
}
if (kmode == SC_KEYBOARD_INPUT_MODE_DISABLED
&& mmode == SC_MOUSE_INPUT_MODE_DISABLED) {
LOGE("Cannot disable both keyboard and mouse in OTG mode.");
&& mmode == SC_MOUSE_INPUT_MODE_DISABLED
&& gmode == SC_GAMEPAD_INPUT_MODE_DISABLED) {
LOGE("Cannot not disable all inputs in OTG mode.");
return false;
}
}