operating-system icon indicating copy to clipboard operation
operating-system copied to clipboard

HAOS Support for Bluetooth using integrated AX201 on Intel NUC

Open tommyjlong opened this issue 2 years ago • 29 comments
trafficstars

Describe the issue you are experiencing

This is a split off from This Issue NUC: NUC11TNHi5 (i5Gen11) with AX201=>WiFi6/BT5 (Not to be confused with an AX210).

QEMU/KVM x86_64 running HA 2023.6.3, Supervisor 2023.06.2, Operating System 10.3 (uname -r => 6.1.34)

[Ubuntu 22.04 Host] $lsusb =>Bus 003 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth

[HAOS as Guest]: #lsusb => Bus 001 Device 006: ID 8087:0026 #dmesg:

[    0.421912] Bluetooth: Core ver 2.22
[    0.422216] NET: Registered PF_BLUETOOTH protocol family
[    0.422502] Bluetooth: HCI device and connection manager initialized
[    0.422848] Bluetooth: HCI socket layer initialized
[    0.423213] Bluetooth: L2CAP socket layer initialized
[    0.423485] Bluetooth: SCO socket layer initialized
[    2.840236] usb 1-6: New USB device found, idVendor=8087, idProduct=0026, bcdDevice= 0.02
[    2.841196] usb 1-6: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.951226] usbcore: registered new interface driver btusb
[    5.015097] Bluetooth: hci0: command 0xfc05 tx timeout
[    5.015097] Bluetooth: hci0: Reading Intel version command failed (-110)

BTW, this is my first attempt at passing the NUC's integrated bluetooth to HA Guest, so can't tell if it worked on other HA kernel versions or not.

This does work on the NUC's Ubuntu Host (when not passing to the VM). Ubuntu uname -r =>5.19.0-43-generic

FYI, there is also a dependency difference on the btusb module between Host and HAOS as Guest: [Ubuntu 22.04 Host ]

$modinfo btusb: 
....
depends:        bluetooth,btintel,btmtk,btbcm,btrtl

[HAOS as Guest ]

# modinfo btusb
...
depends:        btintel,btrtl,btbcm

What operating system image do you use?

ova (for Virtual Machines)

What version of Home Assistant Operating System is installed?

10.3

Did you upgrade the Operating System.

Yes

Steps to reproduce the issue

  1. modprobe -r btusb
  2. modprobe btusb
  3. look at dmesg log [362215.081098] usbcore: deregistering interface driver btusb [362218.357222] usbcore: registered new interface driver btusb [362220.416390] Bluetooth: hci0: command 0xfc05 tx timeout [362220.416397] Bluetooth: hci0: Reading Intel version command failed (-110)

Anything in the Supervisor logs that might be useful for us?

No

Anything in the Host logs that might be useful for us?

No

System information

No response

Additional information

This could just be a kernel bug that no one has really fixed yet.

tommyjlong avatar Jun 24 '23 21:06 tommyjlong

Same adapter, does not work.

[    1.640322] Bluetooth: hci0: Device revision is 2
[    1.640325] Bluetooth: hci0: Secure boot is enabled
[    1.640326] Bluetooth: hci0: OTP lock is enabled
[    1.640327] Bluetooth: hci0: API lock is enabled
[    1.640328] Bluetooth: hci0: Debug lock is disabled
[    1.640329] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
[    1.640330] Bluetooth: hci0: Bootloader timestamp 2019.40 buildtype 1 build 38
[    1.640596] Bluetooth: hci0: Failed to load Intel firmware file intel/ibt-0040-1050.sfi (-2)

axute avatar Jun 30 '23 21:06 axute

@axute can you describe your HA installation? I'm wondering if you have full blown HA/HAOS installed on baremetal NUC. You setup seems to have progressed further than mine.

tommyjlong avatar Jul 01 '23 16:07 tommyjlong

