LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Disabling default keyboard behavior (https://www.linuxquestions.org/questions/linux-hardware-18/disabling-default-keyboard-behavior-4175503571/)

jdwpv4 05-01-2014 07:50 AM

Disabling default keyboard behavior
 
Good morning.

I am a linux noob with a question which I hope is simple.

I am writing a program to read data from a USB card swiper for a point of sale processing system.

The swiper acts like a keyboard. When you plug it in you get new files in /dev and /dev/input.

I can open the /dev/input/event* file associated with that "keyboard" and read the raw keycodes, map them to ASCII, and boom I've got my data.

The problem is linux still does the default behavior for a keyboard key press; That is it echo's to the screen and adds the character to the STDIN buffer.

I need to disable that default behavior, so that it no longer echos to the screen or corrupts the stdin data. But I need to do so WITHOUT affecting the behavior of the real keyboard.

Any idea how to do that?

Thanks
Josh

rtmistler 05-02-2014 10:28 AM

Not knowing the particulars about your card reader, I was wondering what drivers they use, here is someone chronicling their integration of "a" USB credit card reader http://www.micahcarrick.com/credit-c...der-pyusb.html.

What I see there is it shows as a Human Interface Device (HID) but it got installed as a different resource than /dev/event.

So I believe this is your fundamental problem is how this device is getting mapped and recognized by your system. Was this the native way it got discovered? Was there any guidance provided by the manufacturer? Or did they not even say it was Linux tested?

I think the bottom line here is if you have something which is re-using /dev/event0, then that WILL cause keyboard events, because that's how all applications which expect the traditional keyboard are going to gain their input. The other problems here extend beyond an open command prompt, it could be so worse as sequences like CTRL-ALT-DEL or CTRL-ALT-F1 get misinterpreted.

So I'd diagnose if there were a more correct way to integrate that card reader into your system rather than try to stop or redirect keyboard I/O. Because the keyboard I/O should stay there and that card reader should not be interfering with it.


All times are GMT -5. The time now is 12:34 AM.