Bug 228787

Summary: Intel 7260 bluetooth broken.
Product: Base System Reporter: dgilbert
Component: kernAssignee: Vladimir Kondratyev <wulf>
Status: Closed FIXED    
Severity: Affects Some People CC: arrowd, bsd, bz, daniel.piecebypiece, fbsd, freebsd, mohammad, nikola.lecic, osa, pete, skrechy, timp87, wulf
Priority: ---    
Version: 11.1-STABLE   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Block_attachment_of_unitialized_7260_controller.patch
none
iwmbtfw_by_Philippe_Michaud-Boudreault.patch none

Description dgilbert 2018-06-06 16:52:04 UTC
I have an Intel 7260 (iwm) Wifi/Bluetooth card.  The bluetooth portion of the card doesn't work properly under FreeBSD:

dmesg shows (these lines are not necessarily contiguous):

ubt0 on uhub2
ubt0: <vendor 0x8087 product 0x07dc, class 224/1, rev 2.00/0.01, addr 3> on usbus0
ubt0: ubt_ctrl_write_callback:780: control transfer failed: USB_ERR_TIMEOUT
ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command OGF=0x3, OCF=0x3. Timeout

... I have tried restarting bluetooth ... and it doesn't do anything but fail.
Comment 1 Ian Trudel 2018-07-31 01:54:14 UTC
(In reply to dgilbert from comment #0)

Same issue here. Brand new card.
Comment 2 Daniel Zeisig 2018-08-13 02:55:59 UTC
Similar Situation for me running on a Matebook X Pro, Kabylake.

Autoloading module: ng_ubt.ko
Autoloading module: ng_ubt.ko
Autoloading module: ng_ubt.ko
Autoloading module: ng_ubt.ko
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
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
Comment 3 Ivan 2018-08-19 20:52:19 UTC
I've observed the same issue with my intel card (72xx)
Comment 4 Ivan 2018-08-19 20:53:23 UTC
I believe from time to time the driver loads itself, but failed to find any devices. 
Probably, entire BT stack is broken.
Comment 5 Sergey A. Osokin freebsd_committer freebsd_triage 2018-11-18 01:38:16 UTC
I have the same issue with 12.0-BETA4, here's the dmesg(8) output:

ubt0 on uhub0
ubt0: <vendor 0x8087 product 0x0a2b, class 224/1, rev 2.00/0.10, addr 1> on usbus0
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
ubt0: ubt_ctrl_write_callback:782: control transfer failed: USB_ERR_TIMEOUT
Comment 6 J.R. Oldroyd 2018-11-28 21:00:44 UTC
Same on an Asus S510UQ running 11.2:

dmesg:
ubt0 on uhub0
ubt0: <vendor 0x8087 product 0x0a2b, class 224/1, rev 2.00/0.10, addr 3> on usbus0
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
ubt0: ubt_ctrl_write_callback:780: control transfer failed: USB_ERR_TIMEOUT
ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command OGF=0x3, OCF=0x3. Timeout

# usbconfig 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 

Running the rc.d/bluetooth setup commands manually, all the ngctl commands complete ok; the first hccontrol command fails with the timeout.
Comment 7 Vladimir Kondratyev freebsd_committer freebsd_triage 2019-02-08 11:36:04 UTC
(In reply to J.R. Oldroyd from comment #6)
I wrote (really, mostly stole) firmware downloader for Intel Wireless 8260/8265 Controllers (VID/PID is 0x8087/0x0a2b) so you can try it: https://github.com/wulf7/iwmbt-firmware
Please, don't report failures unless you have read Caveats section of README file :-)

Unfortunately, it wont help Bug Reporter as he has older 0x8087/0x07dc device.
Comment 8 Daniel Zeisig 2019-02-09 13:40:37 UTC
(In reply to Vladimir Kondratyev from comment #7)

Followed instructions at: https://github.com/wulf7/iwmbt-firmware
Installation worked right away but just after changing the

BTSTACK_COMMIT= a563da7c504f59cdb6ba2c73b00867f9b0655f44 in "Makefile" to match the current latest commit of https://github.com/bluekitchen/btstack I could find the btdevice via: $>sudo ngctl list

I did try to pair my "Bose QuietComfort 35" using this script: https://reviews.freebsd.org/D3778

Pairing looks good. If the device itself works I can't say yet. Thats next to find out for me.

Thanks Vladimir!
Comment 9 Nikola Lečić 2019-05-09 22:27:04 UTC
(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?
Comment 10 Vladimir Kondratyev freebsd_committer freebsd_triage 2019-05-10 09:09:00 UTC
(In reply to Nikola Lečić from comment #9)
Hi Nikola,

There is a separate "Intel Wireless 8260/8265" bug thread that can be found at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237083

Could you repost your question there?

Intel 7260 Bluetooth is a different piece of hardware.

Thanks
Comment 11 Nikola Lečić 2019-05-10 09:39:19 UTC
(In reply to Vladimir Kondratyev from comment #10)

Vladimir,

Indeed, sorry. Done.
Comment 12 dgilbert 2019-11-05 06:00:20 UTC
Just wondering if this is on anyone's list?  The 8250 cards are a different form factor and won't fit in this laptop.
Comment 13 skrech 2020-05-02 13:52:18 UTC
Hello,
Any news on this front?
Comment 14 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-02-13 08:56:34 UTC
Created attachment 222405 [details]
Block_attachment_of_unitialized_7260_controller.patch

This patch should prevent start of ng_ubt driver on 7260 controllers which have no firmware downloaded.

It DOES NOT contain firmware downloader. It is just a little brick on a road to support 7260.

It is not tested by me due to lack of hardware.
Comment 15 Pavel Timofeev 2021-02-14 17:22:25 UTC
(In reply to Vladimir Kondratyev from comment #14)
Building this on my Lenovo x1 carbon gen 3 where I have the issue.
Comment 16 Gleb Popov freebsd_committer freebsd_triage 2021-02-14 17:32:48 UTC
(In reply to Vladimir Kondratyev from comment #14)
This patch improves things for me. The firmware downloader doesn't try to do anything now, and USB timeouts are now gone. These timeouts were actually preventing my system from rebooting, so I had to poweroff it.
Comment 17 Helge Oldach 2021-02-15 09:22:04 UTC
Same here!
Comment 18 Pavel Timofeev 2021-02-15 16:01:21 UTC
(In reply to timp87 from comment #15)
It helped me to get rid of those "Root mount waiting for: usbus0" messages which slowed down the boot process a lot!

Is it too late to include this into releng/13.0?
Comment 19 commit-hook freebsd_committer freebsd_triage 2021-04-15 14:29:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=788a171c77760c2847b6433c5a914a304d0aa184

commit 788a171c77760c2847b6433c5a914a304d0aa184
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-04-15 14:26:32 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-04-15 14:26:32 +0000

    ng_ubt: Block attachment of uninitialized Intel Wireless 7265

    As this controller requires firmware patch downloading to operate.
    "Intel Wireless 7265" support in iwmbtfw(8) is yet to be done.

    Tested by:      arrowd et al
    PR:             228787
    MFC after:      2 weeks

 sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c       |   5 +-
 sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c | 122 +++++++++++++++++-----
 sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h   |   4 +
 3 files changed, 103 insertions(+), 28 deletions(-)
Comment 20 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-04-15 17:52:01 UTC
(In reply to timp87 from comment #18)
> Is it too late to include this into releng/13.0?

It was not too late, but I was too busy @atwork to handle that. It will get to 13-STABLE soon.
Comment 21 commit-hook freebsd_committer freebsd_triage 2021-04-30 20:16:54 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=83235903d5dc735fbce8b22a5204ab648f2d9c94

commit 83235903d5dc735fbce8b22a5204ab648f2d9c94
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-04-15 14:26:32 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-04-30 20:14:44 +0000

    ng_ubt: Block attachment of uninitialized Intel Wireless 7265

    As this controller requires firmware patch downloading to operate.
    "Intel Wireless 7265" support in iwmbtfw(8) is yet to be done.

    Tested by:      arrowd et al
    PR:             228787

 sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c       |   5 +-
 sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c | 122 +++++++++++++++++-----
 sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h   |   4 +
 3 files changed, 103 insertions(+), 28 deletions(-)
Comment 22 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-05-03 17:35:18 UTC
There are good news on this issue:

Philippe Michaud-Boudreault added a support for 7260 to iwmbtfw.

Please, try iwmbtfw from his repo: https://github.com/sinetek/iwmbtfw

As 7260 requires firmware files do be downloaded, I added them to comms/iwmbt-firmware port:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253302
Comment 23 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-05-03 18:28:40 UTC
Created attachment 224637 [details]
iwmbtfw_by_Philippe_Michaud-Boudreault.patch

Leave Philippe's work here as patch to src tree to make it easier to apply
Comment 24 Helge Oldach 2021-05-04 10:13:28 UTC
Works perfectly (stable/13):

ugen0.2: <vendor 0x8087 product 0x07dc> at usbus0
ubt0 on uhub0
ubt0: <vendor 0x8087 product 0x07dc, class 224/1, rev 2.00/0.01, addr 1> on usbus0
Comment 25 commit-hook freebsd_committer freebsd_triage 2021-05-04 23:53:37 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fe70d7b26d7a98b17e315bc3455bee267c618b4e

commit fe70d7b26d7a98b17e315bc3455bee267c618b4e
Author:     Philippe Michaud-Boudreault <pitwuu@gmail.com>
AuthorDate: 2021-05-04 23:48:21 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-05-04 23:50:32 +0000

    iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares

    To use it comms/iwmbt-firmware port should be updated to 20210315 version.

    Submitted by:   Philippe Michaud-Boudreault <pitwuu@gmail.com>
    Tested by:      Helge Oldach <freebsd@oldach.net>
    Reviewed by:    wulf
    PR:             228787
    MFC after:      2 weeks

 usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c   |  14 ++
 usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c   | 189 +++++++++++++++++++++++-
 usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h   |   5 +
 usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8    |  10 +-
 usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf |   2 +-
 usr.sbin/bluetooth/iwmbtfw/main.c       | 253 +++++++++++++++++++++++---------
 6 files changed, 401 insertions(+), 72 deletions(-)
Comment 26 commit-hook freebsd_committer freebsd_triage 2021-05-23 22:46:47 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0be693b3d5f1bda593a96ba3fcd5a31538b35781

commit 0be693b3d5f1bda593a96ba3fcd5a31538b35781
Author:     Philippe Michaud-Boudreault <pitwuu@gmail.com>
AuthorDate: 2021-05-04 23:48:21 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-05-23 22:44:36 +0000

    iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares

    To use it comms/iwmbt-firmware port should be updated to 20210315 version.

    Submitted by:   Philippe Michaud-Boudreault <pitwuu@gmail.com>
    Tested by:      Helge Oldach <freebsd@oldach.net>
    Reviewed by:    wulf
    PR:             228787

 usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c   |  14 ++
 usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c   | 189 +++++++++++++++++++++++-
 usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h   |   5 +
 usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8    |  10 +-
 usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf |   2 +-
 usr.sbin/bluetooth/iwmbtfw/main.c       | 253 +++++++++++++++++++++++---------
 6 files changed, 401 insertions(+), 72 deletions(-)
Comment 27 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-06-13 22:15:38 UTC
Intel 7260 (iwm) Wifi/Bluetooth card firmware downloader has been committed to both 14-CURRENT and 13-STABLE
Comment 28 Mohammad Noureldin 2022-11-22 17:41:16 UTC
Hi Vladimir,

Any reason these fixes are not applied on stable/12 ?
Comment 29 Vladimir Kondratyev freebsd_committer freebsd_triage 2022-11-23 00:17:10 UTC
(In reply to Mohammad Noureldin from comment #28)
Only a lack of testing. It is not clear to me if [1] required for 7260 on ubt(4) to work or not.

[1] https://cgit.freebsd.org/src/commit/?id=52489f2a55e625ea35bccc3749ca3adad6ce0c54
Comment 30 Mohammad Noureldin 2022-11-24 03:14:02 UTC
(In reply to Vladimir Kondratyev from comment #29)

Hi Vladimir,

Thanks for your reply. I do have the Intel 7260 HW and I am running on 12.3.0 Release.

I've followed all the steps explained:
- With [1] all the steps seem to be working but I still fail to start the bluetooth stack
- Without [1] it gets worse, I see this message again: "ng_ubt: HCI command 0xfc05 time out"

I have 2 questions:
- What information should I collect to help getting to the bottom of this ?
- Should I open a new PR given this one is closed ?


[1] https://cgit.freebsd.org/src/commit/?id=52489f2a55e625ea35bccc3749ca3adad6ce0c54
Comment 31 commit-hook freebsd_committer freebsd_triage 2022-11-24 23:18:18 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f16c39e7fe641cf9e6f17cfc177d2300b218bf45

commit f16c39e7fe641cf9e6f17cfc177d2300b218bf45
Author:     Philippe Michaud-Boudreault <pitwuu@gmail.com>
AuthorDate: 2021-05-04 23:48:21 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-11-24 23:15:54 +0000

    iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares

    To use it comms/iwmbt-firmware port should be updated to 20210315 version.

    Submitted by:   Philippe Michaud-Boudreault <pitwuu@gmail.com>
    Tested by:      Helge Oldach <freebsd@oldach.net>
    Reviewed by:    wulf
    PR:             228787
    MFC after:      2 weeks

    (cherry picked from commit fe70d7b26d7a98b17e315bc3455bee267c618b4e)

 usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c   |  14 ++
 usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c   | 189 +++++++++++++++++++++++-
 usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h   |   5 +
 usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8    |  10 +-
 usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf |   2 +-
 usr.sbin/bluetooth/iwmbtfw/main.c       | 253 +++++++++++++++++++++++---------
 6 files changed, 401 insertions(+), 72 deletions(-)
Comment 32 commit-hook freebsd_committer freebsd_triage 2022-11-24 23:18:21 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6477a1fe961e5c9e1db477d7cf12265f477fce45

commit 6477a1fe961e5c9e1db477d7cf12265f477fce45
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-04-15 14:26:32 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-11-24 23:15:48 +0000

    ng_ubt: Block attachment of uninitialized Intel Wireless 7265

    As this controller requires firmware patch downloading to operate.
    "Intel Wireless 7265" support in iwmbtfw(8) is yet to be done.

    Tested by:      arrowd et al
    PR:             228787
    MFC after:      2 weeks

    (cherry picked from commit 788a171c77760c2847b6433c5a914a304d0aa184)

 sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c       |   5 +-
 sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c | 122 +++++++++++++++++-----
 sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h   |   4 +
 3 files changed, 103 insertions(+), 28 deletions(-)
Comment 33 Vladimir Kondratyev freebsd_committer freebsd_triage 2022-11-24 23:30:40 UTC
(In reply to Mohammad Noureldin from comment #30)

> What information should I collect to help getting to the bottom of this ?
You collected enough information to allow it to be applied to 12-STABLE. Thanks!
I cherry-picked all 7260-related commits to 12-STABLE. Unfortunately it is too late to push them in to 12.4-RELEASE.
Don't forget that iwmbtfw is a userspace tool, so you must upgrade both kernel and userworld to latest stable to get 7260 support