[plug] USB Keypad Shennanigans

Simon Wise simonzwise at gmail.com
Thu Jul 25 09:18:25 UTC 2013

On 25/07/13 15:41, Onno Benschop wrote:
> I've been pulling out my hair for the past six hours and figured that it
> was time to see if anyone might be able to help. The situation isn't helped
> by the Ubuntu forum having been hacked, since much of the searching ends up
> there.
> I want to achieve the following:
> Use the individual keys of an external USB Numeric 18 key keypad to play an
> mp3 file for use in a radio broadcast situation - think Jingle Machine with
> 17 Jingles. (the 18th key needs to kill all audio).
> The OS is Ubuntu 12.04 on an R52 Thinkpad
> Things I've tried:
>     - Use the Keyboard shortcuts - doesn't work, since you cannot reprogram
>     each key without holding down a modifier, like shift or control.

xbindkeys can make keyboard shortcuts very flexibly, as long as X is running it 
will be able to intercept them, using either simple conf file or a scheme one.

thd will do similar, but does not need X, could be ideal for a tactile but 
headless machine ... works nicely to control RPis for example

they can trigger whatever command you need to play the mp3, there are plenty of 
CLI players, both are in debian repositories ... "triggerhappy" in the case of 
thd. I find it better to be independent of the WM for these things, a 
configuration file and a single app are much more portable.

if you wish to get a bit fancy, the try using puredata ... you can access hid 
data directly, so you could just respond to that keypad rather than any 
keystrokes, and play the soundfiles etc directly, or much else ..  if you want 
to go that way I could give you some pointers, and some patches, that would help 
you get started.

More information about the plug mailing list