mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-16 01:26:30 +00:00
Unbind Broadcom HCI driver on RPi/CM without WiFi (#4139)
Unbind the Bluetooth driver for Broadcom HCI module before the bluetooth service starts if running on board without WiFi module. This is a replacement for #2948 but using a more targeted approach for removing the particular driver and better detection of no-WiFi (thus no-Bluetooth) models. This still means the driver will be probed and couple of lines printed when it fails to set baudrate and reset the module, yet this should be benign, at least the all-zero MAC device no longers appears in Bluetooth stack. (cherry picked from commit aff1f81817c600ea4c1bec028a2b520fe17b8b42)
This commit is contained in:
parent
3c1aa91376
commit
2fb98a4a73
14
buildroot-external/package/pi-bluetooth/hciunbind.service
Normal file
14
buildroot-external/package/pi-bluetooth/hciunbind.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Unbind Broadcom HCI driver if WiFi/Bluetooth module is not present
|
||||
ConditionPathExists=!/sys/bus/sdio/devices/mmc1:0001:1
|
||||
ConditionPathExists=/sys/bus/serial/drivers/hci_uart_bcm/unbind
|
||||
ConditionPathExists=/proc/device-tree/chosen/rpi-boardrev-ext
|
||||
Before=bluetooth.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecCondition=/bin/sh -c 'test $((16#$(xxd -p -g4 /proc/device-tree/chosen/rpi-boardrev-ext) & 16#40000000)) -gt 0'
|
||||
ExecStart=/bin/sh -c 'echo "serial0-0" > /sys/bus/serial/drivers/hci_uart_bcm/unbind'
|
||||
|
||||
[Install]
|
||||
WantedBy=hassos-hardware.target
|
@ -12,6 +12,7 @@ PI_BLUETOOTH_LICENSE_FILES = debian/copyright
|
||||
define PI_BLUETOOTH_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/hassos-hardware.target.wants
|
||||
$(INSTALL) -m 0644 $(BR2_EXTERNAL_HASSOS_PATH)/package/pi-bluetooth/hciuart.service $(TARGET_DIR)/usr/lib/systemd/system/
|
||||
$(INSTALL) -m 0644 $(BR2_EXTERNAL_HASSOS_PATH)/package/pi-bluetooth/hciunbind.service $(TARGET_DIR)/usr/lib/systemd/system/
|
||||
$(INSTALL) -m 0644 $(BR2_EXTERNAL_HASSOS_PATH)/package/pi-bluetooth/bthelper@.service $(TARGET_DIR)/usr/lib/systemd/system/
|
||||
|
||||
$(INSTALL) -d $(TARGET_DIR)/usr/bin
|
||||
|
Loading…
x
Reference in New Issue
Block a user