Skip to content

Commit

Permalink
Add compilation flag for USB features
Browse files Browse the repository at this point in the history
This allows to disable HID/OTG features on Linux to build without
libusb.
  • Loading branch information
rom1v committed Feb 12, 2022
1 parent cc27771 commit ca9e1a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if v4l2_support
src += [ 'src/v4l2_sink.c' ]
endif

usb_support = host_machine.system() == 'linux'
usb_support = get_option('usb') and host_machine.system() == 'linux'
if usb_support
src += [
'src/usb/aoa_hid.c',
Expand Down
12 changes: 6 additions & 6 deletions app/src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
break;
#else
LOGE("HID over AOA (-K/--hid-keyboard) is not supported on "
"this platform. It is only available on Linux.");
LOGE("HID over AOA (-K/--hid-keyboard) is disabled (or "
"unsupported on this platform).");
return false;
#endif
case OPT_MAX_FPS:
Expand All @@ -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;
break;
#else
LOGE("HID over AOA (-M/--hid-mouse) is not supported on this"
"platform. It is only available on Linux.");
LOGE("HID over AOA (-M/--hid-mouse) is disabled (or "
"unsupported on this platform).");
return false;
#endif
case OPT_LOCK_VIDEO_ORIENTATION:
Expand Down Expand Up @@ -1540,8 +1540,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
opts->otg = true;
break;
#else
LOGE("OTG mode (--otg) is not supported on this platform. It "
"is only available on Linux.");
LOGE("OTG mode (--otg) is disabled (or unsupported on this "
"platform).");
return false;
#endif
case OPT_V4L2_SINK:
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_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('usb', type: 'boolean', value: true, description: 'Enable HID/OTG features when supported')

0 comments on commit ca9e1a0

Please sign in to comment.