Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I scan a barcode in a text console (CTRL+ALT+F1 or not running X) I get the correct input, but when I try with an application running on X, I don't get the correct barcode.

The scanner is configured to return the barcode followed by an 'n'. Under X I only get the 'n', not the preceding barcode.

I ran xev to see what is going on. Here is an excerpt of the output:

> KeyPress event, serial 35, synthetic NO, window 0x6800001,
>     state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
> KeyRelease event, serial 35, synthetic NO, window 0x6800001,
>     state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
> KeyPress event, serial 35, synthetic NO, window 0x6800001,
>     state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
> KeyRelease event, serial 35, synthetic NO, window 0x6800001,
>     state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,

There is one KeyPress/KeyRelease event pair for every digit in the barcode, but no events happening between the KeyPress and KeyRelease event for Alt_L?

Should I look at compose keys for a solution, or how can I match the behavior of a normal console?

ps. I am using a Welch Allyn ST3400 barcode scanner.

EDIT:

I ran showkey on the command line and scanned in a barcode. This is the output I got:

keycode  28 release
keycode  56 press
keycode  82 press
keycode  76 press
keycode  80 press
keycode  56 release
keycode  56 press
keycode  82 press
keycode  75 press
keycode  73 press
keycode  56 release

It seems that the barcode scanner is using Left-Alt+#+#+# to get the correct characters. It also seems like the barcode scanner never sends a release event for the numpad keys that it used together with Left-Alt? I read something similar on a different forum - without a solution though. If I manually use Left-Alt+#+#+# with showkey, I get press and release for each key.

The question now becomes, why is there no KeyPress event when I am running Xorg?

share|improve this question
2  
Maybe you can just reconfigure your barcode reader to output better usable output. The configuration is often done by scanning special barcodes - look at the documentation. –  jofel Feb 21 '12 at 14:12
    
Thanks, that is what I ended up doing. I configured it to send me the correct codes to start with rather than some alt-x,y,z key sequence. –  dirk Feb 22 '12 at 7:32
    
Maybe you want to promote the comment to an answer and mark it as correct ... –  Bananguin Aug 29 '12 at 14:34
    
Can I do that or does @jofel need to repost the comment as an answer? –  dirk Sep 2 '12 at 9:20
    
@dirk I just posted my comment now as an answer. –  jofel Sep 3 '12 at 8:09

1 Answer 1

up vote 2 down vote accepted

Often you can reconfigure your barcode reader to output better usable output. The configuration is often done by scanning special barcodes - look at the documentation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.