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!