我正在使用WinUsb_WritePipe function在USB设备上写入数据。
唯一的麻烦是该函数执行无限循环。
//bulkOutPipe is a pipeId set precedently
//ucBuffer is an unsigned char array
//uiBytesToWrite corresponds to the size of the array
//ulBytesWritten is a unsigned long to stock the bytes written
std::cout << "Started writing" << std::endl;
WinUsb_WritePipe(devInfo->winUsbHandle, devInfo->bulkOutPipe, ucBuffer, uiBytesToWrite, &ulBytesWritten, 0);
//never gets here
此函数used to return false但现在它不会返回任何内容。
答案 0 :(得分:0)
为了避免无限循环,我建议总是为这样的I / O操作设置超时。您可以使用WinUSB Functions for Pipe Policy Modification。