UBT(4)

๐Ÿ“ฆ version 11.0, in nixpkgs unstable

๐Ÿ’– UBT(4) โ€” USB Bluetooth driver ๐Ÿ’–

ok so bestie, you found a Kernel Interfaces Manual page and it's literally about the ubt driver. buckle up, we're getting into dongle lore ๐Ÿฆ‹


โœจ NAME โœจ

ubt โ€” the USB Bluetooth driver, aka the little guy that makes your tiny USB Bluetooth stick actually do stuff ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

ubt* at uhub? port ? configuration ? interface ?

like, that's the whole ritual. no cap. โœจ


๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so the ubt driver is the one that gives the Bluetooth protocol stack support for USB Bluetooth dongles. it's giving matchmaker, honestly โ€” it introduces your dongle to the stack ๐Ÿซถ

here's the cute part (and also the slightly annoying part): USB Bluetooth dongles show up with two interfaces, and the ubt driver claims both of them. yes, both. it's an all-in package deal ๐Ÿ’–

the second interface is the one used for Isochronous data, and it has several alternate configurations regarding bandwidth consumption. you can set which one you want with the hw.ubtN.config sysctl(8) variable ๐Ÿ”ฅ

wanna know how many alternate configurations exist? that number lives in the hw.ubtN.alt_config variable. and the isoc frame size for your current configuration is chillin' in the hw.ubtN.sco_rxsize and hw.ubtN.sco_txsize variables. icons only ๐Ÿ‘‘

by default, configuration 0 is selected โ€” which means no bandwidth is used on the Isochronous interface, and no SCO data can be sent. zero. none. it's giving "resting state" ๐Ÿ˜ด

for the complete instructions on setting bandwidth consumption, consult the Bluetooth USB specification at https://www.bluetooth.org/ โ€” the following extract is still useful as general guidance, though details may differ between manufacturers. (translation: don't come for me if your dongle does its own thing ๐Ÿ™ˆ)

  • 0 โ€” No active voice channels
  • 1 โ€” One voice channel with 8-bit encoding
  • 2 โ€” Two voice channels with 8-bit encoding, or one voice channel with 16-bit encoding.
  • 3 โ€” Three voice channels with 8-bit encoding
  • 4 โ€” Two voice channels with 16-bit encoding
  • 5 โ€” Three voice channels with 16-bit encoding

slay, that's the whole menu ๐Ÿ’œ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

(the whole friend group fr fr ๐Ÿซถ)


๐Ÿฆ‹ HISTORY ๐Ÿฆ‹

ngl this one has a whole glow-up arc. this ubt device driver was originally a character device, written by David Sainty and Lennart Augustsson. then it got rewritten to support socket based Bluetooth access for NetBSD 4.0 by Iain Hibbert. main character energy, honestly โœจ


๐Ÿ’€ CAVEATS ๐Ÿ’€

okay bestie, listen carefully, this is the part where it gets real ๐Ÿ˜ญ

Isochronous data is seemingly not well supported over USB in the current system, and to get SCO working you may have to calculate the SCO packet size that the stack will use. it's the sco_mtu value reported by the btconfig(8) command, and when you combine it with the SCO header (3 bytes) it should fit exactly into an integer number of Isochronous data frames โ€” where the frame size is indicated by the โ€˜hw.ubtN.sco_txsizeโ€™ sysctl variable. math girl summer, unfortunately ๐Ÿงฎ๐Ÿ’…

for example: I want one voice channel (which is all that is supported, for now) so I'm using configuration #2, with a frame length of 17 bytes. this gives possible values of:

(17 * 1) - 3 = 14
(17 * 2) - 3 = 31
(17 * 3) - 3 = 48
(17 * 4) - 3 = 65
(17 * 5) - 3 = 82

etc. ๐Ÿ‘‘

btconfig(8) shows the maximum SCO payload as 64 bytes, so I'm using the next smaller size of 48, to minimize the overhead of the 3 header bytes. see? simple. iconic. lowkey stressful. ๐Ÿ’–

the SCO packet size can be changed using the โ€˜scomtuโ€™ option to btconfig(8) ๐ŸŽ€

and the failure mode? the USB Bluetooth dongle locks up ๐Ÿ˜ญ though generally removal/reinsertion will clear the problem. so like. unplug it and plug it back in. the ancient IT ritual. it works. ๐Ÿซถ

โญ BUGS โญ

The Isochronous configuration can only be changed when the device is not marked up. that's it, that's the bug note, respect the boundary ๐Ÿ˜คโœจ


and that's the tea, bestie ๐Ÿ“ this page came from the Debian gang, version dated August 27, 2006 โ€” a whole vintage moment, and yes she still ate ๐Ÿ’…๐Ÿ’–

UBT(4) โ€” go forth and slay your dongle configuration ๐ŸŒธ๐Ÿฆ‹๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from