Let me investigate on this. I’ll reply back to you as soon as possible.
I ended up using the libdevinput gem to get raw access to key events for all connected usb hids (even worked with my wireless plantronics headset)
When you boot the edison with usb attached (and 5v applied to the right pins) you can see your attached hid devices under /dev/input
Mine look like this:
Open them with dev = DeviInput.new '/dev/input/by-id/X'
and loop through the events, maybe using a case statement based on the key and if it was pressed or released.
dev = DevInput.new device
dev.each do |event|
if event.type_str == 'Key' and event.value_str == 'Press' case event.code_str when '0' playloop nil when '1' playloop "drums/01_loop.wav" when '2' playloop "drums/02_loop.wav" when '3' playloop "drums/03_loop.wav" when '4' playloop "drums/04_loop.wav" when '5' playloop "drums/05_loop.wav" when '6' playloop "drums/06_loop.wav" when '7' playloop "drums/07_loop.wav" when '8'
Is there a quick howto on pasting code and such in this web editor.
I'm not a fan, and would prefer something simple.... Supporting Markdown as an alternate input / edit field would go a long way.
Are you able to see the binary output when executing the following command "more /dev/input/by-id/usb-05f3_0007-event-kbd" and hitting a key on the keyboard?
Yeah the above code works
Now to figure out Bluetooth keyboards!