Expand description
Bluetooth HCI device node for userland access
Provides /dev/bluetooth/hci0 as a device node that allows the BlueZ
userland shim to send HCI command packets and receive HCI event packets
via the kernel Bluetooth HCI driver.
The device node acts as a bridge between the userland D-Bus daemon (userland/bluez/bluez-hci-bridge.cpp) and the kernel HCI controller (kernel/src/drivers/bluetooth/hci.rs).
Protocol:
- Write: userland sends H4 HCI command packets (type=0x01 + header + params)
- Read: userland receives H4 HCI event packets (type=0x04 + header + params)
- Ioctl: adapter info queries and scan mode configuration
Structs§
- BtDevice
Handle - Handle returned by bt_device_open
Constants§
- BT_
DEVICE_ PATH - Device node path
- BT_
IOCTL_ GET_ ADAPTER_ INFO - Get adapter info (address, name, state)
- BT_
IOCTL_ RESET - Reset the HCI controller
- BT_
IOCTL_ SET_ SCAN_ MODE - Set scan mode (0=off, 1=inquiry, 2=page, 3=both)
Functions§
- bt_
device_ close - Close the Bluetooth HCI device node handle.
- bt_
device_ ioctl - Perform an ioctl on the Bluetooth device node.
- bt_
device_ open - Open the Bluetooth HCI device node. Returns a handle for subsequent read/write/ioctl operations.
- bt_
device_ read - Read the next HCI event from the kernel event queue.
- bt_
device_ write - Write an HCI command packet to the kernel HCI layer.
- init
- Initialize the Bluetooth device node subsystem.
Creates the
/dev/bluetooth/hci0device node entry. Must be called after the Bluetooth controller is initialized. - pending_
event_ count - Get the number of pending events in the queue.
- push_
event - Push an HCI event into the device node’s event queue.