From eab18076ad7717ff4bce848b95fdb4e6c9f88f29 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 28 Nov 2023 17:23:08 +0100 Subject: [PATCH] Remove kernel HCI driver if no WiFi/Bluetooth module present (#2944) (#2948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove kernel HCI driver if no WiFi/Bluetooth module present (#2944) If the WiFi/Bluetooth module is not present on the SDIO bus, remove the HCI driver. This avoids hci0 interface to be present. Current Home Assistant Core versions show a Bluetooth device as soon as a hci device is present. With this change there won't be a Bluetooth device shown. * Update buildroot-external/package/pi-bluetooth/hcidisable.service Co-authored-by: Jan Čermák --------- Co-authored-by: Jan Čermák --- .../package/pi-bluetooth/hcidisable.service | 10 ++++++++++ .../package/pi-bluetooth/pi-bluetooth.mk | 1 + 2 files changed, 11 insertions(+) create mode 100644 buildroot-external/package/pi-bluetooth/hcidisable.service diff --git a/buildroot-external/package/pi-bluetooth/hcidisable.service b/buildroot-external/package/pi-bluetooth/hcidisable.service new file mode 100644 index 000000000..2548d8f4c --- /dev/null +++ b/buildroot-external/package/pi-bluetooth/hcidisable.service @@ -0,0 +1,10 @@ +[Unit] +Description=Remove HCI kernel driver if WiFi/Bluetooth module is not present +ConditionPathExists=!/sys/bus/sdio/devices/mmc1:0001:1 + +[Service] +Type=forking +ExecStart=/usr/sbin/modprobe -r hci_uart + +[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..c0afd85d6 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/hcidisable.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