22

I have noticed, that although my "Bluetooth Headset" works perfectly fine, buttons on it, like Previous, Next, Play etc do not.

Why is that?

v2r
  • 9,547
vava
  • 1,362

2 Answers2

25

As of Ubuntu 10.04, uinput module that handles such buttons is not started by default. To fix the situation:

  1. Stop bluetooth service
    sudo service bluetooth stop
  2. Enable uinput module
    sudo modprobe uinput
  3. Start bluetooth service back again
    sudo service bluetooth start

That should fix the issue temporarily, until restart. To fix it permanently, run:

echo 'uinput' | sudo tee -a /etc/modules
vava
  • 1,362
3

Vava's answer did not fix the issue for me alone (Ubuntu 20.04), I had to use, in addition, xbindkeys and playerctl https://wiki.archlinux.org/title/Xbindkeys

First, disable/unassign the shortcuts for media play and pause via the shortcut editor.

sudo apt install xbindkeys playerctl
xbindkeys -d > ~/.xbindkeysrc

Open ~/.xbindkeysrc and delete all lines between line 40 and 66 inclusive.

xbindkeys --key

Get the raw keycode (e.g. m:0x0 + c:209). Your headset might toggle between play and pause keycodes, so run xbindkeys --key twice to get code for both play and pause.

Put the following into your ~/.xbindkeysrc with the correct key codes.

"playerctl play-pause"
   m:0x0 + c:208t

"playerctl play-pause" m:0x0 + c:209

If your headset is already passing XF86Play or some other key (you can use screenkey to check, you can use the following instead as an example

"playerctl play-pause"
   XF86AudioPlay

playerctl play-pause will control "the first available player". Read playerctl -h for more info/options if needed.

Open /etc/X11/Xsession as root. Add the line xbindkeys after the line PROGNAME=Xsession.

Reboot.

My headset now correctly controls Youtube videos.

  • Worked perfectly for my Sony WF-1000XM4s! Thanks a lot. – Suyog Jadhav Sep 17 '22 at 21:44
  • Maybe there's a small correction needed (I am not entirely sure). The keycodes you mentioned were spot on, except for the first one, which was m:0x0 + c:208 for me instead of m:0x0 + c:208t. I don't know much about keycodes, but if anyone runs into this issue, try changing the keycode like this and see if it works for you :D – Suyog Jadhav Sep 17 '22 at 22:20