Hello, that's right, I have a "Trigkey Green G5". This is an Intel N100 with 16GB DDR5 and 512 NVMe, 2 NICs and there are a lot of bios settings regarding wifi and bluetooth. WiFi is not recognized either...

About the installation: Home Assistant 2023.6.3 Maintainer 2023.06.4 Operating system 10.3 Frontend 20230608.0 - current

What exactly do you need in the way of details?

axute avatar Jul 02 '23 10:07 axute

@axute Here is a link that may be the problem you are seeing. In the link, the users have an AX101 device that is being detected as an AX201. Googling around a little bit I think maybe you actually have an AX101 chip. Apparently the upstream linux kernel is just now (ver 6.4) supporting the AX101 properly (HAOS 10.3 uses version 6.1.34), but still hasn't caught up to have the missing file your log says it needs. I think the kernel will eventually have a version that will work for you, just may have to wait a while.

Since your system is running bare metal HAOS and your bluetooth initialization setup makes more progress than mine, I have a feeling that my QEMU/KVM system simply can not deal with the AX201 properly as bluetooth USB device.

tommyjlong avatar Jul 02 '23 15:07 tommyjlong

I have ths same device id, why should it be another chip?

axute avatar Jul 02 '23 19:07 axute

Very good question. I am mostly going by the link I referenced above where the originating poster says he has an AX101 but he says the BT driver is claiming its AX201. I could not actually find any spec on your Trigkey Green that says what it has.

I can use my imagination to come up with a way that this could happen but I may be entirely incorrect about the following: As I understand it, any AXx01 device is not a full blown WiFI/BT-USB combo device. These x01 devices are just RF radio modulator/demodulator that converts the analog RF to digital baseband and sends it over some Intel proprietary interface, and some other Intel internal processor core does the actual WiFi and Bluetooth baseband and MAC layer processing. This processor core requires firmware usually with filename iwlwifi-blah-blah. This firmware is essentially performing as a software WiFI/BT chip and would be presenting the "system" side as a PCIe device, and USB Device according to the firmware. So I could see where the firmware for an AX101 presents the USB device with whatever device id it wanted to (since its soft) and it could present it with the same device id used with the AX201.

tommyjlong avatar Jul 04 '23 21:07 tommyjlong

But it doesn't play a role for me at the moment, I agree with you, there are so many settings in the bios that your idea would fit. But that still brings me to the conclusion that there is a kernel module that works. https://linux-hardware.org/?id=usb:8087-0026&page=1#status Just not for home assistants.

axute avatar Jul 05 '23 11:07 axute

https://askubuntu.com/questions/1459856/intel-alder-lake-n100-wifi-and-bluetooth-issues# suggests using a different firmware file and it report success.

I have copied the file to /lib/firmware/intel/ibt-0040-1050.sfi but that directory seems to be wiped out on reboot.

https://www.cnx-software.com/2023/07/07/fixing-wifi-6-on-linux-in-alder-lake-n-mini-pcs-intel-n95-n100-core-i3-n300/ has some info as well. Does this require an updated kernel?

0x8000-0000 avatar Aug 03 '23 13:08 0x8000-0000

I have the same issue. So, at the moment there is no solution?

zephirus avatar Sep 16 '23 22:09 zephirus

same issue for me ax101 supported in newer linux kernel

paulvylie avatar Sep 20 '23 21:09 paulvylie

If I understand correctly, this is solved in a newer linux kernel that HAOS is not using? Am I correct?

zephirus avatar Sep 20 '23 22:09 zephirus

If I understand correctly, this is solved in a newer linux kernel that HAOS is not using? Am I correct?

yes, correct

paulvylie avatar Sep 20 '23 22:09 paulvylie

Is there any clue of when HAOS will update its kernel? At the moment I'm thinking about buying a usb bluetooth adapter.

zephirus avatar Sep 20 '23 22:09 zephirus

no idea wasn't able to find any roadmap

