[Wlug] Seeking help with a USB barcode scanner
Jamie Guinan
guinan at bluebutton.com
Sat Mar 31 12:59:15 EDT 2007
On Fri, 30 Mar 2007, Andy Stewart wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> HI everybody,
>
> Does anybody in the group have any experience using a USB barcode
> scanner with Linux? Its tough to google for "barcode scanner" since
> each term brings up its own set of things which aren't what I seek.
>
> In particular, I have been loaned a USB barcode scanner which is made by
> PSC, Inc. with model number QS2500. When I plug it into my laptop, the
> USB vendor and device IDs are 04B4:0101. I looked this up on the Linux
> USB devices website and it has multiple references (mostly to USB
> keyboards).
>
> I think this device is being handled as a USB HID device, but I'm not
> certain.
Hi Andy,
See if "evdev" is loaded, then try reading the various
/dev/input/event* nodes.
I have a USB keyboard here. Oh neat, under 2.6.19, they even give you
a path that matches the device ids,
# od -x /dev/input/by-id/usb-1241_1203-event-kbd
(tap tap tap...)
0000000 92a9 460e 0000 0000 36dc 000b 0000 0000
0000020 0001 001c 0000 0000 92a9 460e 0000 0000
0000040 36e0 000b 0000 0000 0000 0000 0000 0000
...
C code,
#include <linux/input.h>
int keyboardFd = open(kbdev, O_RDWR);
struct input_event ev;
int n = read(keyboardFd, &ev, sizeof(ev));
See the fields in ev, you'll get events for press/release,
keycode, etc.
Have fun!
-Jamie
>
> I'm wondering if Linux has any software that would read the value from a
> barcode scanner and do something with it. If I knew which device file
> was used, maybe I could "cat <devfile>" and see some output when I
> scanned a barcode.
>
> Note that there are several examples of software for printing barcodes,
> but that's not what I need (at least not yet).
>
> Any help would be appreciated.
>
> Thanks!
>
> Andy
>
> - --
> Andy Stewart, Founder
> Worcester Linux Users' Group (http://www.wlug.org)
> Chelmsford Linux Meetup Group (http://linux.meetup.com/393)
> Amateur Radio: KB1OIQ
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
>
> iD8DBQFGDcRgHl0iXDssISsRAjF2AJ98hr6d4i2EMSQ5AvAWiiyfPLHdWACeLSm+
> uCN6IcuTTYvDZbz44z+t4I4=
> =gdbi
> -----END PGP SIGNATURE-----
> _______________________________________________
> Wlug mailing list
> Wlug at mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
More information about the Wlug
mailing list