Skip to content

bluetooth: signal devd on netgraph device events#2196

Open
charlesrocket wants to merge 1 commit into
freebsd:mainfrom
charlesrocket:bt-devd
Open

bluetooth: signal devd on netgraph device events#2196
charlesrocket wants to merge 1 commit into
freebsd:mainfrom
charlesrocket:bt-devd

Conversation

@charlesrocket
Copy link
Copy Markdown

Currently, devd emits events for external adapters only. Send Netgraph init/disconnect events to devd so the internal adapter's state could be asserted from userland.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

Thank you for taking the time to contribute to FreeBSD!

All issues resolved.

Currently, devd emits events for external adapters only. Send Netgraph init/disconnect events to devd so the internal adapter's state could be asserted from userland.

Signed-off-by: Kirill Orlov (-k) <slowdive@me.com>
@charlesrocket
Copy link
Copy Markdown
Author

Motivation

I needed a piece of code that could listen for bluetooth adapter's state changes in userland (event-driven exclusively, absolutely no polling). Since this is a built-in/static adapter (T480), devd does not produce any events on "power cycle" (one needs to physically pull the device out/disconnect to trigger these events, which is not possible with soldered devices). The only other way to catch these changes is via netgraph, but it requires root.

With this patch, netgraph sends "power cycle" events (NGM_HCI_NODE_INIT case and ng_hci_disconnect() call) to devd, allowing userland to access these events (kqueue on the socket/directly/etc).

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