[Ilugc] Access barcode scanner data using ttyUSB0

  • From: shakthimaan@xxxxxxxxx (Shakthi Kannan)
  • Date: Tue Sep 29 11:15:33 2009

Hi,

--- On Mon, Sep 28, 2009 at 5:43 PM, - <vkslist@xxxxxxxxx> wrote:
| I'm trying to access barcodes scanned and saved in a scanner's flash
| memory.
|
| but the interface is
| actually serial rather than "native" USB.
\--

What are you referring to as "native" here?

---
| [? 196.495529] usb 4-1: opticon converter now attached to ttyUSB0
\--

Yes, a serial interface.

---
| Device Descriptor:
| ?bNumConfigurations ? ? ?1
| ?Configuration Descriptor:
| ...
\--

The device exports one configuration.

---
| ? ?bNumInterfaces ? ? ? ? ?1
| ? ?Interface Descriptor:
| ...
\--

That has one interface.

---
| ? ? ?Endpoint Descriptor:
| ? ? ? ?bEndpointAddress ? ? 0x81 ?EP 1 IN
| ? ? ? ? ?Transfer Type ? ? ? ? ? ?Bulk
| ? ? ? ? ?Synch Type ? ? ? ? ? ? ? None
| ? ? ? ? ?Usage Type ? ? ? ? ? ? ? Data
| ? ? ? ?wMaxPacketSize ? ? 0x0040 ?1x 64 bytes
| ? ? ? ?bInterval ? ? ? ? ? ? ? 5
\--

And one Bulk IN data transfer endpoint. So, if you send BULK IN
requests from the USB host system, you will receive data from the
scanner.

---
| In MS Windows, the Opticon driver has to be configured to point to one
| of COM1-3.
\--

In your case, it is /dev/ttyUSB0 as seen from the output.

---
| It then slurps the data into a default file containing the
| barcode, the type of barcode format, and a timestamp. There is also a
| settings option to configure the scanner (turn off timestamps, e.g.).
\--

You can use libusb library to send specific requests to the device and
read the responses.
http://www.libusb.org/

Also refer their developers' guide:
http://libusb.sourceforge.net/doc/function.usbbulkread.html

If you have a USB (hardware) analyzer, you can capture the USB packets
for this particular endpoint, or you can use the one (software)
provided with the Linux kernel.

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com

Other related posts: