[Ilugc] Access barcode scanner data using ttyUSB0

  • From: vkslist@xxxxxxxxx (-)
  • Date: Mon Sep 28 17:43:39 2009

Hello,

I'm trying to access barcodes scanned and saved in a scanner's flash
memory. The scanner, Opticon's OPN 2001, connects via a USB cable
(which rather niftily also charges its battery), but the interface is
actually serial rather than "native" USB. Opticon scanners seem to be
supported as of Linux kernel 2.6.29
(http://kernelnewbies.org/Linux_2_6_29) , as in the usbserial module
is loaded and prints:

[? 196.495094] USB Serial support registered for opticon
[? 196.495135] opticon 4-1:1.0: opticon converter detected
[? 196.495529] usb 4-1: opticon converter now attached to ttyUSB0
[? 196.495557] usbcore: registered new interface driver opticon

lsusb gives:

Bus 004 Device 002: ID 065a:0009 Optoelectronics Co., Ltd

How do I access the scanned data? Presumably, an application has to
use /dev/ttyUSB0 to do so. Are there generic Linux apps. which will do
so?
Googling has not yielded results beyond the kernel version. As I have
only used the serial port for modems, I'm unsure how to proceed.

Regards,
Sameer

PS: Additional details for the embedded experts:

lsusb -vv:

Bus 004 Device 002: ID 065a:0009 Optoelectronics Co., Ltd
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x065a Optoelectronics Co., Ltd
  idProduct          0x0009
  bcdDevice            9.00
  iManufacturer           1 Optoelectronics Co., Ltd.
  iProduct                2 Barcode Device
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Status:     0x0000
  (Bus Powered)

In MS Windows, the Opticon driver has to be configured to point to one
of COM1-3. 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.).

Other related posts: