Skip to content

Normalise device address before resolution#108

Open
klochowicz wants to merge 2 commits into
toy:mainfrom
klochowicz:fix/normalise-device-address
Open

Normalise device address before resolution#108
klochowicz wants to merge 2 commits into
toy:mainfrom
klochowicz:fix/normalise-device-address

Conversation

@klochowicz
Copy link
Copy Markdown

@klochowicz klochowicz commented May 8, 2026

  • IOBluetoothDevice deviceWithAddressString: silently returns nil for two specific input shapes — hyphen-separated all-lowercase (aa-bb-cc-dd-ee-ff) and no-separator all-uppercase (AABBCCDDEEFF) — even though both already pass the regex in check_device_address_arg. Other case/separator combinations parse correctly.
  • Normalise the regex-validated input to colon-separated lowercase before passing it to the API; that form parses correctly in every combination, sidestepping the framework bug.
  • Add a regression test in ./test that resolves every case/separator variant of the first paired device's address via --info. Skipped silently when no paired device is available, so the harness still works on a virgin machine.

klochowicz added 2 commits May 8, 2026 16:03
IOBluetoothDevice's deviceWithAddressString: silently fails for two
specific input shapes: hyphenated all-lowercase ("aa-bb-cc-dd-ee-ff")
and no-separator all-uppercase ("AABBCCDDEEFF"). Other case and
separator combinations parse correctly.

Normalise the regex-validated input to colon-separated lowercase
before resolution; that form parses correctly in every combination.
@toy
Copy link
Copy Markdown
Owner

toy commented May 8, 2026

Thanks for opening the PR
Can you please tell a bit more about the conditions of your problem? IOBluetoothDevice deviceWithAddressString: should return the device even if it is not known/paired/inquired. So all following should return identical output (besides recent access date):

blueutil --info aabbccddeeff
blueutil --info aabbccDDEEFF
blueutil --info AABBCCDDEEFF
blueutil --info aa-bb-cc-dd-ee-ff
blueutil --info aa-bb-cc-DD-EE-FF
blueutil --info AA-BB-CC-DD-EE-FF
blueutil --info aa:bb:cc:dd:ee:ff
blueutil --info aa:bb:cc:DD:EE:FF
blueutil --info AA:BB:CC:DD:EE:FF

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