Rename HAVE_AOA_HID to HAVE_USB

The condition actually determines whether scrcpy can use libusb or not.

PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974>
This commit is contained in:
Romain Vimont 2022-01-24 22:29:07 +01:00
parent 2762f5d183
commit d48d191262
3 changed files with 14 additions and 14 deletions

View file

@ -72,8 +72,8 @@ if v4l2_support
src += [ 'src/v4l2_sink.c' ] src += [ 'src/v4l2_sink.c' ]
endif endif
aoa_hid_support = host_machine.system() == 'linux' usb_support = host_machine.system() == 'linux'
if aoa_hid_support if usb_support
src += [ src += [
'src/usb/aoa_hid.c', 'src/usb/aoa_hid.c',
'src/usb/hid_keyboard.c', 'src/usb/hid_keyboard.c',
@ -99,7 +99,7 @@ if not crossbuild_windows
dependencies += dependency('libavdevice') dependencies += dependency('libavdevice')
endif endif
if aoa_hid_support if usb_support
dependencies += dependency('libusb-1.0') dependencies += dependency('libusb-1.0')
endif endif
@ -193,7 +193,7 @@ conf.set('SERVER_DEBUGGER_METHOD_NEW', get_option('server_debugger_method') == '
conf.set('HAVE_V4L2', v4l2_support) conf.set('HAVE_V4L2', v4l2_support)
# enable HID over AOA support (linux only) # enable HID over AOA support (linux only)
conf.set('HAVE_AOA_HID', aoa_hid_support) conf.set('HAVE_USB', usb_support)
configure_file(configuration: conf, output: 'config.h') configure_file(configuration: conf, output: 'config.h')

View file

@ -1318,7 +1318,7 @@ 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_AOA_HID #ifdef HAVE_USB
opts->keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_HID; opts->keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_HID;
break; break;
#else #else
@ -1337,7 +1337,7 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
} }
break; break;
case 'M': case 'M':
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_HID; opts->mouse_input_mode = SC_MOUSE_INPUT_MODE_HID;
break; break;
#else #else

View file

@ -23,7 +23,7 @@
#include "screen.h" #include "screen.h"
#include "server.h" #include "server.h"
#include "stream.h" #include "stream.h"
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
# include "usb/aoa_hid.h" # include "usb/aoa_hid.h"
# include "usb/hid_keyboard.h" # include "usb/hid_keyboard.h"
# include "usb/hid_mouse.h" # include "usb/hid_mouse.h"
@ -46,20 +46,20 @@ struct scrcpy {
#endif #endif
struct sc_controller controller; struct sc_controller controller;
struct sc_file_pusher file_pusher; struct sc_file_pusher file_pusher;
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
struct sc_aoa aoa; struct sc_aoa aoa;
// sequence/ack helper to synchronize clipboard and Ctrl+v via HID // sequence/ack helper to synchronize clipboard and Ctrl+v via HID
struct sc_acksync acksync; struct sc_acksync acksync;
#endif #endif
union { union {
struct sc_keyboard_inject keyboard_inject; struct sc_keyboard_inject keyboard_inject;
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
struct sc_hid_keyboard keyboard_hid; struct sc_hid_keyboard keyboard_hid;
#endif #endif
}; };
union { union {
struct sc_mouse_inject mouse_inject; struct sc_mouse_inject mouse_inject;
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
struct sc_hid_mouse mouse_hid; struct sc_hid_mouse mouse_hid;
#endif #endif
}; };
@ -284,7 +284,7 @@ scrcpy(struct scrcpy_options *options) {
bool v4l2_sink_initialized = false; bool v4l2_sink_initialized = false;
#endif #endif
bool stream_started = false; bool stream_started = false;
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
bool aoa_hid_initialized = false; bool aoa_hid_initialized = false;
bool hid_keyboard_initialized = false; bool hid_keyboard_initialized = false;
bool hid_mouse_initialized = false; bool hid_mouse_initialized = false;
@ -411,7 +411,7 @@ scrcpy(struct scrcpy_options *options) {
struct sc_mouse_processor *mp = NULL; struct sc_mouse_processor *mp = NULL;
if (options->control) { if (options->control) {
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
bool use_hid_keyboard = bool use_hid_keyboard =
options->keyboard_input_mode == SC_KEYBOARD_INPUT_MODE_HID; options->keyboard_input_mode == SC_KEYBOARD_INPUT_MODE_HID;
bool use_hid_mouse = bool use_hid_mouse =
@ -594,7 +594,7 @@ aoa_hid_end:
end: end:
// The stream is not stopped explicitly, because it will stop by itself on // The stream is not stopped explicitly, because it will stop by itself on
// end-of-stream // end-of-stream
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
if (aoa_hid_initialized) { if (aoa_hid_initialized) {
if (hid_keyboard_initialized) { if (hid_keyboard_initialized) {
sc_hid_keyboard_destroy(&s->keyboard_hid); sc_hid_keyboard_destroy(&s->keyboard_hid);
@ -635,7 +635,7 @@ end:
} }
#endif #endif
#ifdef HAVE_AOA_HID #ifdef HAVE_USB
if (aoa_hid_initialized) { if (aoa_hid_initialized) {
sc_aoa_join(&s->aoa); sc_aoa_join(&s->aoa);
sc_aoa_destroy(&s->aoa); sc_aoa_destroy(&s->aoa);