阅读:1074回复:0
控制端口能读写,端口1也能写,就是不能读?
void CUsbhidiocDlg::ReadInputReport()
{ // Retrieve an Input report from the device. CString ByteToDisplay = ""; DWORD Result; //The first byte is the report number. InputReport[0]=0; // Find out if the "Use Control Transfers Only" check box is checked. UpdateData(true); if (ReadHandle != INVALID_HANDLE_VALUE) { Result = ReadFile (ReadHandle, InputReport, Capabilities.InputReportByteLength, &NumberOfBytesRead, (LPOVERLAPPED) &HIDOverlapped); } DisplayLastError("ReadFile: ") ; Result = WaitForSingleObject(hEventObject,600); DisplayLastError("WaitForSingleObject: ") ; ValueToDisplay.Format("LEN:%s", NumberOfBytesRead); DisplayData(ValueToDisplay); switch (Result) { case WAIT_OBJECT_0: { DisplayData("Received Input report,"); break; } case WAIT_TIMEOUT: { ValueToDisplay.Format("%s", "ReadFile timeout"); DisplayData(ValueToDisplay); Result = CancelIo(ReadHandle); CloseHandles(); DisplayData("Can't read from device"); MyDeviceDetected = FALSE; break; } default: { ValueToDisplay.Format("%s", "Undefined error"); CloseHandles(); DisplayData("Can't read from device"); MyDeviceDetected = FALSE; break; } } ResetEvent(hEventObject); DisplayLastError("123: ") ; } 运行之后显示重叠IO口 不能读器数据,请各大虾帮忙, 谢谢 |
|