我正在使用WinUsb_WritePipe 函数在 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
这个函数曾经返回 false,但现在它什么都不返回。