I am trying to build a daemon, preferable using Python, which is able to bind to a special keyboard attached to the Linux machine. The special keyboard is a barcode scanner but has an HID interface.
I would like to avoid running X on the machine, so something low-level like evdev
with its python bindings seem appropriate.
My suggestion would be the following:
- Use a custom udev rule to generate a character device like
/dev/input/barcode0
and fix the permission to allow the daemon to access the device. - Use
evdev
to get the input.
Is this approach feasible? What happens to the keyboard events? Is it possible to consume them so that they are not passed to a running console on the machine?
I have found a question here on SO with a similar problem, but it is using an X server which I do not.