raspberry-pibluetoothraspbianbluezmedia-keys

Finding Bluetooth key event code on raspberry pi


im on raperry pi 3b running defult 32bit os. Im trying to record the bluetooth inputs from my headset similar to the read command.to bind that code i get from that to another command to do stuff like pausing and playing music with playerctl.

i tried xev however im using ssh and any attempt on using stuff like MobaXterm dont work


Solution

  • You can use the command btmon to see live inputs. If you want to write inputs to a file, you can use btmon --write <path-to-file>, and if you want to read it you can use btmon --read <path-to-file>. It should come installed with bluez.

    However, it seems that you want to capture keypresses of a pause/play button, similar to one that you would find on a keyboard. For that, the keybind is XF86AudioPause and XF86AudioPlay. For more information, check the Arch Wiki about Xbindings, as well as all the keyboard codes. If it's a keyboard code that's not part of xbindings, you can find them here.