Linux LIBUSB批量传输,第一个URB失败,容易实现

Linux LIBUSB批量传输,第一个URB失败,容易实现,linux,libusb,libusb-1.0,Linux,Libusb,Libusb 1.0,我正在尝试将一个程序从USB 0.1.4更新到LIBUSB,到目前为止,除了以下内容外,所有内容都正常工作: //endp = 0x01 or 0x81 both return the same error //static unsigned char samples[8*400]; //size=(samplelength*numberofDevices)<<1; return(usb_bulk_read(devh,endp,samples,size,timeout

我正在尝试将一个程序从USB 0.1.4更新到LIBUSB,到目前为止,除了以下内容外,所有内容都正常工作:

  //endp = 0x01 or 0x81 both return the same error
  //static unsigned char samples[8*400];
  //size=(samplelength*numberofDevices)<<1;
  return(usb_bulk_read(devh,endp,samples,size,timeout));
有关设备:

Bus 001 Device 012: ID ffff:ffff
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0xffff
  idProduct          0xffff
  bcdDevice            1.00
  iManufacturer           0
  iProduct                0
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0001
  Self Powered
等待法律部门更改VID/PID,但在过去22年中,它一直作为ffff:ffff工作

RHEL7.3、7.6和Ubuntu18上也出现了同样的错误


关于如何解释容易发生的peasy URB错误,有什么建议吗?

bmaxpacketsize064
我认为这就是问题所在。看来我是想把1024x4塞进传送带。一旦我调整了它并使用endpoint
0x81
,它似乎工作得很好

关于下一个bug

    int nread;
    int r = 0;
    r = libusb_bulk_transfer(devh, endp, samples,size, &nread, timeout);
    if(r <0){
      printf("libusb_bulk_transfer\n");
      printf("%s\n", libusb_error_name(r));
      exit(1);
    }

    return sizeof(samples)*8;
libusb: debug [libusb_submit_transfer] transfer 0x12fba50
libusb: debug [add_to_flying_list] arm timerfd for timeout in 100ms (first in line)
libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 1568
libusb: error [submit_bulk_transfer] submiturb failed error -1 errno=2
libusb: debug [submit_bulk_transfer] first URB failed, easy peasy
libusb: debug [disarm_timerfd]
libusb: debug [libusb_free_transfer] transfer 0x12fba50

Bus 001 Device 012: ID ffff:ffff
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0xffff
  idProduct          0xffff
  bcdDevice            1.00
  iManufacturer           0
  iProduct                0
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0001
  Self Powered