Bluetooth Docker setup (not working)

Hello!

I have a Plugable USB-BT4LE adapter I’m repurposing for my HASS setup to add some connectivity functionality. HASS is running in a docker container on a linux machine. For some reason after I downloaded the applicable driver as indicated by running the below the mac address is coming back as all zeroes.

sudo dmesg|grep -1 bluetooth

To download the driver I ran the below command while navigated to /lib/firmware/brcm in terminal

sudo wget https://github.com/winterheart/broadcom-bt-firmware/blob/3b7cff924bd0280cd332be47fed32b0a00d002c6/brcm/BCM20702A1-0a5c-21e8.hcd

After doing this I rebooted and can no longer see the mac address as per the command(S) below.

server@server:/lib/firmware/brcm$ sudo dmesg | grep -i bluetooth 
[    2.841853] Bluetooth: Core ver 2.22
[    2.841877] NET: Registered PF_BLUETOOTH protocol family
[    2.841879] Bluetooth: HCI device and connection manager initialized
[    2.841882] Bluetooth: HCI socket layer initialized
[    2.841884] Bluetooth: L2CAP socket layer initialized
[    2.841889] Bluetooth: SCO socket layer initialized
[    3.093247] Bluetooth: hci0: BCM: chip id 63
[    3.094248] Bluetooth: hci0: BCM: features 0x07
[    3.110264] Bluetooth: hci0: server
[    3.110268] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[    3.115475] Bluetooth: hci0: BCM20702A1 'brcm/BCM20702A1-0a5c-21e8.hcd' Patch
[    4.008613] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    4.008617] Bluetooth: BNEP filters: protocol multicast
[    4.008620] Bluetooth: BNEP socket layer initialized
[    5.187257] Bluetooth: hci0: command 0x0a0a tx timeout
[   13.380221] Bluetooth: hci0: BCM: Patch command 0a0a failed (-110)
[   13.380230] Bluetooth: hci0: BCM: Patch failed (-110)
[   15.619224] Bluetooth: hci0: command 0x1001 tx timeout
[   23.619250] Bluetooth: hci0: BCM: Reading local version info failed (-110)
[ 1671.423176] Bluetooth: hci0: command 0x1001 tx timeout
server@server:/opt$ hciconfig -a
hci0:   Type: Primary  Bus: USB
        BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
        DOWN 
        RX bytes:340 acl:0 sco:0 events:11 errors:0
        TX bytes:58 acl:0 sco:0 commands:16 errors:0
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
        Packet type: DM1 DH1 HV1 
        Link policy: 
        Link mode: PERIPHERAL ACCEPT 
server@server:/opt$ sudo service bluetooth status
● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-05-19 10:13:18 CDT; 39min ago
       Docs: man:bluetoothd(8)
   Main PID: 1017 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 19021)
     Memory: 2.9M (peak: 3.2M)
        CPU: 36ms
     CGroup: /system.slice/bluetooth.service
             └─1017 /usr/libexec/bluetooth/bluetoothd
server@server:/opt$ sudo hciconfig hci0 up
Can't init device hci0: Connection timed out (110)

I do have the dbus setup in my docker-compose.yaml

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
<truncated>

After a couple hours I’m here hoping someone smarter than I with Linux can help me out. These are all being run on the host box, not from inside the docker container. When I try to add the integration I get the error below from hass.

image

Fixed by unplugging, doing a full (commanded) shutdown, plugging it in and booting.

How that worked over a commanded reboot I have no idea, but that’s what did it for me!