LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-21-2011, 05:20 AM   #1
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 227

Rep: Reputation: 32
Libusb error claim device -6


Hello,

I am trying to read raw data from usb device with libusb but I have some problems.

Code:
int main(void)
{
	struct sigaction sigact;
	int r = 1;

	r = libusb_init(NULL);
	if (r < 0) {
		fprintf(stderr, "failed to initialise libusb\n");
		exit(1);
	}

        devh = libusb_open_device_with_vid_pid(NULL, 0x1403, 0x5001);

	r = libusb_claim_interface(devh, 0);
	if (r < 0) {
		fprintf(stderr, "usb_claim_interface error %d\n", r);
		goto out;
	}
......
Always, I have the same problem, "usb_claim_interface error -6", and I dont understand what is the reason.

Code:
Bus 002 Device 003: ID 1403:5001 Sitronix 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1403 Sitronix
  idProduct          0x5001 
  bcdDevice            0.01
  iManufacturer           1 Sitronix Technology Corp., LTD.
  iProduct                2 ST9RM01 10P MultiTouch
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     619
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)
Any advice?. What is the reason that I can not claim interface 0?

Best regards
John Martin

Last edited by webquinty; 06-21-2011 at 05:34 AM.
 
Old 06-21-2011, 12:14 PM   #2
tlowk
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Slackware
Posts: 184

Rep: Reputation: 36
My guess is that it is some kind of mouse and as such claimed by a mouse driver, but maybe it
is possible to deattach it from the mouse driver with this function from this library

int libusb_detach_kernel_driver ( libusb_device_handle *dev,int interface)
 
Old 06-22-2011, 02:55 AM   #3
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 227

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by tlowk View Post
My guess is that it is some kind of mouse and as such claimed by a mouse driver, but maybe it
is possible to deattach it from the mouse driver with this function from this library

int libusb_detach_kernel_driver ( libusb_device_handle *dev,int interface)
Wonderful tlowk,

After apply libusb_detach_kernel_driver(), I can claim device without problems and more important, I can read rad data from usb device.

Best regards
John Martin.
 
  


Reply



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
Libusb on USB 3.0 Device and kernel 2.6.39-rc3 Equinn Programming 4 04-27-2011 11:30 AM
libusb for homemade device Rusttree Linux - Kernel 2 09-17-2010 01:51 AM
USB device driver notification using libusb v0.1 API marioatallah Linux - Hardware 1 01-19-2010 03:26 AM
device file for scanner with libusb fredgt Linux - Hardware 0 04-08-2004 10:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:18 AM.

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
Open Source Consulting | Domain Registration