Repository navigation
Improve device selection - #3005
Merged
Merged
Conversation
rom1v
force-pushed
the
adb_devices
branch
5 times, most recently
from
February 7, 2022 12:22
92d74c9 to
c0bc183
Compare
1 task done
This sounds ideal 👌 matches the muscle memory from using |
Collaborator
Author
Thank you for your feedback. On the other hand, these |
rom1v
force-pushed
the
adb_devices
branch
3 times, most recently
from
February 8, 2022 12:39
bf16261 to
47ec09b
Compare
Collaborator
Author
|
I changed to |
Since the previous commit, if a serial is given via -s/--serial (either a real USB serial or an IP:port), a device is selected if its serial matches exactly. In addition, if the user pass an IP without a port, then select any device with this IP, regardless of the port (so that "192.168.1.1" matches any "192.168.1.1:port"). This is also the default behavior of adb. PR #3005 <#3005>
If several devices are connected (as listed by `adb devices`), it was necessary to provide the explicit serial via -s/--serial. If only one device is connected via USB (respectively, via TCP/IP), it might be convenient to select it automatically. For this purpose, two new options are introduced: - -d/--select-usb: select the single device connected over USB - -e/--select-tcpip: select the single device connected over TCP/IP PR #3005 <#3005>
2 tasks done
1 task done
rom1v
added a commit
that referenced
this pull request
Mar 22, 2022
rom1v
added a commit
that referenced
this pull request
Mar 22, 2022
Linux4
pushed a commit
to Linux4/scrcpy
that referenced
this pull request
Sep 5, 2025
scrcpy v1.23 Changes since v1.22: - Add HID/OTG support for Windows (--otg only) (Genymobile#2773, Genymobile#3011) - Add HID/OTG support for macOS (Genymobile#2774, Genymobile#3031) - Improve device selection (list devices, -d, -e) (Genymobile#3005) - Downscale and retry on MediaCodec error in more cases (Genymobile#2990, Genymobile#3043) - Add ZSH completion script (Genymobile#3012) - Add Bash completion script (Genymobile#2930, Genymobile#3048) - Add --no-cleanup option (Genymobile#1764, Genymobile#3020) - Add --printf-fps (Genymobile#468, Genymobile#3030) - Print both compiled and linked version of libs on --version - Fix FPS counter (broken in v1.22) - Various technical refactors and fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, if several devices are connected,
scrcpyfails with:This is not very user-friendly: the user must call
adb devicesmanually to get the serial, then callscrcpy -s xxxxxxxxxxexplicitly.This PR brings features to improve device selection.
If several devices are connected, scrcpy prints the list of devices:
So it is possible to immediately call scrcpy again with
-s.In addition, two new options allow to select a USB or TCP/IP device when there is only one connected:
-d(or--select-usb) uses a USB device (likeadb -d)-e(or--select-tcpip) uses a TCP/IP device (likeadb -e)For example, to run
scrcpywith the single TCP/IP device:To run
scrcpywith a single USB device:Since there are several devices connected over USB in this example, it fails, with a detailed error message.
Notice that the list of devices is printed at
DEBUGlevel if it works (so it is not printed in release mode unless-Vdebugis passed), whereas it is printed atERRORlevel if it fails.(Maybe we should print it at
INFOlevel when everything works, so that it is always printed?)The first commits implement the same behavior for listing USB devices for HID/OTG mode (introduced in v1.22:
Do not conflate
--select-tcpipwith the--tcpipoption introduced in v1.21.--tcpip(without argument):-s, even-Uor-T)adb tcpip 5555)adb shell ip route)adb connect IP:5555)--select-tcpipjust selects a device already connected (i.e. listed inadb devices) via TCP/IPIn hindsight, maybe
--tcpipshould have been called--connect-tcpipor similar to avoid confusion, but it's too late.