From cbd3289db08dc825ca2dc26560deb65ae2f4fa55 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 21 Feb 2024 15:27:06 +0100 Subject: [PATCH] Initialize controller before keyboards The UHID keyboard initializer will need the controller. --- app/src/scrcpy.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 876b400a..c7e84be4 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -542,6 +542,18 @@ scrcpy(struct scrcpy_options *options) { struct sc_mouse_processor *mp = NULL; if (options->control) { + if (!sc_controller_init(&s->controller, s->server.control_socket, + acksync)) { + goto end; + } + controller_initialized = true; + + if (!sc_controller_start(&s->controller)) { + goto end; + } + controller_started = true; + controller = &s->controller; + #ifdef HAVE_USB bool use_keyboard_aoa = options->keyboard_input_mode == SC_KEYBOARD_INPUT_MODE_AOA; @@ -662,18 +674,6 @@ aoa_hid_end: sc_mouse_sdk_init(&s->mouse_sdk, &s->controller); mp = &s->mouse_sdk.mouse_processor; } - - if (!sc_controller_init(&s->controller, s->server.control_socket, - acksync)) { - goto end; - } - controller_initialized = true; - - if (!sc_controller_start(&s->controller)) { - goto end; - } - controller_started = true; - controller = &s->controller; } // There is a controller if and only if control is enabled