diff --git a/buildroot-external/package/pi-bluetooth/hciunbind.service b/buildroot-external/package/pi-bluetooth/hciunbind.service new file mode 100644 index 000000000..17d6df716 --- /dev/null +++ b/buildroot-external/package/pi-bluetooth/hciunbind.service @@ -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 diff --git a/buildroot-external/package/pi-bluetooth/pi-bluetooth.mk b/buildroot-external/package/pi-bluetooth/pi-bluetooth.mk index 5b244be6b..2f2decf3d 100644 --- a/buildroot-external/package/pi-bluetooth/pi-bluetooth.mk +++ b/buildroot-external/package/pi-bluetooth/pi-bluetooth.mk @@ -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