[Ilugc] Re: Access barcode scanner data using ttyUSB0

  • From: vkslist@xxxxxxxxx (VK Sameer)
  • Date: Mon Sep 28 21:53:48 2009

Girish Venkatachalam <girishvenkatachalam@...> writes:

On Mon, Sep 28, 2009 at 5:43 PM, - <vkslist@...> wrote:

I have never done what you are trying to do but I have heard numerous
times that barcode readers simply emulate a keyboard and spit out
keyboard sequences very much like a serial device on USB...

Yes, I have a different, "true", USB tethered barcode reader that
works out of the box with no issues.

[  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

If you have got so far then wouldn't it work?

Nope, nothing shows up from /dev/ttyUSB0 when I scan a barcode. And probably
nothing should, either, this is an untethered device. The USB connection is
for syncing data/config/power only.

Did you see the sources of the opticon driver?

Yes (http://lxr.free-electrons.com/source/drivers/usb/serial/opticon.c),
but without any insight into kernel modules, I've no idea how to access the
functions.

lsusb gives:

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

Grep for this device ID and vendor ID combo in your linux kernel tree.

To find the module source? See above.

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?

The driver is attached, so you would have to test using /dev/event*
interface or some such for testing.

Hrm, any pointers using userspace apps? I'd prefer not to get into C
coding if possible.

A generic serial communication program like minicom or cu should be
able to communicate with your barcode reader.

OK, will check them out. I was hoping there might be some variant of
USB high-level "commands", a-la the AT Hayes commands.

Just point the serial port device to /dev/ttyUSB0. I am applying
logic here. Never been there, never done that...

I have done my best. Let better hackers help you.

Best of luck.

-Girish

Thanks for the helpful suggestions.

This name should have been in your e-mail ID but well.

Should be there now. Some weirdness with naming on linking 2 GMail
addresses to the same Google account. Or I didn't look
into it closely enough :)

Regards,
Sameer

PS: Apologies for messing up your email client threading by replying
to my own email, but the GMane captcha is broken, which prevents
posting, and the digest hasn't shown up till now.

Other related posts: