Skip Menu |

This queue is for tickets about the Linux-USBKeyboard CPAN distribution.

Report information
The Basics
Id: 39089
Status: open
Priority: 0/
Queue: Linux-USBKeyboard

People
Owner: Nobody in particular
Requestors: e [...] lefant.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.02
Fixed in: (no value)



Subject: no output for 080c:0300 Datalogic S.p.A. Gryphon D120 Barcode Scanner when normal keyboard works fine
hi, i am trying to use Linux::USBKeyboard with Datalogic S.p.A. Gryphon D120 Barcode Scanner. output from "lsusb": Bus 002 Device 018: ID 080c:0300 Datalogic S.p.A. Gryphon D120 Barcode Scanner installed like: sudo aptitude install libusb-dev cpanp -i Linux::USBKeyboard reading barcodes into a text editor works just fine. however running the echo_chars.pl example (as root, just in case) produces no output: sudo perl echo_chars.pl '080c:0300' for reference, with the normal keyboard it works fine (running like): sudo perl echo_chars.pl '413c:2101' i also tried running with strace: sudo strace -o /tmp/usb2.log -f /home/lefant/.cpanplus/5.10.0/build/Linux-USBKeyboard-0.02/examples/echo_chars.pl '080c:0300' (output attached) looks like it is somehow unable to access the usb interface. however, i am not a C programmer. do you have any suggestions on what to try next? thanks, fabian $ uname -a Linux delefant 2.6.26-1-amd64 #1 SMP Wed Aug 20 12:09:32 UTC 2008 x86_64 GNU/Linux $ perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.25-2-amd64, archname=x86_64-linux uname='linux delefant 2.6.25-2-amd64 #1 smp mon jul 14 11:05:23 utc 2008 x86_64 gnulinux ' config_args='-Dprefix=/opt/perl5.10 -Duse64bitint -des -Accflags=-fPIC' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fPIC -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fPIC -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.3.1', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.7.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.7' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO Built under linux Compiled at Aug 4 2008 18:35:45 @INC: /opt/perl5.10/lib/5.10.0/x86_64-linux /opt/perl5.10/lib/5.10.0 /opt/perl5.10/lib/site_perl/5.10.0/x86_64-linux /opt/perl5.10/lib/site_perl/5.10.0 .
Subject: usb2.log

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #39089] no output for 080c:0300 Datalogic S.p.A. Gryphon D120 Barcode Scanner when normal keyboard works fine
Date: Mon, 8 Sep 2008 12:47:42 -0700
To: bug-Linux-USBKeyboard [...] rt.cpan.org
From: Eric Wilhelm <scratchcomputing [...] gmail.com>
Hi Fabian, Show quoted text
>Bus 002 Device 018: ID 080c:0300 Datalogic ... >for reference, with the normal keyboard it works fine ... > >i also tried running with strace:
The strace output does not show an attempt to open /dev/bus/usb/002/018, so that is helpful information, but I'm not sure what to advise. Perhaps try the version 0.01 (which used the libhid finder loop.) If that works, then my finder loop has a bug. I would love to have a feature which opens the device directly via a bus address (or symlink even) rather than the vendor/product id pair. Perhaps you can hardcode your device address in the C code and see if that works? Aside: you don't need to run as root if you the device group with udev. Thanks, Eric
hi, On Mon Sep 08 15:48:25 2008, scratchcomputing@gmail.com wrote: Show quoted text
> The strace output does not show an attempt to open /dev/bus/usb/002/018, > so that is helpful information, but I'm not sure what to advise. > > Perhaps try the version 0.01 (which used the libhid finder loop.) If > that works, then my finder loop has a bug.
i did that, but it doesn't help at all Show quoted text
> I would love to have a feature which opens the device directly via a bus > address (or symlink even) rather than the vendor/product id pair. > Perhaps you can hardcode your device address in the C code and see if > that works?
the problem with that is that i wouldn't know how to get a valid usb_device struct. i noted something however. running echo_keys.pl instead of echo_chars.pl immediately returns with an error. also it shows it seems to get a handle (i enabled some of the commented out debug info in the c code): $ sudo strace -o /tmp/usb.log -f perl examples/echo_keys.pl '0x080c' '0x0300' getting 2060, 768 trying device 17190240 trying device 17194432 trying device 17198624 trying device 17202816 trying device 17207008 device match, 17207008 got handle 14902192 handle is 14902192 at lib/Linux/USBKeyboard.pm line 356. - you might have the wrong permissions or address at examples/echo_keys.pl line 23. (output of strace attached again). if you have further ideas, i'd be happy to explore. thanks for your hints so far. for the moment i will start out with launching a script from inittab at boot time and just read keyboard input from there, but i would still be interested to get this working. kind regards, fabian

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #39089] no output for 080c:0300 Datalogic S.p.A. Gryphon D120 Barcode Scanner when normal keyboard works fine
Date: Tue, 9 Sep 2008 03:00:54 -0700
To: bug-Linux-USBKeyboard [...] rt.cpan.org
From: Eric Wilhelm <scratchcomputing [...] gmail.com>
# from http://fabian.linzberger.net/ via RT # on Tuesday 09 September 2008 02:00: Show quoted text
>$ sudo strace -o /tmp/usb.log -f perl examples/echo_keys.pl '0x080c' >'0x0300' >getting 2060, 768 >trying device 17190240 >trying device 17194432 >trying device 17198624 >trying device 17202816 >trying device 17207008 >device match, 17207008 >got handle 14902192 >handle is 14902192 at lib/Linux/USBKeyboard.pm line 356. > - you might have the wrong permissions or address at >examples/echo_keys.pl line 23. > >(output of strace attached again).
Hi fabian, That error message looks like you just need to uncomment the croak() in the _keycode() method in the C code. But honestly I don't know how the subprocess managed to throw an error into the parent? You would be much better off to stick to diagnosing via echo_chars.pl (or simply calling Linux::USBKeyboard->new()) because the key-wise reader forks at the piped open(). The strace output is only useful if I know the device filename (.../usb/002/022?) from lsusb. If you've replugged it, that might be the device. For further debugging, read /usr/include/usb.h and you'll see that the usb_bus and usb_device structs have a "filename", which you can see with fprintf like this: for(device = bus->devices; device; device = device->next) { fprintf(stderr, "check device /dev/bus/usb/%s/%s\n", bus->dirname, device->filename); Thanks, Eric -- --------------------------------------------------- http://scratchcomputing.com ---------------------------------------------------
From: harald [...] lefant.net
Hi, I found the cause of the problem: Your code has hard coded the endpoint 0x81, but the Datalogic S.p.A. Gryphon D120 Barcode Scanner uses the endpoint 0x82 (can be found out via lsusb -v). I changed the values and now it works. Adding code to query the device for used endpoints and handling errors better might be quite some work. Is there a reason why you implement a usb driver in userspace instead of having the kernel doing the dirty work and just getting the data from /dev/input/event* directly? (I think writting a parser for input events might be done from perl directly.) Hope this information is helpful. Harald
hi, On Wed Sep 17 21:37:33 2008, HaraldG wrote: Show quoted text
> Hi, I found the cause of the problem: Your code has hard coded the > endpoint 0x81, but the Datalogic S.p.A. Gryphon D120 Barcode Scanner > uses the endpoint 0x82 (can be found out via lsusb -v). > > I changed the values and now it works. > > Adding code to query the device for used endpoints and handling > errors better might be quite some work. Is there a reason why you > implement a usb driver in userspace instead of having the kernel > doing the dirty work and just getting the data from /dev/input/event* > directly? (I think writting a parser for input events might be done > from perl directly.)
e this information is helpful. Show quoted text
> Harald
thanks harald for finding the bug! anyway we are now taking the route of using input-utils and parsing the output from there. this even works well running openwrt on nslu2 embedded hardware. feel free to go ahead and close this issue. kind regards, fabian