我在libusbjava庫下面this教程。但是,當我嘗試運行它時,會引發以下錯誤。與USB加密狗通訊,沒有發現USB端點錯誤
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
接口描述符如何? –
我不知道從哪裏得到這些信息。我可以通過USB View訪問它嗎? – Wnt2bsleepin