Bug 263900 - Bluetooth dysfunction with TP-Link UB500
Summary: Bluetooth dysfunction with TP-Link UB500
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 13.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-10 18:00 UTC by xyesbee
Modified: 2022-05-10 18:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xyesbee 2022-05-10 18:00:02 UTC
I own a TP-Link UB500 Bluetooth 5.0 Adapter, that works with Linux and Windows out of the box. I followed the instructions on official FreeBSD documentation but unfortunately that did not work out.

  # service bluetooth start ubt0hci
  /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0hci
  # service bluetooth start ubt0hci
  /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0hci
  # service bluetooth start ubt0hci
  /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0hci

Then I tried with removing the `hci' part.

  # service bluetooth start ubt0
  /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0
  #

Up to this point, it was clear it does not support the device but the weird part is when the next attempt occurs.

  # service bluetooth start ubt0
  #

I see a fake light of hope but as soon as I run inquiry.

  # hccontrol inquiry
  Inquiry complete. Status: No error [00]

It becomes clear that the Bluetooth stack is messed up because I have discoverable Bluetooth devices nearby.
Comment 1 xyesbee 2022-05-10 18:41:11 UTC
I dug up a little bit and found out /etc/rc.d/bluetooth uses ngctl (Netgraph API) to configure the Bluetooth stack for a certain device. So I ran through man pages and decided what was most appropriate and ran "ngctl ls" whose results are the following if they help debugging the issue.

There are 8 total nodes:
  Name: ubt0            Type: ubt             ID: 00000001   Num hooks: 1
  Name: ubt0hci         Type: hci             ID: 00000022   Num hooks: 3
  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: ubt0l2cap       Type: l2cap           ID: 00000026   Num hooks: 3
  Name: ngctl8974       Type: socket          ID: 0000002c   Num hooks: 0
Comment 2 xyesbee 2022-05-10 18:45:33 UTC
Lastly, state of /var/log/messages at when I plugged the device in.

  May 10 10:20:22 xsbeepc kernel: ugen0.4: <vendor 0x2357 TP-Link UB500 Adapter> at usbus0
  May 10 10:20:22 xsbeepc kernel: ubt0 on uhub1
  May 10 10:20:22 xsbeepc kernel: ubt0: <Bluetooth Radio> on usbus0
  May 10 10:20:22 xsbeepc kernel: WARNING: attempt to domain_add(bluetooth) after domainfinalize()
  May 10 10:20:22 xsbeepc kernel: WARNING: attempt to domain_add(netgraph) after domainfinalize()

And when I ran setup commands.

  May 10 10:21:56 xsbeepc root[91655]: /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0hci
  May 10 10:22:00 xsbeepc root[94305]: /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0hci
  May 10 10:22:02 xsbeepc root[98572]: /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0hci
  May 10 10:22:06 xsbeepc root[681]: /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0

For the last apparent successful invocation, there is no error in /var/log/messages.