Firstly,Open device successfully,then send package to can device.
if insertting is not correctly, the function of WinUsb_WritePipe has chance of timeout.
the answ of question is insert the code.
long timeout = 500; //设置输出超时时间为500ms
if (!WinUsb_SetPipePolicy(dev->winUSBHandle, dev->bulkOutPipe, PIPE_TRANSFER_TIMEOUT, sizeof(timeout),
&timeout)) {
dev->last_error = CANDLE_ERR_SET_PIPE_TRANSFER_TIMEOUT;
goto winusb_free;
}
Firstly,Open device successfully,then send package to can device. if insertting is not correctly, the function of WinUsb_WritePipe has chance of timeout.
the answ of question is insert the code.