Host OS Support for Bluetooth Devices


Recommended Posts

  • 4 weeks later...

Hey Guys, 

my bluetooth dongle is getting recognized by UnRaid 6.7.0-rc4 

Bus 001 Device 015: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

but i can't access it in a container i passed it into

--device='/dev/bus/usb/001/015' 
root@a1bb5caea46b:/# hcitool dev
Devices:

How do you pass a bluetooth dongle into a container?

I usually use 

/dev/serial/by-id/<NAME OF DEVICE>

but the dongle isn't showing up there.

 

Edit:

Using --net=host, Bluetooth is perfectly usable, but for me that actually isn't a solution because I need Bluetooth capabilities in my containers residing in bridged Networks.

Edited by Diggewuff
Link to comment
  • 3 months later...

Hi:

 

I'm having some problems to configure my BT dongle on a Homeassistant docker.

 

Going to tools->system devices on unraid shows me this:

Bus 001 Device 008:ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

 

I'm passing the following comands to the container:

--net=host

 

--device='/dev/bus/usb/001/008'

 

After restarting the container, running the following command under the container console is not showing up any BT dongle:

# hcitool dev
Devices:

 

Runing this, it gets stuck on waiting:

# bluetoothctl 
Waiting to connect to bluetoothd...

 

I also tryed the container in Privilege mode with no succes. Rebooting the host is not working neither. I tryed those same commands on unraid host console to check that this dongle is usable but the is no hcitool installed... What I'm doing wrong? Is there anyway to check if BT USB passtrought into the container is working?

 

Thanks

Edited by yayitazale
more info and formatting
  • Like 1
Link to comment
  • 1 month later...

After messing with this for a bit I realized I could in fact pass the specific USB bluetooth device as yayitazale attempted above.  The key was to pass it as a path.  Instead of doing 

--device='/dev/bus/usb/001/006'

Pass that device as a path with read/write access and make the container privileged.  So under your docker container settings, add a path and enter the device path into both the host and container path values and make it read/write:

bluetooth_docker.thumb.png.a32d5dd58981c159252d511c861872bf.png

More specific to the home assistant docker container, it did not start up with the device running so I had to start it.  To do that, first run hciconfig (Bluetooth MAC addresses obscured to protect the innocent):

# hciconfig
hci0:   Type: Primary  Bus: USB
        BD Address: XX:XX:XX:XX:XX:XX  ACL MTU: 1021:8  SCO MTU: 64:1
        DOWN 
        RX bytes:1609 acl:0 sco:0 events:74 errors:0
        TX bytes:777 acl:0 sco:0 commands:70 errors:0

So we see hci0 is there but is down, so issue the up command:

# hciconfig hci0 up
# hciconfig
hci0:   Type: Primary  Bus: USB
        BD Address: XX:XX:XX:XX:XX:XX  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING 
        RX bytes:2183 acl:0 sco:0 events:104 errors:0
        TX bytes:1145 acl:0 sco:0 commands:100 errors:0

And now with a subsequent hciconfig command see the device is running.  So now we can do stuff like lescan:

# hcitool lescan
LE Scan ...
XX:XX:XX:XX:XX:XX bhyve_XXXXXX
XX:XX:XX:XX:XX:XX (unknown)
XX:XX:XX:XX:XX:XX (unknown)
XX:XX:XX:XX:XX:XX (unknown)

I haven't gone as far as to get bluetooth devices reading in home assistant yet, but at least this proves that the device can be passed to the docker from unraid regardless of whether the firmware file is there.

  • Thanks 1
Link to comment
On 1/21/2019 at 10:19 PM, limetech said:

Let me know how this works out.  There are a set of realtek bluetooth devices which require firmware and I've had a hard time finding the "official" firmware bin files.  We'll keep an eye out for them but if the device doesn't work and it's realtek, check the syslog to see if there is a message indicating "can't find firmware".

It missing this firmware :

Jul 24 23:05:51 SVR-UNRAID-NAS kernel: bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0b05-17cb.hcd failed with error -2
Jul 24 23:05:51 SVR-UNRAID-NAS kernel: Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0b05-17cb.hcd not found

 

If it could be added to the next release it would be appreciated :) @limetech

Link to comment

