forked from agalakhov/captdriver
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
bugSomething isn't workingSomething isn't workingcups-libusbRelated to problems with the CUPS-libusb interfaceRelated to problems with the CUPS-libusb interface
Description
One of your high-priority problems in wiki is CUPS backend bugs. I think, I has fix for this in my repo: just checkout capt_command.c on my repo.
There is diff:
// while (1) {
// if (WORD(capt_iobuf[2], capt_iobuf[3]) == capt_iosize)
// break;
// if (BCD(capt_iobuf[2], capt_iobuf[3]) == capt_iosize)
// break;
// if (cmd == CAPT_NOP || cmd == CAPT_IDENT || cmd == CAPT_CHKJOBSTAT) {
// capt_recv_buf(capt_iosize, BCD(capt_iobuf[2], capt_iobuf[3]));
// continue;
// }
// /* block at 64 byte boundary is not the last one */
// if (WORD(capt_iobuf[2], capt_iobuf[3]) > capt_iosize && capt_iosize % 64 == 6) {
// capt_recv_buf(capt_iosize, WORD(capt_iobuf[2], capt_iobuf[3]) - capt_iosize);
// continue;
// }
// /* we should never get here */
// fprintf(stderr, "ERROR: CAPT: bad reply from printer, "
// "expected size %02X %02X, got %02X %02X\n",
// capt_iobuf[2], capt_iobuf[3], LO(capt_iosize), HI(capt_iosize));
// capt_debug_buf("ERROR", capt_iosize);
// exit(1);
// }
if(WORD(capt_iobuf[2], capt_iobuf[3]) > 6 || BCD(capt_iobuf[2], capt_iobuf[3]) > 6) {
capt_recv_buf(capt_iosize, BCD(capt_iobuf[2], capt_iobuf[3]));
}
Simple, won't it? This implementation fixed buffer mismatch on LBP1120. But, my father detected bug in BCD(). True BCD() is here:
static inline uint16_t BCD(uint8_t lo, uint8_t hi)
{
uint16_t a, b, c, d;
// a = (hi >> 8) & 0x0F;
a = (hi >> 4) & 0x0F;
b = (hi >> 0) & 0x0F;
// c = (lo >> 8) & 0x0F;
c = (lo >> 4) & 0x0F;
d = (lo >> 0) & 0x0F;
if (a > 9 || b > 9 || c > 9 || d > 9)
return WORD(lo, hi);
return a * 1000 + b * 100 + c * 10 + d * 1;
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcups-libusbRelated to problems with the CUPS-libusb interfaceRelated to problems with the CUPS-libusb interface