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,707
vava
  • 1,422

2 Answers2

26

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,422
4

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.