paulvylie avatar Sep 20 '23 22:09 paulvylie

update debian with 6.5 kernel and ha supervised still not working

paulvylie avatar Sep 24 '23 01:09 paulvylie

suggesting an alternative, just change to a supported wifi card. it is not that much more expensive than a decent usb bluetooth dongle.

thewan056 avatar Oct 04 '23 20:10 thewan056

HAOS follows LTS kernels.

They usually only get released once a year and than HAOS updates a while after that.

Your best bet is an esphome proxy https://esphome.io/projects/index.html

bdraco avatar Oct 19 '23 17:10 bdraco

There hasn't been any activity on this issue recently. To keep our backlog manageable we have to clean old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant OS version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 18 '24 05:01 github-actions[bot]

This isn't resolved yt

lantech69420 avatar Jan 21 '24 14:01 lantech69420

No resolution for me either, having the same problem still. Beelink SER5 PRO 5800H with a Intel Corp. AX200 Bluetooth module, and Home Assistant won't recognize it.

doctorgaul avatar Feb 14 '24 02:02 doctorgaul

@doctorgaul @lantech69420 There are multiple different issues mixed up in this thread. Can you at least share dmesg output from your system? On current stable release (HAOS 11.5) Bluetooth for all cards mentioned in this thread (AX101, AX200 and AX201) should work, the upcoming 12.0 release will include also drivers for AX101 WiFi, which had support only for Bluetooth in 6.1 kernel (BT firmware for AX101 was added in 11.5, so some comments are not relevant anymore).

sairon avatar Feb 14 '24 15:02 sairon

@tommyjlong I'm not sure if your problem has been resolved or not, but judging from these lines:

[    5.015097] Bluetooth: hci0: command 0xfc05 tx timeout
[    5.015097] Bluetooth: hci0: Reading Intel version command failed (-110)

there are likely two options. Either there is some hardware fault, or the host system (or another VM) tries to access the USB interface of the Bluetooth card at the same time. To make sure it is not the case, you must not use it for other VM and disable the Bluetooth stack (e.g. by blacklisting bluetooth modules, or using udev rules) on the host OS.

sairon avatar Feb 14 '24 15:02 sairon

@sairon I apologize in advance for not being the most technical user, but I believe these sections of the dmesg output are what you need? Let me know if there's anything other information I can provide. Really appreciate your help!!

bluetooth 1

bluetooth 2

doctorgaul avatar Feb 14 '24 16:02 doctorgaul

In the latest HAOS, my bluetooth started working on my Beelink Mini S12 Pro.

lantech69420 avatar Feb 14 '24 16:02 lantech69420

@lantech69420 I see, then in your case I guess it was either a different card (AX101 likely?) or the firmware upgrade helped.

@doctorgaul No worries, you got it right :+1: From the screenshots I can see there is indeed something wrong with the initialization of the card, more details could be in the part that is not on the screenshots (starting with the cut here line, which should end with end trace delimiter). This points either to a problem in the Linux kernel driver, or there is some hardware problem in the card itself. Probably the easiest way to check that would be to try running a different OS (like a bootable stick with Ubuntu for example) and check kernel logs there. Another option is to try the current dev build of HAOS, or wait for 12.0 release, which updates Linux kernel to 6.6.

sairon avatar Feb 14 '24 17:02 sairon

Thanks @sairon ! Here's the next portion of the dmesg output. Let me know if there's anything else I can do here!

bluetooth 3

doctorgaul avatar Feb 14 '24 18:02 doctorgaul

@tommyjlong I'm not sure if your problem has been resolved or not, but judging from these lines:

[    5.015097] Bluetooth: hci0: command 0xfc05 tx timeout
[    5.015097] Bluetooth: hci0: Reading Intel version command failed (-110)

there are likely two options. Either there is some hardware fault, or the host system (or another VM) tries to access the USB interface of the Bluetooth card at the same time. To make sure it is not the case, you must not use it for other VM and disable the Bluetooth stack (e.g. by blacklisting bluetooth modules, or using udev rules) on the host OS.

