I have two problems sending output reports to my HID from my .NET application:
1) In my copy of the USB Complete book, the code to marshal the write buffer to un-managed memory is missing. (page 328) Is this a mistake, or is it intentional? Without it, my application sometimes writes bad data to my HID. It was tricky to find the problem because the bug was intermittent, and only on certain PCs. (I have also read that the numBytesWritten parameter to Writefile should be marshalled as well. For both parameters, I use Marshal.AllocHGlobal() to allocate unmanaged memory, copy the value, and then pass IntPtr to WriteFile.)
2) When I use a USB 2.0 hub to communicate with my device, I get 0 back from numBytesWritten after a successful WriteFile (or a successful GetOverlappedResult). My USB snooper sees three CSPLIT transmissions of the data between the PC and the hub. However, the snooper sees none of this data between the hub and the device. Is there something special I have to do in my software to support USB 2.0 hubs??
Thanks.
Phil