我正在学习 libusbjava库中的本教程。但是,当我尝试运行它时,它会引发以下错误。
ch.ntb.usb.USBException: No USB endpoints found. Check the device configuration
这是程序的相关部分
public static void testDevice(){
//Vendor ID, Product ID
Device dev = USB.getDevice((short) 0x0bda, (short) 0x2838);
try{
//Data to write to device
byte[] data = new byte[]{0,1,2,3};
//Data to read from device
byte[] readData = new byte[data.length];
dev.open(1, 0, -1);
dev.writeInterrupt(0x81, data, data.length, 2000, false);
dev.readBulk(0x81, readData, readData.length, 2000, false);
logData(readData);
dev.close();
}
catch(USBException e){
e.printStackTrace();
}
}
这是来自 USB 视图的设备信息
Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0BDA
idProduct: 0x2838
bcdDevice: 0x0100
iManufacturer: 0x01
iProduct: 0x02
iSerialNumber: 0x03
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x02
Open Pipes: 1
Endpoint Descriptor:
bEndpointAddress: 0x81
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00