For what it's worth, I verified that my post above does work.  I built a Node-RED docker including Noble (a Bluetooth Low Energy scanning node) and was able to pass in the Bluetooth dongle using the instructions above, even without having the dongle's firmware on the host.

 

That said, obviously it'd be nice to pass it by a proper name e.g.

/dev/hci0

So it'd still be nice to add that large chunk of various manufacturer's firwmare I posted.

Edited by Chuck Claunch
Link to comment
  • 4 months later...

Hi, I just built an unraid server ( Linux 4.19.56-Unraid x86_64).  Motherboard is a Gigabyte B450 I AORUS PRO WIFI-CF.  Was trying to get bluetooth enabled and noticed in syslog it is looking for intel/ibt-18-16-1.sfi (actual error below).  It appears the unraid boot image contains ibt-11-5 and ibt-12-16.  Is there anything obvious I should try (aside from trying to wget the right driver and permanently store it in ram duh :-)).  Trying to patch in the driver to the boot flash drive image seems a bit daunting...

 

Error:

 

hci0: Direct firmware load for intel/ibt-18-16-1.sfi failed with error -2

Link to comment
3 hours ago, jafo09 said:

Hi, I just built an unraid server ( Linux 4.19.56-Unraid x86_64).  Motherboard is a Gigabyte B450 I AORUS PRO WIFI-CF.  Was trying to get bluetooth enabled and noticed in syslog it is looking for intel/ibt-18-16-1.sfi (actual error below).  It appears the unraid boot image contains ibt-11-5 and ibt-12-16.  Is there anything obvious I should try (aside from trying to wget the right driver and permanently store it in ram duh :-)).  Trying to patch in the driver to the boot flash drive image seems a bit daunting...

 

Error:

 

hci0: Direct firmware load for intel/ibt-18-16-1.sfi failed with error -2

A couple things: you should be using latest stable Unraid release 6.8.0, but that won't solve this.

What is output of this command?

modinfo btintel

 

Link to comment
4 minutes ago, limetech said:

Thanks for the quick response.

 

 

A couple things: you should be using latest stable Unraid release 6.8.0, but that won't solve this.

Will update, always good to be on the latest stable release.

4 minutes ago, limetech said:

What is output of this command?


modinfo btintel

 

root@EMT:/lib/firmware/intel# modinfo btintel
filename:       /lib/modules/4.19.56-Unraid/kernel/drivers/bluetooth/btintel.ko.xz
firmware:       intel/ibt-12-16.ddc
firmware:       intel/ibt-12-16.sfi
firmware:       intel/ibt-11-5.ddc
firmware:       intel/ibt-11-5.sfi
license:        GPL
version:        0.1
description:    Bluetooth support for Intel devices ver 0.1
author:         Marcel Holtmann <[email protected]>
srcversion:     B978516D847A719EA755825
depends:        bluetooth
retpoline:      Y
intree:         Y
name:           btintel
vermagic:       4.19.56-Unraid SMP mod_unload 

Link to comment
11 minutes ago, Chuck Claunch said:

If you just need to use the device in a docker or VM, you can just pass in the entire usb bus.  No need to have the BT drivers in the main unraid instance.  See my comment above:  

 

 

I've been using bluetooth in a docker for node-red for about six months with no issues.

 

This is an interesting solution!

 

The entire reason BT support was added into Unraid kernel was to support passing to Docker containers.  The main reason I never wanted to add this before was exactly what we're seeing: BT devices (and also wireless network devices btw) are notorious for very frequent driver and firmware updates which would necessitate very frequent and trivial Unraid OS releases.

 

Hence I want to float this idea to you guys in this topic: suppose we rip out BT support from the Unraid kernel and everyone use the @Chuck Claunch method of using BT in a container?  Sure there will be some who don't want to change anything because current config works for them, however moving forward this might be the best overall solution?

Link to comment
28 minutes ago, Chuck Claunch said:

If you just need to use the device in a docker or VM, you can just pass in the entire usb bus.  No need to have the BT drivers in the main unraid instance.  See my comment above:  

 

 

I've been using bluetooth in a docker for node-red for about six months with no issues.

Thanks Chuck, I will try your method, I didn't realize you didn't need BT drivers in the main unraid image.

 