Yeah I'm still seeing the same problem. I'll play with it some more. My suspicion is that the AX201 can't really be split into WiFi and USB cleanly, thus doing a USB passthrough to the VM while leaving WiFi on the host doesn't really work.

What kind of udev rules and actions do you have in mind?

tommyjlong avatar Feb 14 '24 18:02 tommyjlong

It was suggested above that I blacklist Bluetooth on the Host.
For these set of tests, I instead disabled the btusb kernel module as Bluetooth depends on it.

So here are my findings (not necessarily repeatable):

  1. Release the AX201 USB from Guest HAOS and see what happens on the Host. Host dmesg
[527974.436925] usb 3-10: USB disconnect, device number 21
[527974.894566] usb 3-10: new full-speed USB device number 22 using xhci_hcd
[527975.048281] usb 3-10: New USB device found, idVendor=8087, idProduct=0026, bcdDevice= 0.02
[527975.048291] usb 3-10: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[527975.070742] usbcore: registered new interface driver btusb
[527975.071974] Bluetooth: hci0: Bootloader revision 0.4 build 0 week 30 2018
[527975.072983] Bluetooth: hci0: Device revision is 2
[527975.072987] Bluetooth: hci0: Secure boot is enabled
[527975.072988] Bluetooth: hci0: OTP lock is enabled
[527975.072989] Bluetooth: hci0: API lock is enabled
[527975.072990] Bluetooth: hci0: Debug lock is disabled
[527975.072991] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
[527975.077730] Bluetooth: hci0: Found device firmware: intel/ibt-19-0-4.sfi
[527975.077800] Bluetooth: hci0: Boot Address: 0x24800
[527975.077802] Bluetooth: hci0: Firmware Version: 206-22.23
[527976.947664] Bluetooth: hci0: Waiting for firmware download to complete
[527976.947913] Bluetooth: hci0: Firmware loaded in 1826331 usecs
[527976.947966] Bluetooth: hci0: Waiting for device to boot
[527976.962960] Bluetooth: hci0: Device booted in 14673 usecs
[527976.962973] Bluetooth: hci0: Malformed MSFT vendor event: 0x02
[527976.963047] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-19-0-4.ddc
[527976.964929] Bluetooth: hci0: Applying Intel DDC parameters completed
[527976.965999] Bluetooth: hci0: Firmware revision 0.4 build 206 week 22 2023
[527976.968079] Bluetooth: hci0: HCI LE Coded PHY feature bit is set, but its usage is not supported.
[527977.033114] Bluetooth: MGMT ver 1.22
  1. Turn off btusb on the host
$lsmod | grep bt
btusb                  73728  0
btrtl                  32768  1 btusb
btbcm                  24576  1 btusb
btintel                53248  1 btusb
btmtk                  12288  1 btusb
bluetooth            1073152  34 btrtl,btmtk,btintel,btbcm,bnep,btusb,rfcomm

$ sudo modprobe  -v -r btusb
rmmod btusb
rmmod btmtk
rmmod btintel
rmmod btbcm
rmmod btrtl

$ lsmod | grep bt

  1. Reattach AX201 USB to Guest HAOS Guest dmesg Sometimes I get this:
[528604.693180] usb 1-6: USB disconnect, device number 16
[528648.915325] usb 1-6: new full-speed USB device number 17 using xhci_hcd
[528649.045603] usb 1-6: New USB device found, idVendor=8087, idProduct=0026, bcdDevice= 0.02
[528649.045614] usb 1-6: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[528649.061083] Bluetooth: hci0: Found device firmware: intel/ibt-19-0-4.sfi
[528649.061131] Bluetooth: hci0: Boot Address: 0x24800
[528649.061133] Bluetooth: hci0: Firmware Version: 249-27.23
[528649.074175] usb 1-6: USB disconnect, device number 17
[528649.074340] Bluetooth: hci0: FW download error recovery failed (-19)

