Menu

#53 MonoUsbDevice.ControlTransfer Returns PipeError (-9)

v2.2.8
open
nobody
None
5
2018-11-25
2018-11-25
No

I found a problem when running the usb .net lib in a .net core 2.2 apllication.
in plaform: Linux (Ubuntu 18 armhf)

when i run this same .net core application in Windows it works perfecty.

when using the function MonoUsbDevice.ControlTransfer it returns with Usberror.PipeError (-9).

I found also a solution for this problem:

in MonoUsbDevice.cs

public override bool ControlTransfer(ref UsbSetupPacket setupPacket, IntPtr buffer, int bufferLength, out int lengthTransferred)
{
Debug.WriteLine(GetType().Name + ".ControlTransfer() Before", "Libusb-1.0");
int ret = MonoUsbApi.ControlTransferAsync((MonoUsbDeviceHandle) mUsbHandle,
setupPacket.RequestType,
setupPacket.Request,
setupPacket.Value,
setupPacket.Index,
buffer,
(short) bufferLength,
UsbConstants.DEFAULT_TIMEOUT);

        Debug.WriteLine(GetType().Name + ".ControlTransfer() Error:" + ((MonoUsbError) ret).ToString(), "Libusb-1.0");
        if (ret < 0)
        {
            UsbError.Error(ErrorCode.MonoApiError, ret, "ControlTransfer Failed - " + ((MonoUsbError)ret).ToString(), this);
            lengthTransferred = 0;
            return false;
        }
        lengthTransferred = ret;
        return true;
    }

When I change:
MonoUsbApi.ControlTransferAsync
in to
MonoUsbApi.ControlTransfer

it Works!

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.