Fail on AOA keyboard/mouse initialization error

If the AOA keyboard or the AOA mouse fails to be initialized, this is a
fatal error.

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 49c8ca34fd
commit 08da2e068e

View file

@ -641,12 +641,15 @@ scrcpy(struct scrcpy_options *options) {
goto end;
}
bool aoa_fail = false;
if (use_keyboard_aoa) {
if (sc_keyboard_aoa_init(&s->keyboard_aoa, &s->aoa)) {
keyboard_aoa_initialized = true;
kp = &s->keyboard_aoa.key_processor;
} else {
LOGE("Could not initialize HID keyboard");
aoa_fail = true;
goto aoa_complete;
}
}
@ -656,12 +659,13 @@ scrcpy(struct scrcpy_options *options) {
mp = &s->mouse_aoa.mouse_processor;
} else {
LOGE("Could not initialized HID mouse");
aoa_fail = true;
goto aoa_complete;
}
}
bool need_aoa = keyboard_aoa_initialized || mouse_aoa_initialized;
if (!need_aoa || !sc_aoa_start(&s->aoa)) {
aoa_complete:
if (aoa_fail || !sc_aoa_start(&s->aoa)) {
sc_acksync_destroy(&s->acksync);
sc_usb_disconnect(&s->usb);
sc_usb_destroy(&s->usb);