Capturing keystrokes via service application...

I’m not familiar enough with Linux to know if this is possible (and if it would be even on something like Windows; however, I know you probably could using the Windows API); however… I have a barcode scanner that is detected as a basic standard keyboard input. I want to run an application daemonized (as a service) that will capture this input. The system will load straight to bash, and there will not be any other input or monitors connected to it.

First obstacle I have to overcome is capturing the input for the application.
Second obstacle is to keep the scanned input from using that as a login attempt… since the system boots directly to the login prompt.

Any ideas if this is possible? Perhaps using some kind of USB hook, etc.? Thanks…

Typically because there is no user logged in, there is no hook into the keyboard events because there is no tty session to send them to.

Thanks Greg, that’s what I figured. The more I look into this, the more it looks like it’s either impossible or would be too complicated to put together (and if I was able, it’s probably in a way that wouldn’t be sustainable or reliable… having to implement tricks/gimmicks which I’m unwilling to do). Going to have to go about this another way… appreciate it.

Just out of curiosity, what type of barcode scanner is it? The reason I ask is that if you can program it to act as an HID device, you may be able to access that in service mode. When I did work with barcodes, we opted for HID over keyboard emulation because it was so easy for a user to send bad data by accident with a physical keyboard).