Solved Sony WH-1000XM2 Headphones on FreeBSD via Bluetooth

good morning, nice comminity.

the context: I am learning how to setup these Sony headphones on FreeBSD using Blued.

the problem: these headphones notify me with a nice female voice whenever they connect or disconnect. At this moment, the headphones connect/disconnect continuously.

Please come with any help/ideas/etc, I am lost.

Bash:
# /boot/loader.conf

...

vkbd_load="yes"

ng_ubt_load="yes"

ng_l2cap_load="yes"

snd_dha_load="no"

snd_driver_load="yes"

cuse_load="yes"

Bash:
# /etc/rc.conf

kld_list="nvidia-modeset /boot/modules/ng_hci.ko"
linux_enable="yes"
hcsecd_enable="no"
bthidd_enable="no"
devd_enable="yes"
bluetooth_enable="yes"
blued_enable="yes"
virtual_oss_enable="yes"
virtual_oss_config="blued"
virtual_oss_blued="-T /dev/sndstat -S -a o, -4 -C 2 -c 2 -r 44100 -b 16 -s 1024 -R /dev/dsp -P /dev/bluetooth/70:26:05:89:6c:ce -d dsp -t vdsp.ctl"
sndiod_enable="yes"
snd_uaudio_enable="yes"

PS: do not hesitate to ask questions :)

best regards,
Dmitry
 
Have you also tried the guide from the handbook?

In my experience anyhow Bluetooth on FreeBSD is always a hit and miss.
 
Have you also tried the guide from the handbook?

In my experience anyhow Bluetooth on FreeBSD is always a hit and miss.

hi elgrande, yes I did. I can see my headphones, "connect" to them / "disconnect" from them. At this moment, the headphones do no longer report connection/disconnection.
 
FIXED.


Bash:
# /boot/loader.conf

kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
coretemp_load="YES"
vkbd_load="YES"
snd_driver_load="YES"
cuse_load="yes"

Bash:
# /etc/rc.conf

# ...

kld_list="nvidia-modeset /boot/modules/ng_hci.ko"
linux_enable="YES"
dbus_enable="YES"
blued_enable="YES"
hcsecd_enable="NO"
sdpd_enable="YES"
bthidd_enable="NO"
bthidd_config="/etc/bluetooth/bthidd.conf"
bthidd_hids="/var/db/bthidd.hids"
devd_enable="YES"
moused_enable="YES"
bluetooth_enable="YES"
virtual_oss_enable="YES"
virtual_oss_configs="dsp"
virtual_oss_dsp="-T /dev/sndstat -C 2 -c 2 -r 44100 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/WH-1000XM2 -d dsp -t vdsp.ctl"
sndiod_enable="YES"

please note the /dev/bluetooth/WH-1000XM2 string. I tried using /dev/bluetooth/70:26:05:89:6c:ce instead, and it did not work. At all.

Bash:
# /etc/bluetooth/hosts

70:26:05:89:6c:ce    WH-1000XM2
 
If this is fixed, can you change the subject to solved? It will make it appear green and also helps others googling to determine which ones may be helpful for them.

Thanks for sharing. Also, what kind of range do you get with your headphones?
 
If this is fixed, can you change the subject to solved? It will make it appear green and also helps others googling to determine which ones may be helpful for them.

it is fixed. I am not sure how to change the subject ( cannot see a "change" button ). I have added the solved tag.
 
Thanks for sharing. Also, what kind of range do you get with your headphones?

well, I would say if I am within 3 meters of direct sight the sound quality is good. 5 meters or thick walls - the quality goes down rapidly. I searched for a device that talks bluetooth but with more power output, found nothing.
 
Ok, that is good to know. I have a room that wifi doesn't penetrate, so I have a separate wifi router just for that room. I would suspect that I too would have trouble unless in the room directly. And. consequently, I wouldn't be able to use it outside that room.

If you go to the very top of the thread, there should be 3 dots with a down arrow. Click that and select "Edit thread", then change the title from "(No prefix)" to "Solved".
 
Is blued still being actively worked on? Doesn't look like the patched offered are relevant anymore.
This is off-topic from the original question, but along the lines of bluetooth, I wonder if it would be possible to assign the bluetooth device to a bhyve Linux container and then magically pipe your sound to that container? I believe my bluetooth device is part of the wifi chip, so I'd have to use the same bhyve container. I've been using wifibox and it works great.

My thought process is that perhaps since development in those areas are lagging in FreeBSD, can there be an alternate approach that would achieve the same result given the resources available from within the FreeBSD community?
 
Is blued still being actively worked on? Doesn't look like the patched offered are relevant anymore.
You don't need to patch anymore, just install the daemon load the stock ng_hci and you're done :)

PS: ksql not exist in ports anymore, i used this git. Every other dependencies are available via pkg/ports.
 
First try to pair your device with bluetooth-config(8).
Otherwise git clone blued and ksql.
Build & install ksql (somehow it didn't find sqlite3, that's why the extra flags):
cd ksql
./configure
gmake CFLAGS+=-I/usr/local/include LDFLAGS+=-L/usr/local/lib
sudo gmake install

Then follow blued's how-to, except the kernel patching part.... then
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
sudo make install


This is my actual virtual_oss config. Have 2 different device for speaker/bt with different amplification, this way it's pretty good to me
Code:
virtual_oss_enable="YES"
virtual_oss_configs="dsp speaker blued"
virtual_oss_dsp="-S -r 44100 -c 2 -b 16 -s 10ms -R /dev/null -P /dev/dsp.speaker -d dsp -t vctl.dsp"
virtual_oss_speaker="-C 2 -c 2 -r 44100 -b 16 -s 10ms -a o,3 -d dsp.speaker -R /dev/null -P /dev/dsp0 -t vctl.speaker"
# bt speaker...
virtual_oss_blued="-C 2 -c 2 -r 44100 -b 16 -s 10ms -a o,-1  -d dsp.bt -R /dev/null -P /dev/bluetooth/headphones -t vctl.bt"
i switch outputusing the command:
virtual_oss_cmd /dev/vctl.dsp -P $OUTPUT
where $OUTPUT is /dev/dsp.speaker OR /dev/dsp.bt

To change the bt output to different device, just do:
virtual_oss_cmd /dev/vctl.bt -P /dev/bluetooth/other_bt_device
(other_bt_device either can be a BT address or a device name from /etc/bluetooth/hosts)

PS: to use the headset's mic you have to make it to the input of the default device: virtual_oss_cmd /dev/vctl.dsp -R /dev/bluetooth/headphones
This is just a theory, didn't test it so far :D

UPDATE: for media keys (including volume control) btavctpd is worth a try. It works great with my Airpods Max :beer: I had to change the xdotool commands in the c file to playerctl ones (playerctl play-pause, playerctl next, playerctl previous) to get it to work, it was an easy fix.
 
Back
Top