Reputation: 87291
I have a Linux USB HID device (a Hama MCE), and I can read its events manually by reading cat /dev/input/event7
and cat /dev/input/event8
. Whenever I press a key on the device, a few bytes become available for reading with one of the cat
commands above. I have a default installation of Ubuntu Jaunty 64-bit desktop on the machine.
I think I can write a parser to interpret the bytes emitted by the device, or I'll use libhid if it's more convenient.
My questions are:
/usr/local/bin/keydumper /dev/input/event7 /dev/input/event8
(or one command for each /dev/
path) would get run, with the proper /dev/
paths substituted in the command line? Upvotes: 5
Views: 11904
Reputation: 191
I do not have enough points to comment sadly.
If you are looking for the definition of EVIOCGRAB try
#include <linux/input.h>
Upvotes: 2
Reputation: 87291
Answering my own question based on answers from the Linux USB HID driver developers:
Question 1. and 2.: Do
ioctl(open("/dev/input/event7", O_RDONLY), EVIOCGRAB, 1);
As long as this filehandle is open, the events generated would go only to this filehandle (not to other open()s of the same device or to the system keyboard or mouse event pool). At most one process can hold a successful EVIOCGRAB at a HID device at a time. Lirc can be configured to do an EVIOCGRAB.
Question 3.: Configure udev to start the program once the device is connected.
Upvotes: 8
Reputation: 106
I think solution for all questions can be writing own filter device driver, or custom driver for your device. I know such a thing (filter device driver) is available on windows so something similar can be on Linux. In that filter device driver you could block all unwanted events from the target device that you wish to block, I don't really get 3 question so I don't know how to answer for that.
Upvotes: -1