Other times I get this (but not both):

[528493.705060] usb 1-6: new full-speed USB device number 16 using xhci_hcd
[528493.834399] usb 1-6: New USB device found, idVendor=8087, idProduct=0026, bcdDevice= 0.02
[528493.834408] usb 1-6: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[528495.873995] Bluetooth: hci0: command 0xfc05 tx timeout
[528495.874550] Bluetooth: hci0: Reading Intel version command failed (-110)

I'll still continue to play around with this.

tommyjlong avatar Feb 24 '24 20:02 tommyjlong

I have the same issue as @tommyjlong. I'm also running a Beelink SER5 MAX. My BT is an Intel Corp. AX200. I'm running ubuntu 22, with HAOS running in a guest VM through qemu. I get the same messages:

Bluetooth: hci0: command 0xfc05 tx timeout
Bluetooth: hci0: Reading Intel version command failed (-110)

This did work a few months ago, but stopped at some point, and than randomly did on one reboot, but has been failing consistently for a bit now.

Pilchie avatar Mar 13 '24 18:03 Pilchie

I now have the AX201 working w. HAOS (as a pass-through to a HA VM using Libvirt/QEMU/KVM), so I'm going to close this.
If anyone else is still having problems, then feel free to open up a new issue.

HA Operating System 12.2


I'm not sure what HAOS release actually starting supporting the AX201, but afterwards, it turned out that my issue was more about passing through the AX201 to the HA VM, here is a bit of a write-up on what I did. I'm doing this somewhat from memory, so I may have missed a thing or two or even added one or two things too many, but should be reasonably close.

This is for an Intel NUC running Ubuntu 22.04 as the Host.

The AX201 on Intel NUC presents itself to Linux as

  • PCI Network Controller for WiFi device
  • PCI USB Controller and with it as a USB device

I passed through the AX201 PCI controller for WiFi, but I only passed-through the AX201 USB device instead of the whole PCI USB controller.

I. Pass through the AX201 PCI WiFi device 1a) Assign vfio-pci driver to AX201 PCI device (using Grub)

  • Find the PCI BDF address of the AX201 On the Host: $ lspci .... 00:14.3 Network controller: Intel Corporation Wi-Fi 6 AX201 (rev 20) ...
  • Get vendor-id:device-id info on the AX201 WiFI PCI device
    $ lspci -vnn -s 0000:14.3 00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201 [8086:a0f0] (rev 20) DeviceName: Onboard - Ethernet Subsystem: Intel Corporation Wi-Fi 6 AX201 [8086:0074]
  • Configure Grub to assign vfio-pci driver to this PCI device Add a line in /etc/default/grub GRUB_CMDLINE_LINUX="iommu=pt intel_iommu=on vfio-pci.ids=8086:a0f0" and update grub using: $sudo update-grub
  • Reboot the host to pick up the changes.

1b) Alternative way to assign vfio-pci driver to AX201 PCI device (using modprob) As this should be an alternative to 1a), I actually did both 1a) and 1b). At least the iommu config in 1a) should still be done.

  • Get PCI device alias $ cat /sys/bus/pci/devices/0000\:00\:14.3/modalias pci:v00008086d0000A0F0sv00008086sd00000074bc02sc80i00

  • create a new file in /etc/modprobe.d/vfio.conf and add these 2 lines: alias pci:v00008086d0000A0F0sv00008086sd00000074bc02sc80i00 vfio-pci options vfio-pci ids=8086:a0f0

    Note: both these lines are probably not needed, but I used both anyway. Note: you could blacklist items in this file, but I didn't. Although probably not necessary, you can update initramfs to be safe: $ sudo update-initramfs -u -k all

  • Reboot the host to pick up the changes.

  1. Add the AX201 PCI WiFi device to the VM. You can use your favorite method to configure your QEMU/KVM HAOS VM to pick up the AX201 PCI WiFi device. I use Virt-Manager: Select the HA VM then "Add Hardware" ->"PCI Host Device" then Select the AX201

