Skip to content

linux: detect AirPods after BlueZ service discovery - #901

Closed
gofroshka wants to merge 1 commit into
librepods-org:mainfrom
gofroshka:fix/linux-airpods-service-discovery
Closed

gofroshka wants to merge 1 commit into
librepods-org:mainfrom
gofroshka:fix/linux-airpods-service-discovery

Conversation

@gofroshka

Copy link
Copy Markdown

AirPods can be connected for audio while LibrePods fails to establish its control connection. If BlueZ reports Connected before its UUID list is populated, the monitor ignores the device and does not reconsider it when UUIDs or ServicesResolved changes. The fallback in connectToAirPods() also cannot identify any device: it constructs a QBluetoothDeviceInfo from an address without loading its service UUIDs, then searches that empty list for the AirPods UUID.

This change rechecks BlueZ device properties after connection and service-discovery updates and uses the same BlueZ enumeration for explicit retries. It remembers announced devices to avoid duplicate connection notifications and to handle disconnection even after BlueZ clears their UUIDs. It also avoids invoking bluetoothctl connect without a known address. The unused startup fallback is removed; the existing monitor callback already handles A2DP activation.

The monitor no longer scans from its constructor, before its consumer has connected the signals. The existing explicit startup scan in AirPodsTrayApp remains. An optional D-Bus connection argument lets the regression tests use a disconnected connection without accessing the host Bluetooth service.

Validation:

  • Full Linux application and librepods-ctl build passed with GCC 16.2.1 and Qt 6.12.0.
  • ctest --test-dir build --output-on-failure passed.
  • Six regression cases cover delayed service discovery, duplicate notifications, explicit retries, disconnect/reconnect after UUID removal, incomplete snapshots, unrelated devices, and missing names.
  • git diff --check passed.
  • Hardware validation remains pending. Host logs showed AirPods Max audio connection followed by LibrePods reporting no connected AirPods, including a connection attempt with an empty address. The patched binary has been installed locally for testing, but an end-to-end hardware result is not yet available.

Build and test:

cmake -S linux -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON
cmake --build build --parallel 4
ctest --test-dir build --output-on-failure

Prepared against main at 89356c08 (also tagged v1.0.4), confirmed by fetching upstream before submission.

Checked all 112 open upstream PRs for overlapping changes before submission. Related PR #892 restricts D-Bus signal admission, while #518 changes L2CAP transport; neither addresses the delayed service-discovery handling or empty-UUID fallback fixed here.

@kavishdevar kavishdevar closed this Nov 9, 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