Improve adb devices parsing - #6664
Merged
Merged
Conversation
This was referenced Feb 9, 2026
Closed
yume-chan
reviewed
Feb 10, 2026
rom1v
force-pushed
the
adb-devices-parsing
branch
2 times, most recently
from
February 10, 2026 08:03
26b32b0 to
c075968
Compare
rom1v
added a commit
that referenced
this pull request
Feb 12, 2026
`adb devices -l` prints one device per line, containing, separated by spaces: - the device serial, - the device state, - a list of key:value pairs. However, the device serial itself may contain spaces, making a simple split ambiguous. To avoid ambiguity, parse the string backwards: - first, parse all the trailing values until the device state, identified using a list of well-known values; - finally, treat the remaining leading token as the device serial. PR #6664 <#6664>
rom1v
force-pushed
the
adb-devices-parsing
branch
from
February 12, 2026 19:06
c075968 to
6a14809
Compare
`adb devices -l` prints one device per line, containing, separated by spaces: - the device serial, - the device state, - a list of key:value pairs. However, the device serial itself may contain spaces, making a simple split ambiguous. To avoid ambiguity, parse the string backwards: - first, parse all the trailing values until the device state, identified using a list of well-known values; - finally, treat the remaining leading token as the device serial. Fixes #3537 <#3537> Refs #6248 <#6248> PR #6664 <#6664>
rom1v
force-pushed
the
adb-devices-parsing
branch
from
February 12, 2026 19:07
6a14809 to
82e102e
Compare
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.
adb devices -lprints one device per line, containing, separated by spaces:However, the device serial itself may contain spaces, making a simple split ambiguous.
To avoid ambiguity, parse the string backwards:
Refs #6248
Fixes #3537