[errors] Doubleread the readback, to clear initial state.

This commit is contained in:
Solomon Peachy 2012-11-22 07:40:32 -05:00
parent df272c6e6d
commit ea26351dc5
3 changed files with 14 additions and 2 deletions

View File

@ -278,7 +278,10 @@
[xx] is 0x01 on the CP780/CP800/CP900, 0x00 on all others.
[rr] is 0x00 normally, and 0x08 when ribbon is depleted.
[rr] is error code:
0x00 no error
0x01 paper out
0x08 when ribbon is depleted
[ss] is either 0x00 or 0x70. Unsure as to its significance; perhaps it
means paper or ribbon is already set to go?

View File

@ -410,13 +410,21 @@ int main (int argc, char **argv)
}
}
top:
/* Read in the printer status */
ret = libusb_bulk_transfer(dev, endp_up,
rdbuf,
READBACK_LEN,
&num,
2000);
top:
/* Do it twice to clear initial state */
ret = libusb_bulk_transfer(dev, endp_up,
rdbuf,
READBACK_LEN,
&num,
2000);
if (ret < 0) {
ERROR("libusb error %d: (%d/%d from 0x%02x)\n", ret, num, READBACK_LEN, endp_up);
ret = 4;

View File

@ -154,6 +154,7 @@ int main(int argc, char **argv)
if (paper_code_offset != -1)
paper_code = printers[printer_type].paper_codes[buffer[printers[printer_type].pgcode_offset]];
read(dev_fd, rdbuf, READBACK_LEN); /* Read the status from printer */
top:
read(dev_fd, rdbuf, READBACK_LEN); /* Read the status from printer */