Bulk transfer failed with Input/Ouput error (Windows 10)
Environment:
- OS: Windows 10
- Java version Oracle Java 8
- usb4java version 1.3.0
Bug description If I am using Linux to run the example program (see below), the program runs fine. However using Windows 10, the program crashes with the error message "Input/Output Error" and if I debug LibUsb there is another error message: "libusb: error [hid_submit_bulk_transfer] HID transfer failed: [87] Falscher Parameter."
Full (debug) log:
[timestamp] [threadID] facility level [function call]
[ 0.020413] [0000041c] libusb: debug [libusb_get_device_list] [ 0.044660] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [54] [ 0.044800] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [55] [ 0.044925] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [56] [ 0.045059] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [57] [ 0.045190] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [58] [ 0.045607] [0000041c] libusb: debug [get_api_type] driver(s): BTHUSB [ 0.045709] [0000041c] libusb: debug [get_api_type] upper filter driver(s): BtFilter [ 0.045802] [0000041c] libusb: debug [get_api_type] lower filter driver(s): BtFilter [ 0.045820] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [6] [ 0.046687] [0000041c] libusb: debug [get_api_type] driver(s): usbccgp [ 0.046843] [0000041c] libusb: debug [get_api_type] matched driver name against Composite API [ 0.046862] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [3F] [ 0.047302] [0000041c] libusb: debug [get_api_type] driver(s): usbccgp [ 0.047399] [0000041c] libusb: debug [get_api_type] matched driver name against Composite API [ 0.047415] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [40] [ 0.047877] [0000041c] libusb: debug [get_api_type] driver(s): USBSTOR [ 0.047983] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [41] [ 0.048446] [0000041c] libusb: debug [get_api_type] driver(s): HidUsb [ 0.048556] [0000041c] libusb: debug [get_api_type] matched driver name against HID API [ 0.048574] [0000041c] libusb: debug [winusb_get_device_list] allocating new device for session [42] [ 0.049045] [0000041c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_1C2D&SUBSYS_11E71043&REV_05\3&11583659&0&D0' bus number 1 [ 0.049150] [0000041c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_1B73&DEV_1000&SUBSYS_10391043&REV_04\4&2880D07A&0&00E3' bus number 2 [ 0.049206] [0000041c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_1C26&SUBSYS_11E71043&REV_05\3&11583659&0&E8' bus number 3 [ 0.051180] [0000041c] libusb: debug [winusb_get_device_list] found existing device for session [42] [ 0.051331] [0000041c] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.052072] [0000041c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 34 bytes) [ 0.052272] [0000041c] libusb: debug [init_device] (bus: 3, addr: 4, depth: 2, port: 4): 'USB\VID_062A&PID_4102\6&266609EA&0&4' [ 0.052721] [0000041c] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB20\4&35A0A52F&0' [ 0.053289] [0000041c] libusb: debug [winusb_get_device_list] found existing device for session [40] [ 0.156226] [0000041c] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.156273] [0000041c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 751 bytes) [ 0.156293] [0000041c] libusb: debug [init_device] (bus: 1, addr: 3, depth: 2, port: 2): 'USB\VID_13D3&PID_5205\0X0001' [ 0.156499] [0000041c] libusb: debug [winusb_get_device_list] found existing device for session [58] [ 0.156607] [0000041c] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.156982] [0000041c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes) [ 0.157015] [0000041c] libusb: debug [init_device] (bus: 1, addr: 1, depth: 1, port: 1): 'USB\VID_8087&PID_0024\5&3CC85BD&0&1' [ 0.157185] [0000041c] libusb: debug [winusb_get_device_list] found existing device for session [6] [ 0.157280] [0000041c] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.158103] [0000041c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 177 bytes) [ 0.158138] [0000041c] libusb: debug [init_device] (bus: 1, addr: 2, depth: 2, port: 1): 'USB\VID_13D3&PID_3304\6&2826C32F&0&1' [ 0.158318] [0000041c] libusb: debug [winusb_get_device_list] found existing device for session [57] [ 0.158417] [0000041c] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.158854] [0000041c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes) [ 0.158888] [0000041c] libusb: debug [init_device] (bus: 3, addr: 1, depth: 1, port: 1): 'USB\VID_8087&PID_0024\5&F3AB4E3&0&1' [ 0.159113] [0000041c] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB_FL30\5&29ABF25F&0' [ 0.159348] [0000041c] libusb: debug [init_device] (bus: 3, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB20\4&12827F76&0' [ 0.159543] [0000041c] libusb: debug [winusb_get_device_list] found existing device for session [3F] [ 0.159641] [0000041c] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.160227] [0000041c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 64 bytes) [ 0.160259] [0000041c] libusb: debug [init_device] (bus: 3, addr: 2, depth: 2, port: 2): 'USB\VID_0694&PID_0005\00165347B1F3' [ 0.160266] [0000041c] libusb: debug [discovered_devs_append] need to increase capacity [ 0.160450] [0000041c] libusb: debug [winusb_get_device_list] found existing device for session [41] [ 0.160522] [0000041c] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.160724] [0000041c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 32 bytes) [ 0.161009] [0000041c] libusb: warning [init_device] could not get node connection information (V2) for device 'USB\VID_0781&PID_557D\4C530000151130103005': [50] Die Anforderung wird nicht unterstützt. [ 0.161034] [0000041c] libusb: debug [init_device] (bus: 2, addr: 1, depth: 1, port: 2): 'USB\VID_0781&PID_557D\4C530000151130103005' [ 0.162392] [0000041c] libusb: debug [winusb_get_device_list] setting HID interface for [42]: [ 0.162411] [0000041c] libusb: debug [set_hid_interface] interface[0] = \.\HID#VID_062A&PID_4102&COL01#7&284A185&1&0000#{4D1E55B2-F16F-11CF-88CB-001111000030} [ 0.162529] [0000041c] libusb: debug [winusb_get_device_list] setting composite interface for [3F]: [ 0.162540] [0000041c] libusb: debug [set_composite_interface] interface[0] = \.\HID#VID_0694&PID_0005&MI_00#8&33A33132&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030} [ 0.162586] [0000041c] libusb: debug [winusb_get_device_list] setting HID interface for [42]: [ 0.162596] [0000041c] libusb: debug [set_hid_interface] interface[1] = \.\HID#VID_062A&PID_4102&COL02#7&284A185&1&0001#{4D1E55B2-F16F-11CF-88CB-001111000030} [ 0.163351] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163383] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163392] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163400] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163405] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163410] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163416] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163421] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163427] [0000041c] libusb: debug [libusb_get_device_descriptor] [ 0.163433] [0000041c] libusb: debug [libusb_open] open 3.2 [ 0.163690] [0000041c] libusb: debug [hid_open] set maximum input buffer size to 512 [ 0.163730] [0000041c] libusb: debug [hid_open] 1 HID input report value(s) found [ 0.163740] [0000041c] libusb: debug [hid_open] Report ID: 0x00 [ 0.163748] [0000041c] libusb: debug [hid_open] 1 HID output report value(s) found [ 0.163756] [0000041c] libusb: debug [hid_open] Report ID: 0x00 [ 0.163762] [0000041c] libusb: debug [hid_open] 0 HID feature report value(s) found [ 0.164698] [0000041c] libusb: debug [libusb_unref_device] destroy device 3.4 [ 0.164738] [0000041c] libusb: debug [libusb_unref_device] destroy device 1.3 [ 0.164746] [0000041c] libusb: debug [libusb_unref_device] destroy device 1.2 [ 0.164750] [0000041c] libusb: debug [libusb_unref_device] destroy device 1.1 [ 0.164754] [0000041c] libusb: debug [libusb_unref_device] destroy device 1.0 [ 0.164762] [0000041c] libusb: debug [libusb_unref_device] destroy device 2.1 [ 0.164766] [0000041c] libusb: debug [libusb_unref_device] destroy device 2.0 [ 0.165779] [0000041c] libusb: debug [libusb_kernel_driver_active] interface 0 [ 0.165858] [0000041c] libusb: debug [libusb_claim_interface] interface 0 [ 0.165871] [0000041c] libusb: debug [hid_claim_interface] claimed interface 0 [ 0.165897] [0000041c] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0 [ 0.165907] [0000041c] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 01 to interface 0 [ 0.167606] [0000041c] libusb: debug [libusb_alloc_transfer] transfer 0000000001416408 [ 0.167644] [0000041c] libusb: debug [libusb_submit_transfer] transfer 0000000001416408 [ 0.167838] [0000041c] libusb: debug [usbi_add_pollfd] add fd 2 events 4 [ 0.167850] [0000041c] libusb: debug [hid_submit_bulk_transfer] matched endpoint 01 with interface 0 [ 0.167856] [0000041c] libusb: debug [hid_submit_bulk_transfer] writing 12 bytes (report ID: 0x00) [ 0.167900] [0000041c] libusb: error [hid_submit_bulk_transfer] HID transfer failed: [87] Falscher Parameter. [ 0.167906] [0000041c] libusb: debug [usbi_remove_pollfd] remove fd 2 [ 0.167913] [0000041c] libusb: debug [libusb_free_transfer] transfer 0000000001416408 Exception in thread "main" org.usb4java.LibUsbException: USB error 1: bulk transfer (out) failed: Input/Output Error start bulk transfer (out) at Main.main(Main.java:46)
Reproduction private static byte[] payload = { 9, 0, 1, 0, 0, 13, 0, -45, 13, 13, 96 };
public static void main(String[] args) {
Context usbContext = new Context();
int result = LibUsb.init(usbContext);
if (result != LibUsb.SUCCESS)
throw new LibUsbException("init failed", result);
result = LibUsb.setOption(usbContext, LibUsb.OPTION_LOG_LEVEL, LibUsb.LOG_LEVEL_DEBUG);
if (result != LibUsb.SUCCESS)
throw new LibUsbException("failed to set log level", result);
DeviceHandle handle = LibUsb.openDeviceWithVidPid(usbContext, (short) 0x0694, (short) 0x0005);
if (handle == null) {
System.out.println("device not found");
System.exit(-1);
}
if (LibUsb.kernelDriverActive(handle, 0) == 1) {
System.out.println("enabling auto detach for kernel driver");
result = LibUsb.setAutoDetachKernelDriver(handle, true);
if (result != LibUsb.SUCCESS)
throw new LibUsbException("failed to enable auto detach for kernel driver", result);
}
result = LibUsb.claimInterface(handle, 0);
if (result != LibUsb.SUCCESS)
throw new LibUsbException("failed to claim interface", result);
// write
System.out.println("start bulk transfer (out)");
ByteBuffer buffer = BufferUtils.allocateByteBuffer(payload.length);
buffer.put(payload);
IntBuffer transferred = BufferUtils.allocateIntBuffer();
result = LibUsb.bulkTransfer(handle, (byte) 0x01, buffer, transferred, 1000);
if (result != LibUsb.SUCCESS)
throw new LibUsbException("bulk transfer (out) failed", result);
// read
ByteBuffer buffer2 = BufferUtils.allocateByteBuffer(1024);
IntBuffer transferred2 = BufferUtils.allocateIntBuffer();
result = LibUsb.bulkTransfer(handle, (byte) 0x81, buffer2, transferred2, 1000);
if (result != LibUsb.SUCCESS)
throw new LibUsbException("bulk transfer (in) failed", result);
result = LibUsb.releaseInterface(handle, 0);
if (result != LibUsb.SUCCESS)
throw new LibUsbException("failed to release interface", result);
LibUsb.close(handle);
LibUsb.exit(usbContext);
}
Expected behavior Program finishes without any error message.