Hi,
I have managed to get a user-mode app talking directly to an instance of
Microsoft's USBPRINT driver.
I can write to the printer and get the Centronics emulation status just
fine.
My problem is that, when I want to read data from the printer, I must
specify the exact number of bytes the printer will send in the ReadFile()
call.
If I specify more bytes, the call will hang - but this is normal.
If I specify less bytes, this is what happens:
-> The bytes requested *are* read, the ReadFile() call fails indicating zero
bytes read, GetLastError() returns 23 and the URB returns with status
0xc000000c (USBD_STATUS_BUFFER_OVERRUN);
-> Further ReadFile() calls fail with zero bytes read, no data is read,
GetLastError() returns 23 and the URB returns with status 0xc0000030
(USBD_STATUS_ENDPOINT_HALTED).
It seems that USBPRINT is stalling the IN endpoint when I request less bytes
than those available at the printer. This happens under Win2000 and Win98
and I have tested two printers from different vendors.
Question: Is there any way of clearing the stalled pipe or of reading an
unknown amount of data through USBPRINT?
Thank you,
Aspas
PS: I am using SnoopyPro to see the URBs exchanged.