Gank retry mechanism; instead, if sending sheet fails, initialize printer and start over

This commit is contained in:
XANTRONIX Development 2016-06-07 18:08:32 -05:00
parent 5b27cf9c79
commit 629f3e0049
2 changed files with 19 additions and 22 deletions

View file

@ -5,7 +5,6 @@
#define TABBY_PRINTER_SYNC_2 0x33
#define TABBY_PRINTER_DEVICE_ID 0x81
#define TABBY_PRINTER_RETRY_COUNT 5
#define TABBY_PRINTER_PACKET_MAX_SIZE 640

View file

@ -107,14 +107,6 @@ int tabby_printer_packet_send(int fd,
void *body,
tabby_printer_response *response) {
uint16_t sum = checksum(header, body);
int tries = TABBY_PRINTER_RETRY_COUNT;
do {
if (tries-- == 0) {
errno = EIO;
goto error_io;
}
if (write(fd, header, sizeof(*header)) < 0) {
goto error_io;
@ -133,7 +125,6 @@ int tabby_printer_packet_send(int fd,
if (read(fd, response, sizeof(*response)) < 0) {
goto error_io;
}
} while (resend(response));
return 0;
@ -213,6 +204,13 @@ int tabby_printer_send_sheet(int fd, void *data,
goto error_packet_send;
}
if (resend(&current)) {
tabby_printer_init(fd, &current);
i = -1;
continue;
}
offset += TABBY_PRINTER_BAND_SIZE;
}