I’m writing an ANSI C app for Debian Linux, that captures data from USB keyboard and sends some data via RS232 port and LAN (it’s some kind of industrial machine). There is no screen connected to the PC.
I’m using capturing from “/dev/input/event1” and everything works fine, but after starting the computer shows up system login/pass prompt and keyboard is captured by my app but also by system login. My question is how to disable capturing keyboard by system for login, but keep it running with my app?
I’m writing an ANSI C app for Debian Linux, that captures data from USB
Share
The problem that you are facing is that by default all input event handlers for a device receive all events. There are at least two handlers for your case: the keyboard driver for the console and an
evdevuserspace interface for your application.To avoid this, your application should instruct the
evdevmodule to grab the input device for its own exclusive use with theEVIOCGRABioctl. That would prevent any other handler, including other userspace applications, from receiving any events from that device.To grab a device:
To release a grabbed device: