WinUSB help needed - setup packet with non-zero length.

Tech-Archive recommends: Fix windows errors by optimizing your registry




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:

1. The Length member of the setup packet is used in a customised way -
to send a checksum byte to the device.
2. 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, 0x05, 0x00
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?


--
FlownTheCoop
------------------------------------------------------------------------
FlownTheCoop's Profile: http://forums.techarena.in/member.php?userid=31290
View this thread: http://forums.techarena.in/showthread.php?t=819916

http://forums.techarena.in

.



Relevant Pages

  • Re: KERB_SMART_CARD_LOGON
    ... the smart card reader name, ... This member must be set to 1. ... The number of characters in the bBuffer buffer that precede the name ... The domain name of the user to authenticate. ...
    (microsoft.public.platformsdk.security)
  • Re: KERB_SMART_CARD_LOGON
    ... the smart card reader name, ... This member must be set to 1. ... The number of characters in the bBuffer buffer that precede the name ... The domain name of the user to authenticate. ...
    (microsoft.public.platformsdk.security)
  • Re: track positions in arrays= index variables || pointers to elements?
    ... > and it holds an address of a member of the buffer. ... > It's type is unrelated to the type of the array. ...
    (comp.lang.c)
  • dynamic class members workaround
    ... I have a generic buffer class, which can have one or more cursor ... The parent buffer of pCursor is implicit at the Insertcall, ... dynamic member for each cursor. ...
    (comp.lang.cpp)