When I do a ReadFile/WriteFile on a handle provided by CreateFile(HID_DEVICE_NAME,...), what happens in a terms of HID operations?
Does it issues a direct write/read request to HID device (USB, in my case), or is it transformed somewhere in underlying drivers to read last cached HID report with such ID?
ReadFile call:
syncDevice.OutputReportBuffer[0] = 0;
syncDevice.OutputReportBuffer[1] = reportID;
HANDLE writeHandle = CreateFile(pDevice->DevicePath, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
HANDLE readHandle = CreateFile(pDevice->DevicePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
success = WriteFile(writeHandle, (void*) syncDevice.OutputReportBuffer, syncDevice.Caps.OutputReportByteLength, &bytecnt, 0);
success = ReadFile(readHandle, syncDevice.InputReportBuffer, syncDevice.Caps.InputReportByteLength, &bytecnt, 0);