usb4java:无法提交控制消息:输入/输出错误

时间:2018-06-16 17:16:22

标签: java usb usb4java

我正在尝试复制以下使用Wireshark捕获的URB_CONTROL数据包:

0000   80 87 11 fe f2 8a ff ff 53 02 00 02 03 00 00 00  ........S.......
0010   05 30 25 5b 00 00 00 00 1c 84 02 00 8d ff ff ff  .0%[............
0020   08 00 00 00 08 00 00 00 21 09 b3 02 02 00 08 00  ........!.......
0030   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0040   b3 23 00 00 00 00 00 00

但是,我得到一个例外:

Exception in thread "main" javax.usb.UsbPlatformException: USB error 1: Unable to submit control message: Input/Output Error
    at org.usb4java.javax.ExceptionUtils.createPlatformException(ExceptionUtils.java:39)
    at org.usb4java.javax.AbstractIrpQueue.processControlIrp(AbstractIrpQueue.java:229)
    at org.usb4java.javax.ControlIrpQueue.processIrp(ControlIrpQueue.java:41)
    at org.usb4java.javax.ControlIrpQueue.processIrp(ControlIrpQueue.java:18)
    at org.usb4java.javax.AbstractIrpQueue.process(AbstractIrpQueue.java:104)
    at org.usb4java.javax.AbstractIrpQueue$1.run(AbstractIrpQueue.java:73)
    at java.base/java.lang.Thread.run(Thread.java:844)

我正在使用以下Java代码:

UsbDevice mouse = findDevice(UsbHostManager.getUsbServices().getRootUsbHub(), (short) 0x1EA7, (short) 0x002d);
mouse.getActiveUsbConfiguration().getUsbInterface((byte) 1).claim(new UsbInterfacePolicy() {
    public boolean forceClaim(UsbInterface usbInterface) {
        return true;
    }
});
UsbControlIrp irp = mouse.createUsbControlIrp((byte) 0x21, (byte) 9, (short) 0x02b3, (short) 0x0002);
irp.setData(new byte[] {(byte) 0xb3, 0x20, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00});
// Exception happens in statement under here.
mouse.syncSubmit(irp);

知道可能导致什么吗?我在线搜索但没有结果。

0 个答案:

没有答案