LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-01-2014, 07:50 AM   #1
jdwpv4
LQ Newbie
 
Registered: May 2014
Posts: 2

Rep: Reputation: Disabled
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
 
Old 05-02-2014, 10:28 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount default behavior Expect Linux - General 1 07-12-2013 12:21 PM
ipblock default behavior FolkTheory Linux - Security 3 12-01-2007 12:30 PM
Keyboard strange behavior trebek Linux - Hardware 8 09-19-2007 02:26 AM
Strange keyboard behavior VAS Arch 3 11-11-2006 12:07 PM
Change default ls behavior bgfay Linux - Newbie 5 06-21-2004 09:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration