Skip to content

Release the adapter to BlueZ on HCI User Channel close - #1

Open
AloisKlingler wants to merge 1 commit into
wimaha:masterfrom
AloisKlingler:release-adapter-on-close
Open

Release the adapter to BlueZ on HCI User Channel close#1
AloisKlingler wants to merge 1 commit into
wimaha:masterfrom
AloisKlingler:release-adapter-on-close

Conversation

@AloisKlingler

Copy link
Copy Markdown

When the HCI User Channel socket is closed, the controller is left down and disappears from BlueZ (D-Bus / btmgmt shows no controller), so other BlueZ clients cannot use the adapter until the owning process exits.

This stores the device id on the Socket and issues an HCIDEVUP ioctl in Close() on a fresh raw HCI socket, so BlueZ re-acquires the adapter immediately when the channel is released. Mirrors the existing HCIDEVUP already done in open().

This makes it possible for TeslaBleHttpProxy to share a single adapter with other BlueZ-based tools between command sessions (context: wimaha/TeslaBleHttpProxy#158).

Closing the HCI User Channel leaves the controller down and invisible to
BlueZ over D-Bus, so no other BlueZ client can use the adapter until the
process that opened the channel exits. Store the device id on the Socket
and issue an HCIDEVUP ioctl in Close() so BlueZ re-acquires the adapter
as soon as the channel is released.
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.

1 participant