[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: USB Keyboard-Wedge Barcode Reader



Dave Matlock wrote:
> 
> I need to connect a USB barcode reader to the devboard82.  In turn, I need to get data from the barcode reader and process it in an application I am writing.  However, I believe I will have a problem because, even if I complile in full HID support and get the barcode reader acting as a keyboard, the data wont appear anywhere because I don't have a console running (I disable the COM1 console).  Is this true?
> 
> If this is true, I need to somehow get the data from the reader and turn it into serial data so my application can access it.  Maybe my ignorance will show here, but it seems I will need to write a usb device driver that almost merges the HID keyboard driver with the USB-serial driver.
> 
> Does anyone have any advice? I'm running out of time quickly.
> 
> Thanks,
> Dave
> 

You should have a look at linux/Documentation/input/input.txt .
Read the section about keybddev.c
It should be quite simple to modify linux/drivers/input/keybdev.c to
your needs:  handle_scancode(...) is used to report the key event to the
kernel. Add a function like handle_barcodekey(...) which is called in
addition.
Of course you have to write your own module (lets call it "keyb_spy")
which
provides the handle_scancode() function. 
"keyb_spy" could act as a device driver for a new character device, for
example
/dev/keyb_spy. 
( See the "How to write device drivers" paper from axis or the general
linux HOWTOs on 
device driver programming)
Your device driver keyb_spy should buffer the catched keys. Your
application
opens /dev/keyb_spy and reads the barcodes.

Perhaps there is a much simpler approach, but in case you decide to go
this suggested
way and succeed, I would like to get the code from you, please. Perhaps
I have
need for it in future.
 
Norbert Matzke                                                #
Geo++ GmbH, Steinriede 8, D-30827 Garbsen, Germany            ###
phone +49-(0)5131-4689-0, fax +49-(0)5131-4689-99             #####
email mailto:norbert.matzke@xxxxxxx.de, web http://www.geopp.de #######