Skip to content

fix(android): detect devices whose adb serial contains spaces - #531

Open
RaphaelFakhri wants to merge 1 commit into
tauri-apps:devfrom
RaphaelFakhri:fix/adb-serial-with-spaces
Open

RaphaelFakhri wants to merge 1 commit into
tauri-apps:devfrom
RaphaelFakhri:fix/adb-serial-with-spaces

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Closes #522.

ADB_DEVICE_REGEX matched the serial with [\S]{6,100}, so a line from adb devices whose serial contains a space never matched. Devices paired over wireless debugging can have such serials, for example adb-7492209-mcwnUB (2)._adb-tls-connect._tcp, and cargo mobile did not list them.

adb devices separates the serial and the state with a tab, so the serial group now matches any characters except tab and newline. Every caller already passes the serial to adb -s as a separate argument, so serials with spaces work in later commands.

Changes

  • src/android/adb/device_list.rs: match the serial with [^\t\n]{6,100} and add a test case for a wireless-debugging serial.
  • .changes/adb-serial-with-spaces.md: patch change file.

Testing

  • cargo test --lib test_adb_output_regex: the new case fails on dev (left: []) and passes with the fix.
  • cargo test: all tests pass.
  • cargo fmt --check: clean.

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.

ADB_DEVICE_REGEX fails to match devices with spaces in serial (e.g. wireless-debugging paired devices)

1 participant