Re: The (incomplete) saga of Bluetooth, ath(4), AR9565, and WB335.

From: Andreas Kempe <kempe_at_lysator.liu.se>
Date: Fri, 04 Mar 2022 13:18:51 UTC
Hello Pau!

On Thu, Feb 10, 2022 at 02:49:24AM +0000, Pau Amma wrote:
> (Please cc: me on replies - I'm subscribed nomail as this is likely a 
> one-off question.)
> 
> So, I'm trying to figure out whether Bluetooth can be made to work on my 
> Lenovo Z50-70 (https://wiki.freebsd.org/Laptops/Lenovo_z50_70) running 
> 12.2 (and soon 12.3), with 13.1 an option when it hits RC stage or maybe 
> BETA. Relevant lines of /var/run/dmesg.boot show
> 
> ath0: <Qualcomm Atheros AR9565> mem 0xc0400000-0xc047ffff irq 19 at 
> device 0.0 on pci2
> ath0: WB335 2-ANT card detected
> ath0:Bluetooth Antenna Diversity card detected
> 
> kldstat -n ng_ubt.ko shows the module's loaded:
> 
> 34    1 0xffffffff834d1000 4260 ng_ubt.ko
> 
> but the "ubt0:" line 
> https://docs.freebsd.org/en/books/handbook/advanced-networking/index.html#network-bluetooth 
> led me to expect in /var/log/messages isn't there. Checking the wiki led 
> me to https://wiki.freebsd.org/dev/ath_hal%284%29/BluetoothCoex (8 years 
> old) where the "? - AR9565 + ?" line hints that my WiFi+Bluetooth 
> Atheros hardware was New and Strangeā„¢ then, and 
> https://wiki.freebsd.org/dev/ath_hal%284%29/AntennaDiversity (also 8 
> years old) led me to 
> https://wiki.freebsd.org/dev/ath_hal%284%29/AntennaDiversityWhatChips 
> (also... you get the picture) which doesn't even mention the hardware I 
> have.
> 
> At this point, I'm stumped. What are my options to get Bluetooth running 
> on my laptop? Get an USB Bluetooth dongle?
> 

I don't really have any good solutions to propose to you. Bluetooth
is, in my opinion, in quite a sorry state and isn't, as far as I am
aware, prioritised upstream. I have a bluetooth mouse that I got to
work on my old Thinkpad X220 by patching around a bit. I mailed the
lists about this in the past, but my mails have gone unanswered.

The issue with my mouse turned out to be that secure simple pairing
support is completely missing in the current implementation. Because
of this, I have been working on and off on writing my own Bluetooth
user space stack on top of netgraph, but work has been quite slow
since I'm no bluetooth expert and have been treating it as a time-sink
when I have nothing better to do. If you're interested, I have a WIP
git repository at
https://git.lysator.liu.se/kempe/blued/-/tree/development-sockets/.

Depending on what you plan to use bluetooth for, the reality is that
you might currently be better served using a wired alternative.

Cordially,
Andreas Kempe