使用libusb操作usb的问题

时间:2021-08-10 16:13:39
本人有一个usb,有驱动,但是不能加载到系统.我用libusb操作它,但是写的时候和读的时候总是出现Resource temporarily unavailable.
write ret =4,Resource temporarily unavailable//写入1234
usb_interrupt_read=-110,Resource temporarily unavailable,
write ret =0,Success
usb_interrupt_read=4,Resource temporarily unavailable,1234//读出1234
write ret =4,Resource temporarily unavailable
usb_interrupt_read=-110,Resource temporarily unavailable,1234
write ret =0,Success
usb_interrupt_read=4,Resource temporarily unavailable,1234
//----------------------------------------------------//
设备描述文件如下:
Bus 001 Device 002: ID 04b5:0320 ROHM LSI Systems USA, LLC 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x04b5 ROHM LSI Systems USA, LLC
  idProduct          0x0320 
  bcdDevice            3.00
  iManufacturer           1 CPU.DOG
  iProduct                2 USB HID Security Key
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Devices
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      38
          Report Descriptor: (length is 38)
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x46 ] 70
                            Vector
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Count, data= [ 0x04 ] 4
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Usage Page, data= [ 0x08 ] 8
                            LEDs
            Item(Local ): Usage, data= [ 0x2d ] 45
                            Ready
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Count, data= [ 0x07 ] 7
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Main  ): Output, data= [ 0x00 ] 0
                            Data Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0004  bytes 4 once
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0008  bytes 8 once
        bInterval              10
  Language IDs: (length=4)
     0409 English(US)

3 个解决方案

#1


能帮帮我吗?我给一千元.

#2


真的给钱. 不是骗人.现在很需要帮助

#3


一个问题问了这么久没有人回答,真的郁闷!csdn也就这样嘛

#1


能帮帮我吗?我给一千元.

#2


真的给钱. 不是骗人.现在很需要帮助

#3


一个问题问了这么久没有人回答,真的郁闷!csdn也就这样嘛