Add compilation flag for USB features

This allows to disable HID/OTG features on Linux to build without
libusb.
This commit is contained in:
Romain Vimont 2022-02-12 12:38:40 +01:00
parent cc27771dd1
commit ca9e1a0514
3 changed files with 8 additions and 7 deletions

View File

@ -74,7 +74,7 @@ if v4l2_support
src += [ 'src/v4l2_sink.c' ] src += [ 'src/v4l2_sink.c' ]
endif endif
usb_support = host_machine.system() == 'linux' usb_support = get_option('usb') and host_machine.system() == 'linux'
if usb_support if usb_support
src += [ src += [
'src/usb/aoa_hid.c', 'src/usb/aoa_hid.c',

View File

@ -1357,8 +1357,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
opts->keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_HID; opts->keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_HID;
break; break;
#else #else
LOGE("HID over AOA (-K/--hid-keyboard) is not supported on " LOGE("HID over AOA (-K/--hid-keyboard) is disabled (or "
"this platform. It is only available on Linux."); "unsupported on this platform).");
return false; return false;
#endif #endif
case OPT_MAX_FPS: case OPT_MAX_FPS:
@ -1376,8 +1376,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_HID; opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_HID;
break; break;
#else #else
LOGE("HID over AOA (-M/--hid-mouse) is not supported on this" LOGE("HID over AOA (-M/--hid-mouse) is disabled (or "
"platform. It is only available on Linux."); "unsupported on this platform).");
return false; return false;
#endif #endif
case OPT_LOCK_VIDEO_ORIENTATION: case OPT_LOCK_VIDEO_ORIENTATION:
@ -1540,8 +1540,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
opts->otg = true; opts->otg = true;
break; break;
#else #else
LOGE("OTG mode (--otg) is not supported on this platform. It " LOGE("OTG mode (--otg) is disabled (or unsupported on this "
"is only available on Linux."); "platform).");
return false; return false;
#endif #endif
case OPT_V4L2_SINK: case OPT_V4L2_SINK:

View File

@ -5,3 +5,4 @@ option('portable', type: 'boolean', value: false, description: 'Use scrcpy-serve
option('server_debugger', type: 'boolean', value: false, description: 'Run a server debugger and wait for a client to be attached') option('server_debugger', type: 'boolean', value: false, description: 'Run a server debugger and wait for a client to be attached')
option('server_debugger_method', type: 'combo', choices: ['old', 'new'], value: 'new', description: 'Select the debugger method (Android < 9: "old", Android >= 9: "new")') option('server_debugger_method', type: 'combo', choices: ['old', 'new'], value: 'new', description: 'Select the debugger method (Android < 9: "old", Android >= 9: "new")')
option('v4l2', type: 'boolean', value: true, description: 'Enable V4L2 feature when supported') option('v4l2', type: 'boolean', value: true, description: 'Enable V4L2 feature when supported')
option('usb', type: 'boolean', value: true, description: 'Enable HID/OTG features when supported')