LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 10-12-2008, 10:17 PM   #1
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Need to get control of an usb bar code scanner recognized as a usb keyboard


Hi Ladies and Gentlemen,

I have an usb bar code reader which emulates an standard usb keyboard. The kernel recognizes it on the boot-up and all the data from it is merged with the data from the keyboard.

I'm trying to write an application in user land using libusb to talk with this device but I can't obtain access because the device is already in use by the console.

Does anybody knows a way to prevent the kernel to configure this device, leaving it to an application?

My system is a Fedora 8 running kernel 2.6.26.5-28.fc8.

Thanks in advance.

Osvaldo.
 
Old 10-14-2008, 06:55 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Use "lsusb" (you may need to install it) to get information on the device, them use that information to prevent the device from being claimed by a driver. Why is it being recognized as a keyboard - does it advertise USB HID capabilities?
 
Old 10-14-2008, 01:25 PM   #3
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Original Poster
Rep: Reputation: 34
Hi Pinniped,

Thank you for answer me! First of all, as I am using fedora 8, I already have lsusb tool installed and I could identify the usb device. The problem is this device is recognized as a HID during the kernel booting, ages before udev read its rules, where I guess I could prevent it to be installed as a keyboard.

Below there is a portion of 'dmesg' messages during boot showing the identification:
Code:
ACPI: PCI Interrupt 0000:00:1f.2[B] -> GSI 19 (level, low) -> IRQ 19
PCI: Setting latency timer of device 0000:00:1f.2 to 64
ACPI: PCI interrupt for device 0000:00:1f.2 disabled
usb 4-1: configuration #1 chosen from 1 choice
input: Hand Held Products 3800G as /class/input/input2
input,hidraw0: USB HID v1.10 Keyboard [Hand Held Products 3800G] on usb-0000:00:1d.2-1
hiddev96hidraw1: USB HID v1.10 Device [Hand Held Products 3800G] on usb-0000:00:1d.2-1
usb 4-1: New USB device found, idVendor=0536, idProduct=02e1
usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=8
usb 4-1: Product: 3800G
usb 4-1: Manufacturer: Hand Held Products
usb 4-1: SerialNumber: 08145D112D
ata_piix 0000:00:1f.2: version 2.12
ACPI: PCI Interrupt 0000:00:1f.2[B] -> GSI 19 (level, low) -> IRQ 19
ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
PCI: Setting latency timer of device 0000:00:1f.2 to 64
Today I tried to boot with "nousb" kernel parameter and it didn't enable the device. However, I can't modprobe any usb modules after this boot.

I would like to prevent this device from being attached to normal HID input without kernel recompilation because, to maintain any non standard patch is a burden for the years to come.
 
Old 10-15-2008, 03:12 AM   #4
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
I don't know if there is an easier way (I haven't done it and I have no time to investigate), but here is a hint on how to do it by hacking the kernel:

http://wiki.nonpolynomial.com/Lightstone

Basically, you can add the VendorID:ProductID information to the internal HID Blacklist. Of course if there is a method for adding such information at run-time, that would be much better.

The article also mentions taking control via "libhid" (a userspace HID library).

Last edited by pinniped; 10-15-2008 at 03:16 AM.
 
Old 10-15-2008, 03:24 AM   #5
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Original Poster
Rep: Reputation: 34
Thank you, Pinniped,

I'll research your hint this morning and I will report the findings.

Again, thank you!

Osvaldo.
 
Old 11-23-2008, 12:15 AM   #6
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Original Poster
Rep: Reputation: 34
Hi people,

After a while, I came back to this project, and following your directions, I found this libhid-discuss thread where Brice Rebsamen has the same problem and after discover the solution, he posted an example for another bar code scanner.

Based on this example, I could detach the scanner to be used on my application.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
redirecting the output of a USB barcode scanner (= USB keyboard) bricedebrignaisplage Programming 1 06-10-2009 08:26 PM
USB keyboard and printer not recognized c4onastick Slackware 19 09-01-2006 12:27 PM
USB scanner or printer worked with kernel 2.6.7 but not recognized with 2.6.8.1 and a postb99 Linux - Hardware 0 03-05-2005 01:21 PM
HP OJ-G55 Printer/Scanner USB not recognized by Fedora FC2 linuxnewbie24 Linux - Hardware 2 08-31-2004 02:50 PM
USB Bar Code Scanner... How To!?? FreakboY Mandriva 0 05-06-2004 03:30 AM


All times are GMT -5. The time now is 01:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration