我正在尝试将程序从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));
目前我已经尝试
int nread;
struct libusb_transfer *xfr;
xfr = libusb_alloc_transfer(0);
libusb_fill_bulk_transfer(xfr, devh, endp, samples,size, callbackUSB, &nread, timeout);
if(libusb_submit_transfer(xfr) < 0){
libusb_free_transfer(xfr);
}
return sizeof(samples)*8;
和
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
正在等待法律部门更改VID / PID,但在过去22年中,它一直以ffff:ffff
起作用RHEL 7.3、7.6,Ubuntu 18上存在相同错误。
关于如何解决简单的pURB错误的任何建议?
答案 0 :(得分:1)
bMaxPacketSize0 64
我相信是问题所在。看来我正在尝试将1024x4塞入传输中。调整好并使用端点0x81
后,它似乎可以正常工作。
进入下一个错误...