Hello,
I’m trying to use the WinUSB driver to talk to our device that simply has bulk in/out endpoints.
The problem comes when I try to send a setup packet to the control endpoint with the following features:
- The Length member of the setup packet is used in a customised way - to send a checksum byte to the device.
- There is no buffer and the buffer length is 0.
Example:
WINUSB_SETUP_PACKET setup_packet;
setup_packet.RequestType = 0x40; // Vendor write request
setup_packet.Request = 0x14; // a vendor defined request
setup_packet.Value = 0xdf1b;
setup_packet.Index = 0x4000;
setup_packet.Length = 0x0005; // this is a checksum
if (WinUsb_ControlTransfer(hUSBWINDRIVER->hDevice, setup_packet, NULL, 0, &bytesReturned, NULL))
{
// carry on
}
else
{
// error
}
Looking at the actual data sent down the USB bus, instead of getting
0x40, 0x14, 0x1b, 0xdf, 0x00, 0x40, 0x00, 0x05
I get
0x40, 0x14, 0x1b, 0xdf, 0x00, 0x40, 0x00, 0x00
- the .Length member does not get passed through, presumably because the buffer length parameter is set to 0.
I know this goes against what the USB specification says about the .Length member but unfortunately, we have devices out in the field
that rely on this information for us to talk to them. (We can talk to them like this with an old driver that’s not Vista compatible.)
Does anyone know how I can get around this, and get the .Length member sent, even if the buffer length parameter is 0?