javaarduinolibusbusb4java

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.


Solution

  • 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.