mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-21 12:05:00 +00:00
Retrieve device serial for AOA
The serial is necessary to find the correct Android device for AOA. If it is not explicitly provided by the user via -s, then execute "adb getserialno" to retrieve it.
This commit is contained in:
parent
95b6f653cc
commit
ad1f3fd90f
1 changed files with 17 additions and 1 deletions
|
@ -437,7 +437,23 @@ scrcpy(struct scrcpy_options *options) {
|
|||
if (options->keyboard_input_mode == SC_KEYBOARD_INPUT_MODE_HID) {
|
||||
#ifdef HAVE_AOA_HID
|
||||
bool aoa_hid_ok = false;
|
||||
if (!aoa_init(&s->aoa, options->serial)) {
|
||||
|
||||
char *serialno = NULL;
|
||||
|
||||
const char *serial = options->serial;
|
||||
if (!serial) {
|
||||
serialno = adb_get_serialno();
|
||||
if (!serialno) {
|
||||
LOGE("Could not get device serial");
|
||||
goto aoa_hid_end;
|
||||
}
|
||||
serial = serialno;
|
||||
LOGI("Device serial: %s", serial);
|
||||
}
|
||||
|
||||
bool ok = aoa_init(&s->aoa, serial);
|
||||
free(serialno);
|
||||
if (!ok) {
|
||||
goto aoa_hid_end;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue