Headless Control Using X and USB HID Devices

Using X has anyone used the xev and xbindkeys config file method to setup a USB mouse as an input controller for shell commands to a rpi? Once mouse is in X with xbindkeys and xev installed and configured you just edit the .xbindkeysrc text config file and add your shell command like shutdown or mpc volume +2 for volume control and button # you obtained running xev.

Another method using X is to have a shell script running all the time with constant do while loop that pipes xinput --query-states command queries to grep's loading the state of mouse buttons into variables that are conditionally tested and if true perform shell commands, like shutdown or mpc volume +2 to increase volume. This should work as I have script that outputs mouse states to the screen. Comments on this method are most welcome also.

Check out http://unix.stackexchange.com/questions ... or-command for details on the procedure. Seems the easiest, cheapest and safest way to add a shutdown button or next song or volume, control in a headless running environment.

It would seem to me that for your typical headless digital audio player rpi with a DAC, any three button mouse with X installed on the rpi could use a button to increase volume, decrease volume and shutdown with no soldering involved that would void your IC2 hw DAC board

There are so many USB HID devices (how about an eight button mouse with scroll wheel) supported by X on Raspbian.

I would appreciate all input on this approach.

I also posted this on rpi forum and will share what I find their too


Please sign in to leave a comment.