D
David Yao_1987
Guest
I am developing a printing software to read and write to the printer via USB.
The steps is:
1. Use SetupDiGetDeviceInterfaceDetail to get the path of the printer.
2. Use createfile to get the handler of the printer with read&write permission.
3. Call writefile API to send data to the printer, and the embedded program of the printer can receive the data.
4. Call readfile API to read the return value of the printer with the same handler as step3.
The communication method between the application and the printer is one question and one answer. After the application sends a command to the printer (about 200 milliseconds), the application will try to read return data from the printer.
I found that if the application reads USB while the printer is not returning, a read block problem will occur, causing the application to block.
I am not sure whether such a phenomenon is normal or whether it is caused by the printer.
The method I can think of is that if I read the USB after the printer returns the data, the problem of the read block can be avoided.
But I didn't find a way to monitor when the USB data return.
Is there any way (message event) to monitor if the USB is readable?
Continue reading...
The steps is:
1. Use SetupDiGetDeviceInterfaceDetail to get the path of the printer.
2. Use createfile to get the handler of the printer with read&write permission.
3. Call writefile API to send data to the printer, and the embedded program of the printer can receive the data.
4. Call readfile API to read the return value of the printer with the same handler as step3.
The communication method between the application and the printer is one question and one answer. After the application sends a command to the printer (about 200 milliseconds), the application will try to read return data from the printer.
I found that if the application reads USB while the printer is not returning, a read block problem will occur, causing the application to block.
I am not sure whether such a phenomenon is normal or whether it is caused by the printer.
The method I can think of is that if I read the USB after the printer returns the data, the problem of the read block can be avoided.
But I didn't find a way to monitor when the USB data return.
Is there any way (message event) to monitor if the USB is readable?
Continue reading...