II. Pass through the AX201 USB Bluetooth device

  1. Black list the host's bluetooth kernel modules What I found out was that when libvirt adds the Bluetooth USB device to the VM, Libvirt first attempts to remove the host's control of the Bluetooth controller using rfkill, but this didn't work well enough, so blacklisting is about the only way I could get the host to completely relinquish control. $lsmod | grep bluetooth bluetooth 1081344 15 btrtl,btmtk,btintel,btbcm,bnep,btusb,rfcomm
  • create a new file /etc/modprobe.d/blacklist-bluetooth.conf and add a line for each module listed in the previous step: blacklist bluetooth blacklist btrtl blacklist btmtk etc. etc, Although probably not necessary, you can update initramfs to be safe: $ sudo update-initramfs -u -k all
  • Reboot the Host to pick up the changes.
  1. Add the AX201 Bluetooth device to the VM
  • Find the vendor-id:device-id $lsusb ... Bus 003 Device 006: ID 8087:0026 Intel Corp. AX201 Bluetooth
  • Add the AX201 USB device to the VM. You can use your favorite method to configure your QEMU/KVM HAOS VM to pick up the AX201 USB device. I use Virt-Manager: Select the HA VM then "Add Hardware" ->"USB Host Device" then Select the AX201

dmesg output within HAOS now that Bluetooth is working I have left out the WiFi part

[    4.028795] Bluetooth: Core ver 2.22
[    4.028812] NET: Registered PF_BLUETOOTH protocol family
[    4.028813] Bluetooth: HCI device and connection manager initialized
[    4.028816] Bluetooth: HCI socket layer initialized
[    4.028817] Bluetooth: L2CAP socket layer initialized
[    4.028819] Bluetooth: SCO socket layer initialized
[    4.032482] usbcore: registered new interface driver btusb
[    4.033947] Bluetooth: hci0: Bootloader revision 0.4 build 0 week 30 2018
[    4.034940] Bluetooth: hci0: Device revision is 2
[    4.034941] Bluetooth: hci0: Secure boot is enabled
[    4.034942] Bluetooth: hci0: OTP lock is enabled
[    4.034942] Bluetooth: hci0: API lock is enabled
[    4.034943] Bluetooth: hci0: Debug lock is disabled
[    4.034943] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
[    4.038862] Bluetooth: hci0: Found device firmware: intel/ibt-19-0-4.sfi
[    4.038882] Bluetooth: hci0: Boot Address: 0x24800
[    4.038883] Bluetooth: hci0: Firmware Version: 249-27.23
[    4.130892] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    4.130895] Bluetooth: BNEP filters: protocol multicast
[    4.130898] Bluetooth: BNEP socket layer initialized
[    6.077227] Bluetooth: hci0: Waiting for firmware download to complete
[    6.077983] Bluetooth: hci0: Firmware loaded in 1991326 usecs
[    6.078045] Bluetooth: hci0: Waiting for device to boot
[    6.093341] Bluetooth: hci0: Device booted in 14981 usecs
[    6.096907] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-19-0-4.ddc
[    6.099093] Bluetooth: hci0: Applying Intel DDC parameters completed
[    6.100205] Bluetooth: hci0: Firmware revision 0.4 build 249 week 27 2023
[    6.102122] Bluetooth: hci0: HCI LE Coded PHY feature bit is set, but its usage is not supported.
[    6.171430] Bluetooth: MGMT ver 1.22
[   13.366386] Bluetooth: RFCOMM TTY layer initialized
[   13.366392] Bluetooth: RFCOMM socket layer initialized
[   13.366395] Bluetooth: RFCOMM ver 1.11

tommyjlong avatar Apr 28 '24 01:04 tommyjlong