Just fyi I am trying to enable it in my Plex docker so seems like a similar approach to what you did for node-red might work.

Link to comment
On 12/17/2019 at 9:19 AM, limetech said:

 

...Hence I want to float this idea to you guys in this topic: suppose we rip out BT support from the Unraid kernel and everyone use the @Chuck Claunch method of using BT in a container?  Sure there will be some who don't want to change anything because current config works for them, however moving forward this might be the best overall solution?

I dislike this solution for a few reasons. The primary of which is that passing in the entire BT bus into a Docker container only works if it's running as privileged and on the host network IIRC. In my configuration, I run my containers in VLANs for network isolation, making it such that they can't access the Bluetooth devices. If the BT support were removed from the host OS, I'd then have to create/maintain a Docker container in a higher-permission config just to run a simple Bluetooth script. Feels like overkill to go in that direction to me. 

 

It's nice that there's multiple ways to do it so that if someone runs into a driver issue they need to work around, they can use Docker. But I don't think the host OS support necessitates the frequent/trivial OS updates that seem to be the desired reason to remove the support.  

 

TL;DR - I appreciate and use the native host OS support for bluetooth and would like to keep it.

Link to comment
  • 3 weeks later...
On 12/20/2019 at 6:49 AM, kmwoley said:

I dislike this solution for a few reasons. The primary of which is that passing in the entire BT bus into a Docker container only works if it's running as privileged and on the host network IIRC. In my configuration, I run my containers in VLANs for network isolation, making it such that they can't access the Bluetooth devices. If the BT support were removed from the host OS, I'd then have to create/maintain a Docker container in a higher-permission config just to run a simple Bluetooth script. Feels like overkill to go in that direction to me. 

 

It's nice that there's multiple ways to do it so that if someone runs into a driver issue they need to work around, they can use Docker. But I don't think the host OS support necessitates the frequent/trivial OS updates that seem to be the desired reason to remove the support.  

 

TL;DR - I appreciate and use the native host OS support for bluetooth and would like to keep it.

Can you tell me how you are passing a Bluetooth enabled container without having to run ist in host network? I didn’t accomplished that until now. 

Link to comment
  • 2 weeks later...
On 1/7/2020 at 1:29 PM, limetech said:

Added additional Intel BT firmware to 6.8.1-rc1.  Please give it a try.

Seemed to work, haven't had a chance yet to actually try bluetooth but I think everything got loaded based on what I see in the logs?
 

Thanks for adding them.

 

Mike

 

Jan 19 12:21:39 EMT kernel: Bluetooth: hci0: Found device firmware: intel/ibt-18-16-1.sfi

...

Jan 19 12:21:39 EMT kernel: Bluetooth: hci0: Waiting for firmware download to complete

Jan 19 12:21:39 EMT kernel: Bluetooth: hci0: Firmware loaded in 2723888 usecs

Jan 19 12:21:39 EMT kernel: Bluetooth: hci0: Waiting for device to boot

Jan 19 12:21:39 EMT kernel: Bluetooth: hci0: Device booted in 15546 usecs

Jan 19 12:21:39 EMT kernel: Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-18-16-1.ddc

Jan 19 12:21:39 EMT kernel: Bluetooth: hci0: Applying Intel DDC parameters completed

Link to comment
  • 3 weeks later...

Hi!

 

I have a Parani UD100 bluetooth usb adapter. The dmesg show this message:

 

[   25.245239] Bluetooth: Core ver 2.22
[   25.245839] Bluetooth: HCI device and connection manager initialized
[   25.255238] Bluetooth: HCI socket layer initialized
[   25.255439] Bluetooth: L2CAP socket layer initialized
[   25.255643] Bluetooth: SCO socket layer initialized
[   25.304019] Bluetooth: hci0: unexpected event for opcode 0x0000

 

And hci0 is not grow up. It needs any other driver? I need some help, please.

Link to comment
  • 4 weeks later...

@limetech, so what is the correct way of getting this set up without forwarding the whole bus? It looks like the drivers are there and working, but I am not sure what I need to forward to the Docker container. I am on the latest stable version, 6.8.2.

 

# lsusb
Bus 002 Device 079: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
...

