NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/61111: ubt does not feed firmware to Realtek USB Bluetooth 5.1 HCI (VID 0x2550, PID 0x8761); HCI does not function properly



>Number:         61111
>Category:       kern
>Synopsis:       ubt does not feed firmware to Realtek USB Bluetooth 5.1 HCI (VID 0x2550, PID 0x8761); HCI does not function properly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 02 02:20:00 +0000 2026
>Originator:     Jared Jennings
>Release:        11.99.11
>Organization:
>Environment:
NetBSD needle.agrue.info 11.99.11 NetBSD 11.99.11 (GENERIC) #0: Mon Nov 30 00:11:30 EST 2026  root%needle.agrue.info@localhost:/usr/obj/sys/arch/amd64/compile/GENERIC amd64

>Description:
I have a Bluetooth dongle with a nice six-inch antenna, purported to reach up to 100 meters away. It is detected as a Bluetooth HCI by class. It responds to some HCI commands (status inquiries) normally. When asked to scan for nearby devices, it finds nothing.

When I plug in this device, the kernel says:

[ 117311.149520] ubt0 at uhub4 port 1
[ 117311.149520] ubt0: Realtek (0x2550) Bluetooth Radio (0x8761), rev 1.10/2.00, addr 19

When I run btconfig -v -v v, the reply is:

ubt0: bdaddr 00:00:00:00:00:00 flags 0
	num_cmd = 0
	num_acl = 0 (max 0), acl_mtu = 0
	num_sco = 0 (max 0), sco_mtu = 0

When I `btconfig ubt0 up`, the kernel says: (I have built the kernel with options BLUETOOTH_DEBUG and UBT_DEBUG, and sysctl hw.ubt_debug is set at 6 and net.bluetooth.debug is set at 8)

[ 117525.083299] hci_ioctl_pcb: cmd 0xc0386205
[ 117525.083299] hci_ioctl_pcb: cmd 0xc0386208
[ 117528.093352] hci_ioctl_pcb: cmd 0xc0386205
[ 117528.093352] hci_ioctl_pcb: cmd 0xc0386208
[ 117528.093352] ubt_enable: sc=0xffff9fb3ebfc8c80
[ 117528.093352] hci_send_cmd: (ubt0) opcode (003|0003)
[ 117528.103353] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.103353] hci_event_command_compl: (ubt0) opcode (003|0003) num_cmd_pkts = 3
[ 117528.103353] hci_send_cmd: (ubt0) opcode (004|0009)
[ 117528.103353] hci_send_cmd: (ubt0) opcode (004|0005)
[ 117528.103353] hci_send_cmd: (ubt0) opcode (004|0003)
[ 117528.103353] hci_send_cmd: (ubt0) opcode (004|0001)
[ 117528.103353] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.103353] hci_event_command_compl: (ubt0) opcode (004|0009) num_cmd_pkts = 2
[ 117528.103353] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.103353] hci_event_command_compl: (ubt0) opcode (004|0005) num_cmd_pkts = 2
[ 117528.103353] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.103353] hci_event_command_compl: (ubt0) opcode (004|0003) num_cmd_pkts = 2
[ 117528.103353] hci_cmd_read_local_features: ubt0: lmp_mask 000f
[ 117528.103353] hci_cmd_read_local_features: ubt0: acl_mask cc18
[ 117528.103353] hci_cmd_read_local_features: ubt0: sco_mask 003f
[ 117528.103353] hci_send_cmd: (ubt0) opcode (004|0004)
[ 117528.103353] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.103353] hci_event_command_compl: (ubt0) opcode (004|0001) num_cmd_pkts = 2
[ 117528.103353] hci_send_cmd: (ubt0) opcode (004|0002)
[ 117528.103353] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.103353] hci_event_command_compl: (ubt0) opcode (004|0004) num_cmd_pkts = 2
[ 117528.103353] hci_cmd_read_local_extended_features: ubt0: page 0 of 2
[ 117528.103353] hci_send_cmd: (ubt0) opcode (004|0004)
[ 117528.113352] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.113352] hci_event_command_compl: (ubt0) opcode (004|0002) num_cmd_pkts = 2
[ 117528.113352] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.113352] hci_event_command_compl: (ubt0) opcode (004|0004) num_cmd_pkts = 2
[ 117528.113352] hci_cmd_read_local_extended_features: ubt0: page 1 of 2
[ 117528.113352] hci_send_cmd: (ubt0) opcode (004|0004)
[ 117528.113352] hci_event: (ubt0) event COMMAND COMPLETE
[ 117528.113352] hci_event_command_compl: (ubt0) opcode (004|0004) num_cmd_pkts = 2
[ 117528.113352] hci_cmd_read_local_extended_features: ubt0: page 2 of 2
[ 117528.113352] bthub0 at ubt0 local-bdaddr 00:e0:4c:XX:XX:XX
[ 117528.113352] hci_ioctl_pcb: cmd 0xc0386205
>How-To-Repeat:
Buy a cheap Bluetooth dongle from eBay with as large an antenna as possible, without concern for its compatibility with NetBSD. Try to use it, under increasing levels of debug logging.
>Fix:
FreeBSD's ng_ubt driver supports this Bluetooth dongle, as follows:

At attach time, if the HCI's USB VID/PID are on a list of about 20 devices, indicating a Realtek chip inside, ng_ubt sends an HCI command to check the LMP subversion. If the version is one of about a dozen listed, the ng_ubt driver refuses to attach to the device. It ends up as a generic USB device (ugen).

When the ugen device is attached, a devd rule matching the VID/PID runs  a separate utility, rtlbtfw. This sends vendor-specific HCI commands to the dongle from userspace using libusb, to determine which pieces of firmware, from a complicated little bin file, need to be sent to the HCI. It reads these pieces out of the bin file, and uses more vendor-specific HCI commands to send the pieces of firmware. After this is done, rtlbtfw asks libusb to reset the device. The ng_ubt driver's attach machinery comes into play again, but this time, when it queries the LMP subversion, the device replies with a value that is not on the ignore list. The attachment proceeds and the HCI works.





Home | Main Index | Thread Index | Old Index