Skip to content

Commit

Permalink
Retrieve device serial for AOA
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rom1v committed Oct 26, 2021
1 parent d55015e commit 5113567
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/src/scrcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,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 (!sc_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 = sc_aoa_init(&s->aoa, serial);
free(serialno);
if (!ok) {
goto aoa_hid_end;
}

Expand Down

0 comments on commit 5113567

Please sign in to comment.