Skip to content

Improve adb devices parsing - #6664

Merged
rom1v merged 1 commit into
devfrom
adb-devices-parsing
Feb 12, 2026
Merged

rom1v merged 1 commit into
devfrom
adb-devices-parsing

Conversation

@rom1v

@rom1v rom1v commented Feb 9, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Refs #6248
Fixes #3537

Comment thread app/src/adb/adb_parser.c Outdated
@rom1v
rom1v force-pushed the adb-devices-parsing branch 2 times, most recently from 26b32b0 to c075968 Compare February 10, 2026 08:03
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
rom1v force-pushed the adb-devices-parsing branch from c075968 to 6a14809 Compare February 12, 2026 19:06
`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
rom1v force-pushed the adb-devices-parsing branch from 6a14809 to 82e102e Compare February 12, 2026 19:07
@rom1v
rom1v merged commit 82e102e into dev Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants