简体   繁体   中英

Usb4Java: Pipe Error (-9)

I want to send a single package to an USB device (Arduino controller) using Usb4Java's Low-Level API but I receive following error:

 org.usb4java.LibUsbException: USB error 9: Pipe error

Here is the code for the critical part:

            ByteBuffer buffer = ByteBuffer.allocateDirect(8);
            buffer.put(new byte[] {'a', 'b', 'c'});
            int transfered = LibUsb.controlTransfer(handle,
                    (byte) (LibUsb.REQUEST_TYPE_CLASS | LibUsb.RECIPIENT_INTERFACE),
                    (byte) 0x09,
                    (short) 256,
                    (short) 0,
                    buffer,
                    1000);
            System.out.println(transfered);
            if (transfered < 0){
                throw new LibUsbException("Control transfer failed", transfered);

I think it could be driver-related or related to the parameters of LibUsb.controlTransfer(...); Maybe it's worth mentioning:The source machine is running Windows 7.

The libusb API says following about errors in control transfer:

"LIBUSB_ERROR_PIPE if the control request was not supported by the device"

Looks like the control transfer you try to send is not supported. Maybe this is not what the controller expects as command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM