Rajesh kumar <rkrajeshkumar87@...> writes:

> 
> How can i read a barcode using a C program.
> 
> I can able to read barcode manually in a gedit.  i Need to create a c
> program which reads the barcode device and write the data to a text file.
> 
> How this can be done.

Input devices like keyboard, mice, etc. go through the input subsystem. And the
USB barcode reader in this case seems to act like a keyboard, and hence also
goes through the input subsystem. 

Each of these input devices has a device file named /dev/input/eventN. When the
device file is read, key events are reported. See
http://www.thelinuxdaily.com/2010/05/grab-raw-keyboard-input-from-event-device-node-devinputevent/
for an example. 

You will have to identify which /dev/input/eventN corresponds to your barcode
reader. This can be obtained from sysfs. Alternatively, there are aliases to
these device files, that make it more obvious. The aliases are present in
/dev/input/by-id/ 

Regards,
Vijay

-- 
P: http://www.bravegnu.org/
C: http://www.zilogic.com/

_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to