Bluetooth

From miki
Jump to navigation Jump to search

Bluetooth on Linux

Lot of detailed information.

Bluetooth codecs

Some detailed information:

Mention the new SONY WH-1000XM3 !
Including a long discussion on the support of SBC_XQ on PulseAudio, available patches, and faulty devices.

Tips

Sony WH-1000XM3

Reference
  • However tip on headset-roles seems outdated (does not seem necessary).
Troubleshooting
bluetoothctl info 38:18:4C:4B:6A:3A
bluetoothctl info 38:18:4C:4B:6A:3A | grep -i battery
Tips
  • For better support, install latest pipewire wireplumber package.
  • Best playback codec is SBC_XQ. Select it in Gnome setting - Sound, or through pactl:
pactl set-card-profile bluez_card.38_18_4C_4B_6A_3A a2dp-sink-sbc_xq
  • For confcall, use the mSBC codec. Again select it Gnome settings - Sound, or:
pactl set-card-profile bluez_card.38_18_4C_4B_6A_3A headset-head-unit-msbc
  • View headset battery level in Gnome settings - Power. This requires enabling the bluetooth expiremental API [1]:
sudo systemctl edit bluetooth.service
# Edit file as:
# (file is /etc/systemd/system/bluetooth.service.d/override.conf)
#
#     [Service]
#     ExecStart=
#     ExecStart=/usr/libexec/bluetooth/bluetoothd --experimental
#
sudo systemctl restart bluetooth.service
Media control
  • MPRIS - archlinux Here they say that WH-1000XM3 supports AVRCP, and that MPRIS-bluetooth is not required. It only requires to setup keyboard shortcuts.
  • Key is detected by xev.
  • In Gnome Settings - Keyboard, we can indeed register a custom shortcut with the headset tap as event (key is called Audio play).
  • ... however eventhough we can register an event, this event is never triggered (we still see an icon with circle + cross being displayed)
  • See AskUbuntu User reports various findings. Also one fix could be that some applications (Chrome...) were grabbing the event already.
  • Volume control (swipe up / down), only works while Gnome Settings is opened.
  • Tapping event.
We start dbus-monitor, and tap on the right headset. We see:
dbus-monitor
# ...
# signal time=1651003988.635770 sender=:1.41 -> destination=:1.76 serial=3196 path=/org/gnome/Shell; interface=org.gnome.Shell; member=AcceleratorActivated
#    uint32 121
#    array [
#       dict entry(
#          string "timestamp"
#          variant             uint32 6735577
#       )
#       dict entry(
#          string "action-mode"
#          variant             uint32 1
#       )
#       dict entry(
#          string "device-node"
#          variant             string "/dev/input/event13"
#       )
#    ]
# ...
If we connect to given device, we get a string whenever we tap on the headset:
sudo cat /dev/input/event13 | xxd
# 00000000: 8653 6862 0000 0000 9822 0e00 0000 0000  .Shb....."......
# 00000010: 0100 c800 0100 0000 8653 6862 0000 0000  .........Shb....
# 00000020: 9822 0e00 0000 0000 0000 0000 0000 0000  ."..............
# 00000030: 8653 6862 0000 0000 ec4d 0e00 0000 0000  .Shb.....M......
# 00000040: 0100 c800 0000 0000 8653 6862 0000 0000  .........Shb....
# 00000050: ec4d 0e00 0000 0000 0000 0000 0000 0000  .M..............
# ...