mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-07-28 11:49:10 +00:00
Use $ANDROID_SERIAL if no selector is specified
Like adb, read the ANDROID_SERIAL environment variable to select a device by serial if no explicit selection (-s, -d, -e or --tcpip=<addr>) is provided via the command line. Fixes #3111 <https://github.com/Genymobile/scrcpy/issues/3111> PR #3113 <https://github.com/Genymobile/scrcpy/pull/3113>
This commit is contained in:
parent
b1dbc30072
commit
4ce7af42c6
4 changed files with 21 additions and 1 deletions
|
@ -707,7 +707,15 @@ run_server(void *data) {
|
|||
} else if (params->select_tcpip) {
|
||||
selector.type = SC_ADB_DEVICE_SELECT_TCPIP;
|
||||
} else {
|
||||
selector.type = SC_ADB_DEVICE_SELECT_ALL;
|
||||
// No explicit selection, check $ANDROID_SERIAL
|
||||
const char *env_serial = getenv("ANDROID_SERIAL");
|
||||
if (env_serial) {
|
||||
LOGI("Using ANDROID_SERIAL: %s", env_serial);
|
||||
selector.type = SC_ADB_DEVICE_SELECT_SERIAL;
|
||||
selector.serial = env_serial;
|
||||
} else {
|
||||
selector.type = SC_ADB_DEVICE_SELECT_ALL;
|
||||
}
|
||||
}
|
||||
struct sc_adb_device device;
|
||||
ok = sc_adb_select_device(&server->intr, &selector, 0, &device);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue