When trying to start the bluetooth stack on a Thinkpad t480s with the Intel Dual Band Wireless-AC 8265: 2x2 Wi-Fi 802.11ac with MU-MIMO, Bluetooth 4.1 module. ubt0 on uhub0 ubt0: <vendor 0x8087 product 0x0a2b, class 224/1, rev 2.00/0.10, addr 4> on usbus0 ubt0: ubt_ctrl_write_callback:782: control transfer failed: USB_ERR_TIMEOUT ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command OGF=0x3, OCF=0x3. Timeout
To provide a bit more infomation. FreeBSD 12.0-STABLE r346077 GENERIC usbconfig ugen0.5 dump_device_desc output: ugen0.5: <vendor 0x8087 product 0x0a2b> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0200 bDeviceClass = 0x00e0 <Wireless controller> bDeviceSubClass = 0x0001 bDeviceProtocol = 0x0001 bMaxPacketSize0 = 0x0040 idVendor = 0x8087 idProduct = 0x0a2b bcdDevice = 0x0010 iManufacturer = 0x0000 <no string> iProduct = 0x0000 <no string> iSerialNumber = 0x0000 <no string> bNumConfigurations = 0x0001
I can possibly go and have a look on Tuesday though I have never done BT on FreeBSD I have to admit. Is there a good list of things to run to reproduce this, or is it just loading the kernel module?
Just loading the kernel module will produce the error. And `service bluetooth start ubt0` will provide the same error.
Ok, confirmed; I'll go and have a look if no one else beats me to it (in which case please take the PR from me again). Autoloading module: ng_ubt.ko ubt0 on uhub1 ubt0: <vendor 0x8087 product 0x0a2b, class 224/1, rev 2.00/0.10, addr 3> on usbus0 Autoloading module: ng_ubt.ko Autoloading module: ng_ubt.ko Autoloading module: ng_ubt.ko ubt0: ubt_ctrl_write_callback:782: control transfer failed: USB_ERR_TIMEOUT ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command OGF=0x3, OCF=0x3. Timeout /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0 # usbconfig -d 0.4 dump_device_desc ugen0.4: <vendor 0x8087 product 0x0a2b> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0200 bDeviceClass = 0x00e0 <Wireless controller> bDeviceSubClass = 0x0001 bDeviceProtocol = 0x0001 bMaxPacketSize0 = 0x0040 idVendor = 0x8087 idProduct = 0x0a2b bcdDevice = 0x0010 iManufacturer = 0x0000 <no string> iProduct = 0x0000 <no string> iSerialNumber = 0x0000 <no string> bNumConfigurations = 0x0001
It seems the device needs a bit of extra driver to handle separate firmware. Reset the bug to bugs@ as I am not sure if bluetooth people watch on wireless. Some support from Intel on docs or a Dual/BSD Licensed source would help a lot here.
> ubt0: <vendor 0x8087 product 0x0a2b, class 224/1, rev 2.00/0.10, addr 4> This device requires firmware downloader to work. I use this one: https://github.com/wulf7/iwmbt-firmware Note: Execution of /etc/rc.d/bluetooth locks up bluetooth adapter hardly if firmware has not been downloaded yet and full power cycle is required to restore its state. That means that downloader *must* always be run before first /etc/rc.d/bluetooth script execution.
Created attachment 204303 [details] block ng_ubt attachment if operational firmware is not downloaded yet Safety belt to reduce chances of BT adapter lockup. Not strictly necessary to download the firmware.
(In reply to Vladimir Kondratyev from comment #7) Hi Vladimir, I tried your code on Asus Zenbook 14 UX410UFR. After 'make install' and reboot: ubt0 on uhub0 ubt0: <vendor 0x8087 product 0x0a2b, class 224/1, rev 2.00/0.10, addr 2> on usbus0 wlan0: Ethernet address: 50:76:af:0c:7e:f7 WARNING: attempt to domain_add(bluetooth) after domainfinalize() WARNING: attempt to domain_add(netgraph) after domainfinalize() wlan0: link state changed to UP iwm0: frame 2/75 b800002c UNHANDLED (this should not happen) Security policy loaded: MAC/ntpd (mac_ntpd) [root@pers:/root]# iwmbtfw USB Path: 08 Firmware downloading failed And there is no ubt0 device. Am I missing something obvious?
(In reply to Nikola Lečić from comment #8) > Am I missing something obvious? It is tricky to run downloader ATM due to bug in ng_ubt.c (it unconditionally starts SCO transfer that kills an BT adaptor) Please try: 1. Comment out following lines in /etc/devd.conf: # When a USB Bluetooth dongle appears, activate it attach 100 { device-name "ubt[0-9]+"; action "service bluetooth quietstart $device-name"; }; 2. Do a full power off/on cycle. Just reboot is not enough to restore BT-adaptor!!! 3. # iwmbtfw 4. # service bluetooth start ubt0
(In reply to Vladimir Kondratyev from comment #9) Thanks; this is what I got: # iwmbtfw USB Path: 08 ubt0: at uhub0, port 8, addr 2 (disconnected) ubt0: detached Done 0 iwm0: frame 3/47 b800002c UNHANDLED (this should not happen) ubt0 on uhub0 ubt0: <vendor 0x8087 product 0x0a2b, class 244/1, rev 2.00/0.10, addr2> on usbus0 iwm0: frame 3/47 b800002c UNHANDLED (this should not happen) # service bluetooth start ubt0 iwm0: frame 3/47 b800002c UNHANDLED (this should not happen) Only (unrelated) iwm0 message; nothing else happens, no /dev/ubt0.
(In reply to Nikola Lečić from comment #10) ng_ubt is netgraph device, so no /dev/ubt0 should appear Properly initialized bt device looks like: # ngctl list There are 9 total nodes: Name: ubt0 Type: ubt ID: 00000001 Num hooks: 1 Name: btsock_hci_raw Type: btsock_hci_raw ID: 00000002 Num hooks: 1 Name: btsock_l2c_raw Type: btsock_l2c_raw ID: 00000003 Num hooks: 1 Name: btsock_l2c Type: btsock_l2c ID: 00000004 Num hooks: 1 Name: btsock_sco Type: btsock_sco ID: 00000005 Num hooks: 0 Name: ubt0hci Type: hci ID: 00000007 Num hooks: 3 Name: ubt0l2cap Type: l2cap ID: 0000000b Num hooks: 3 Name: wlan0 Type: ether ID: 00000011 Num hooks: 0 Name: ngctl11859 Type: socket ID: 00000012 Num hooks: 0
(In reply to Vladimir Kondratyev from comment #11) Ah, I see. In my case: ngctl list There are 8 total nodes: Name: ubt0l2cap Type: l2cap ID: 00000021 Num hooks: 3 Name: btsock_hci_raw Type: btsock_hci_raw ID: 00000005 Num hooks: 1 Name: btsock_l2c_raw Type: btsock_l2c_raw ID: 00000006 Num hooks: 1 Name: ngctl1468 Type: socket ID: 00000027 Num hooks: 0 Name: btsock_l2c Type: btsock_l2c ID: 00000007 Num hooks: 1 Name: btsock_sco Type: btsock_sco ID: 00000008 Num hooks: 0 Name: ubt0 Type: ubt ID: 0000001b Num hooks: 1 Name: ubt0hci Type: hci ID: 0000001d Num hooks: 3 Looks good?
(In reply to Nikola Lečić from comment #12) > Looks good? It looks initialized. So try # hccontrol Inquiry and so on to start. bluetooth-config is worth a try too but it never works for me :-(
(In reply to Vladimir Kondratyev from comment #13) Great, mouse paired, works as expected. After reboot and manual starting bluetooth, everything works again. Владимир, спасибо огромное за код и за помощь. Всего доброго от московского соседа. :)
Created attachment 205385 [details] firmware downloader - kernel part (blocks ng_ubt attachment if firmware is not in operational state)
Created attachment 205386 [details] firmware downloader - userland part. downloader itself
Created attachment 205387 [details] firmware downloader - ports part. firmwares
Created attachment 205388 [details] firmware downloader - ports part. firmwares
BSD-licensed port of btintel driver is uploaded above. All 3 parts should be installed to work properly. Kernel & userland patches are to be applied to src tree. Ports patch - to ports tree.
Works for me on 12-STABLE and: iwm0@pci0:2:0:0: class=0x028000 card=0x10108086 chip=0x24fd8086 rev=0x78 hdr=0x00 vendor = 'Intel Corporation' device = 'Wireless 8265 / 8275' This is good, thanks! What needs to be done to get it committed?
(In reply to amvandemore from comment #20) > Works for me on 12-STABLE and: > iwm0@pci0:2:0:0: class=0x028000 card=0x10108086 chip=0x24fd8086 rev=0x78 > hdr=0x00 > vendor = 'Intel Corporation' > device = 'Wireless 8265 / 8275' Intel Wireless 8265 is a dual BT/WiFi combo. Lines above are related to WiFi part of it. To check BT part you should successfully execute any bluetooth command like `hccontrol Inquiry` or just make your BT device working. > What needs to be done to get it committed? It was delayed slightly due to one (hopefully, fixed) minor bug and parallel work on packaging of the bluetooth utilities and now is on the way to be committed: https://reviews.freebsd.org/D21071
@Vladimir Does the port pass QA (portlint, poudriere) ? Other than that, one minor improvement: - Add pkg-descr: WWW: https://packages.debian.org/firmware-iwlwifi (in addition to but prior to the existing WWW: URL) as this is the source of the firmware
Created attachment 206565 [details] firmware downloader - ports part. firmwares WWW: https://packages.debian.org/firmware-iwlwifi added prior to the existing WWW: URL in pkg-descr file. Port version bumped up to 20190717
Created attachment 206566 [details] poudriere log of ports part
(In reply to Kubilay Kocak from comment #22) > @Vladimir Does the port pass QA (portlint, poudriere) ? Poudriere log is attached. portlint output: $ portlint -ACN WARN: Makefile: using hyphen in PORTNAME. consider using PKGNAMEPREFIX and/or PKGNAMESUFFIX. WARN: Consider to set DEVELOPER=yes in /etc/make.conf 0 fatal errors and 2 warnings found. So I think it passes QA
Comment on attachment 206565 [details] firmware downloader - ports part. firmwares PR: 237083 Reviewed by: koobs (ports) Approved by: koobs (ports)
Just a question - we have firmwares for iwm(4) in the base system, why it is impossible to have firmware for bt part in the base system too?
(In reply to Andrey V. Elsukov from comment #27) I am not a copyright lawyer and I don't know all the steps required to include firmwares into the base system legally. That is why I decided to ship them separately. I wouldn't object if someone would go this way and would take required permissions.
A commit references this bug: Author: wulf Date: Sun Aug 18 22:05:39 UTC 2019 New revision: 509242 URL: https://svnweb.freebsd.org/changeset/ports/509242 Log: New port: comms/iwmbt-firmware Firmware for the Intel Wireless 8260/8265 chip based Bluetooth USB devices. To be downloaded with iwmbtfw(8). WWW: https://packages.debian.org/firmware-iwlwifi WWW: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git PR: 237083 Reviewed by: koobs Approved by: koobs Changes: head/comms/Makefile head/comms/iwmbt-firmware/ head/comms/iwmbt-firmware/Makefile head/comms/iwmbt-firmware/distinfo head/comms/iwmbt-firmware/pkg-descr head/comms/iwmbt-firmware/pkg-plist
A commit references this bug: Author: wulf Date: Sun Aug 18 22:11:43 UTC 2019 New revision: 351196 URL: https://svnweb.freebsd.org/changeset/base/351196 Log: ng_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode. Add helper function for synchronous execution of HCI commands at probe stage and use this function to check firmware state of Intel Wireless 8260/8265 bluetooth devices found in many post 2016 year laptops. Attempt to initialize FreeBSD bluetooth stack while such a device is in bootloader mode locks the adapter hardly so it requires power on/off cycle to restore. This change blocks ng_ubt attachment unless operational firmware is loaded thus preventing the lock up. PR: 237083 Reviewed by: hps, emax MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21071 Changes: head/sys/conf/files head/sys/modules/netgraph/bluetooth/ubt/Makefile head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h
A commit references this bug: Author: wulf Date: Sun Aug 18 22:20:31 UTC 2019 New revision: 351197 URL: https://svnweb.freebsd.org/changeset/base/351197 Log: iwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices Currently supported models are: 8260, 8265, 9560, 9260 and 22161. Firmware files can be installed with comms/iwmbt-firmware port. PR: 237083 Reviewed by: hps, emax X-MFC with: r351196 Differential Revision: https://reviews.freebsd.org/D21071 Changes: head/targets/pseudo/userland/Makefile.depend head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/bluetooth/Makefile head/usr.sbin/bluetooth/iwmbtfw/ head/usr.sbin/bluetooth/iwmbtfw/Makefile head/usr.sbin/bluetooth/iwmbtfw/iwmbt_dbg.h head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.h head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf head/usr.sbin/bluetooth/iwmbtfw/main.c
A commit references this bug: Author: wulf Date: Mon Sep 9 18:50:39 UTC 2019 New revision: 352101 URL: https://svnweb.freebsd.org/changeset/base/352101 Log: MFC r351196, r351324, r351326: ng_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode. Add helper function for synchronous execution of HCI commands at probe stage and use this function to check firmware state of Intel Wireless 8260/8265 bluetooth devices found in many post 2016 year laptops. Attempt to initialize FreeBSD bluetooth stack while such a device is in bootloader mode locks the adapter hardly so it requires power on/off cycle to restore. This change blocks ng_ubt attachment unless operational firmware is loaded thus preventing the lock up. PR: 237083 Reviewed by: hps, emax MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21071 Changes: _U stable/12/ stable/12/sys/conf/files stable/12/sys/modules/netgraph/bluetooth/ubt/Makefile stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h
Since core@ was added to CC: please provide more information if you think any action is needed by core.
A commit references this bug: Author: wulf Date: Mon Sep 9 18:57:18 UTC 2019 New revision: 352102 URL: https://svnweb.freebsd.org/changeset/base/352102 Log: MFC r351197, r351199: iwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices Currently supported models are: 8260, 8265, 9560, 9260 and 22161. Firmware files can be installed with comms/iwmbt-firmware port. PR: 237083 Reviewed by: hps, emax Differential Revision: https://reviews.freebsd.org/D21071 Changes: _U stable/12/ stable/12/targets/pseudo/userland/Makefile.depend stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.sbin/bluetooth/Makefile stable/12/usr.sbin/bluetooth/iwmbtfw/ stable/12/usr.sbin/bluetooth/iwmbtfw/Makefile stable/12/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c
(In reply to Joseph Mingrone from comment #33) > Since core@ was added to CC: please provide more information if you think any action is needed by core. I do not know why core@ was CC-ed
Hello, thank you for working on this. I can confirm it works with latest 13-CURRENT perfectly fine and was just wondering: is this a reason why this isn't closed, seeing that the changes have been merged?
> is this a reason why this isn't closed, seeing that the changes have been merged? Close this. Thank you for reminder.
This helped me running Bluetooth adapter on Panasonic ToughBook CF-MX4. TANK U! :-)