I have a USB device that I need to be able to talk to from a .net application. The device is not a standard HID device and in order to initilise it I've been given a trace of packets from a USB Protocol Analyser / Sniffer for the packets used when intialising it on another type of machine. I need to replicate this packet sequence from my .net application to initialise the device.
Everything is working well until I get to a particular control transfer packet / class type request.
The trace I've been given states I should issue:
Control Transfer Class Type Request
21 0A 00 00 00 00 00 00
Result stall (intentional)
Control Transfer Class Tyoe Request
A1 01 01 03 00 00 40 00
Result will initiate a 64 byte transfer of data from the device to the host.
This is the code I'm using to do this:
// Transcation 6
UsbSetupPacket setup = new UsbSetupPacket(0x21, 0x0A, 0, 0, 0);
bool result = MyUsbDevice.ControlTransfer(ref setup, buffer, 0, out transferred);
Console.WriteLine("Result = {0}", result);
// Transcation 7
setup = new UsbSetupPacket(0xA1, 0x01, 0x0301, 0x0000, 0x0040);
result = MyUsbDevice.ControlTransfer(ref setup, buffer, 64, out transferred);
Console.WriteLine("Result = {0}, {1}", result, transferred);
And this is the trace I'm receiving from BusHound which is sniffing the USB data traffic for this device:
Device Phase Data Description Cmd.Phase.Ofs(rep)
------ ----- ------------------------ ---------------- ------------------
46.0 CTL 21 0a 00 00 00 00 00 00 SET IDLE 20.1.0
46.0 USTS c0000004 stall pid 20.2.0
46.0 CTL a1 01 01 03 00 00 00 00 GET REPORT 21.1.0
46.1 USTS c0000004 stall pid 22.1.0
As you can see the 0x0040 value parameter in the setup packet is not making it out even though I'm setting it. I'm relatively new to USB and to .net / LibUsbDotNet and I'm not quite sure what I'm doing wrong. I wonder if anyone can suggest anything for me to try?
Note, I'm developing on a Windows 7 64bit machine using Visual Studio 2008.
Thanks, Rich