# modinfo btintel
filename:       /lib/modules/4.19.98-Unraid/kernel/drivers/bluetooth/btintel.ko.xz
firmware:       intel/ibt-12-16.ddc
firmware:       intel/ibt-12-16.sfi
firmware:       intel/ibt-11-5.ddc
firmware:       intel/ibt-11-5.sfi
license:        GPL
version:        0.1
description:    Bluetooth support for Intel devices ver 0.1
author:         Marcel Holtmann <[email protected]>
srcversion:     B978516D847A719EA755825
depends:        bluetooth
retpoline:      Y
intree:         Y
name:           btintel
vermagic:       4.19.98-Unraid SMP mod_unload

# hciconfig
-bash: hciconfig: command not found

# find / -iname "hci*" ! -path "/proc/*" ! -path "/var/lib/docker/*"
/sys/class/bluetooth/hci0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0/bluetooth/hci0
/lib/modules/4.19.98-Unraid/kernel/drivers/bluetooth/hci_uart.ko.xz
/lib/modules/4.19.98-Unraid/kernel/drivers/bluetooth/hci_vhci.ko.xz

 

 

Link to comment
  • 2 months later...
On 3/8/2020 at 6:59 PM, angellus said:

@limetech, so what is the correct way of getting this set up without forwarding the whole bus? It looks like the drivers are there and working, but I am not sure what I need to forward to the Docker container. I am on the latest stable version, 6.8.2.

 


# lsusb
Bus 002 Device 079: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
...

# modinfo btintel
filename:       /lib/modules/4.19.98-Unraid/kernel/drivers/bluetooth/btintel.ko.xz
firmware:       intel/ibt-12-16.ddc
firmware:       intel/ibt-12-16.sfi
firmware:       intel/ibt-11-5.ddc
firmware:       intel/ibt-11-5.sfi
license:        GPL
version:        0.1
description:    Bluetooth support for Intel devices ver 0.1
author:         Marcel Holtmann <[email protected]>
srcversion:     B978516D847A719EA755825
depends:        bluetooth
retpoline:      Y
intree:         Y
name:           btintel
vermagic:       4.19.98-Unraid SMP mod_unload

# hciconfig
-bash: hciconfig: command not found

# find / -iname "hci*" ! -path "/proc/*" ! -path "/var/lib/docker/*"
/sys/class/bluetooth/hci0
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0/bluetooth/hci0
/lib/modules/4.19.98-Unraid/kernel/drivers/bluetooth/hci_uart.ko.xz
/lib/modules/4.19.98-Unraid/kernel/drivers/bluetooth/hci_vhci.ko.xz

 

 

@limetech I would also like to know this.

Link to comment

I have a CSR Bluetooth dongle (Cambridge Silicon Radio Bluetooth Dongle) that I want to pass trough to a Home Assistant VM, I can select it in the VM config but hassos does not find the device there,
Is that because firmware for CSR BT dongles are missing?

Link to comment
  • 3 months later...
On 5/29/2020 at 12:24 AM, dedi said:

I have a CSR Bluetooth dongle (Cambridge Silicon Radio Bluetooth Dongle) that I want to pass trough to a Home Assistant VM, I can select it in the VM config but hassos does not find the device there,
Is that because firmware for CSR BT dongles are missing?

 

I have the same problem. Have you found a solution? I was reading about fake CSR and that it was necessary to recompile the Linux source code module. I can't give an UP on hci0 and it just stays on DOWN with the error Can't init device hci0: Operation not supported (95)

Link to comment
  • 2 weeks later...

I have a TP-Link UB400 which has this chipset and which I am trying to pass through to a VM. dmesg reports:

 

[  168.179282] usb 1-6.4: new full-speed USB device number 6 using xhci_hcd
[  168.245355] usb 1-6.4: device descriptor read/64, error -32
[  168.420556] usb 1-6.4: device descriptor read/64, error -32
[  168.594490] usb 1-6.4: new full-speed USB device number 7 using xhci_hcd
[  168.770460] Bluetooth: hci0: unexpected event for opcode 0x0000

 

When I select to pass it through to my VM and click to save, Unraid hangs on the saving and no changes are made.

 

I'm trying also to pass through the USB bus as a whole but having similar freezing issues so if I can pass this directly, it might be an easier option.

 

Is there anyway to force pass this through to the VM?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.