I have a small device that enumerates as a standard HID device. I am able to successfully acquired a file handle to the HID device using CreateFile().
However, when I try to read the input report using ReadFile(), I get ERROR_INVALID_USER_BUFFER #1784.
I am wondering if my device descriptor is not exactlly correct and perhaps it can be verified or give me some advice as to what is my problem.
I am not sure also if I should be setting the HID descriptor to BULK or Interrupt and what the SubClass and Protocol values should be. For now I have them set to BULK and zero for the latter settings. Any advice on these would also be helpful.
My PC is running 32Bit Windows XP SP3, and Device Manager successfully enumerates my device as a HID Compliant Device.
Here is my report descriptor.
__align(4) const uint08 ReportDescriptor_POPAddress[16] =
{
0×06, 0×00, 0xFF, //USAGE_PAGE (Generic Deivce)
0×09, 0×01, //USAGE (Vendor Usage)
0xA1, 0×01, //Collection Application
0×09, 0×02, //USAGE (Vendor Usage)
0×75, 0×08, //Report Size (8)
0×95, 0×01, //Report Count (1)
0×81, 0×02, //Input: Data, Variable, Absolute
0xC0 //END_COLLECTION
};
unsigned int numBytes = 0;
unsigned char popdata[32];
popdata[0] = 0;
if (!ReadFile(file, &popdata, 1, &numBytes, NULL))
{
printf(“Error in ReadFile: %x”, GetLastError());
CloseHandle(file);
return 0;
}
I have also set the number of bytes to read to 2 but the ReadFile() never returns.
Any help would be much appreciated.
|