Device.Net icon indicating copy to clipboard operation
Device.Net copied to clipboard

Control transfers are incorrect when using LibUSB

Open sanjay900 opened this issue 3 years ago • 1 comments

Describe the issue It appears that the LibUsb UsbInterface is using just the RequestType when creating control transfers, instead of the entire UsbDeviceRequestType I found that this would stop me from sending control transfers, but I could fix this by using the ToByte() method of UsbDeviceRequestType.

I have made a PR for this here: https://github.com/MelbourneDeveloper/Device.Net/pull/237

Your Code

public uint WriteData(ushort id, byte[] buffer)
{
    SetupPacket packet = new SetupPacket(new UsbDeviceRequestType(RequestDirection.Out, RequestType.Class, RequestRecipient.Interface), 1, id, 2, (ushort)buffer.Length);
    TransferResult tr = device.PerformControlTransferAsync(packet, buffer).Result;
    return tr.BytesTransferred;
}

Info

  • Platform: Linux
  • Device Type: USB
  • Version: 4.3.0-beta

sanjay900 avatar Jul 11 '22 09:07 sanjay900

Have you had a chance to look into getting a release out with this fix?

sanjay900 avatar Jul 24 '22 11:07 sanjay900