diff --git a/backend_canonselphy.c b/backend_canonselphy.c index 747eb72..91f43e0 100644 --- a/backend_canonselphy.c +++ b/backend_canonselphy.c @@ -92,7 +92,7 @@ struct printer_data { int16_t pgcode_offset; /* Offset into printjob for paper type */ int16_t paper_code_offset; /* Offset in readback for paper type */ int (*error_detect)(uint8_t *rdbuf); - char *(*pgcode_names)(uint8_t pgcode); + char *(*pgcode_names)(uint8_t pgcode); }; static char *generic_pgcode_names(uint8_t pgcode) @@ -137,7 +137,7 @@ static int es2_error_detect(uint8_t *rdbuf) ERROR("Printer cover open!\n"); return 1; } - + if (rdbuf[0] == 0x02 && rdbuf[4] == 0x05 && rdbuf[5] == 0x05 && @@ -165,13 +165,13 @@ static int es3_error_detect(uint8_t *rdbuf) ATTR("marker-levels=%d\n", 0); ERROR("No media loaded!\n"); } else { - ERROR("Unknown error - %02x + %02x\n", + ERROR("Unknown error - %02x + %02x\n", rdbuf[8], rdbuf[10]); } return 1; } else if (rdbuf[8] == 0x03 && rdbuf[10] == 0x02) { - ATTR("marker-levels=%d\n", 0); + ATTR("marker-levels=%d\n", 0); ERROR("No media loaded!\n"); return 1; } else if (rdbuf[8] == 0x08 && @@ -185,11 +185,11 @@ static int es3_error_detect(uint8_t *rdbuf) } if (rdbuf[8] || rdbuf[10]) { - ERROR("Unknown error - %02x + %02x\n", + ERROR("Unknown error - %02x + %02x\n", rdbuf[8], rdbuf[10]); return 1; } - + return 0; } @@ -198,7 +198,7 @@ static int es40_error_detect(uint8_t *rdbuf) /* ES40 */ if (!rdbuf[3]) return 0; - + if (rdbuf[3] == 0x01) ERROR("Generic communication error\n"); else if (rdbuf[3] == 0x32) { @@ -206,7 +206,7 @@ static int es40_error_detect(uint8_t *rdbuf) ERROR("Cover open or media empty!\n"); } else ERROR("Unknown error - %02x\n", rdbuf[3]); - + return 1; } @@ -224,7 +224,7 @@ static int cp790_error_detect(uint8_t *rdbuf) if ((rdbuf[3] & 0xf) == 0x02) { // 0x12 0x22 ATTR("marker-levels=%d\n", 0); ERROR("No paper tray loaded!\n"); - } else if ((rdbuf[3] & 0xf) == 0x03) { // 0x13 0x23 + } else if ((rdbuf[3] & 0xf) == 0x03) { // 0x13 0x23 ATTR("marker-levels=%d\n", 0); ERROR("Empty paper tray or feed error!\n"); } else if (rdbuf[3] == 0x11) @@ -253,7 +253,7 @@ static int cp10_error_detect(uint8_t *rdbuf) return 0; if (rdbuf[2] == 0x80) { - ATTR("marker-levels=%d\n", 0); + ATTR("marker-levels=%d\n", 0); ERROR("No ribbon loaded\n"); } else if (rdbuf[2] == 0x08) { ATTR("marker-levels=%d\n", 0); @@ -272,7 +272,7 @@ static int cpxxx_error_detect(uint8_t *rdbuf) return 0; if (rdbuf[2] == 0x01) { - ATTR("marker-levels=%d\n", 0); + ATTR("marker-levels=%d\n", 0); ERROR("Paper feed problem!\n"); } else if (rdbuf[2] == 0x04) ERROR("Ribbon problem!\n"); @@ -363,7 +363,7 @@ static struct printer_data selphy_printers[] = { .pgcode_offset = 2, .paper_code_offset = -1, /* Uses a different technique */ .error_detect = cp790_error_detect, - .pgcode_names = generic_pgcode_names, + .pgcode_names = generic_pgcode_names, }, { .type = P_CP_XXX, .model = "SELPHY CP Series (!CP-10/CP790)", @@ -379,7 +379,7 @@ static struct printer_data selphy_printers[] = { .pgcode_offset = 3, .paper_code_offset = 6, .error_detect = cpxxx_error_detect, - .pgcode_names = generic_pgcode_names, + .pgcode_names = generic_pgcode_names, }, { .type = P_CP10, .model = "SELPHY CP-10", @@ -395,7 +395,7 @@ static struct printer_data selphy_printers[] = { .pgcode_offset = 2, .paper_code_offset = -1, .error_detect = cp10_error_detect, - .pgcode_names = cp10_pgcode_names, + .pgcode_names = cp10_pgcode_names, }, { .type = -1 }, }; @@ -411,7 +411,7 @@ static void setup_paper_codes(void) if (selphy_printers[i].type == -1) break; /* Default all to IGNORE */ - for (j = 0 ; j < 256 ; j++) + for (j = 0 ; j < 256 ; j++) selphy_printers[i].paper_codes[j] = -1; /* Set up specifics */ @@ -467,10 +467,10 @@ enum { S_FINISHED, }; -static int fancy_memcmp(const uint8_t *buf_a, const int16_t *buf_b, uint len) +static int fancy_memcmp(const uint8_t *buf_a, const int16_t *buf_b, uint len) { uint i; - + for (i = 0 ; i < len ; i++) { if (buf_b[i] == -1) continue; @@ -482,7 +482,7 @@ static int fancy_memcmp(const uint8_t *buf_a, const int16_t *buf_b, uint len) return 0; } -static int parse_printjob(uint8_t *buffer, uint8_t *bw_mode, uint32_t *plane_len) +static int parse_printjob(uint8_t *buffer, uint8_t *bw_mode, uint32_t *plane_len) { int printer_type = -1; @@ -490,7 +490,7 @@ static int parse_printjob(uint8_t *buffer, uint8_t *bw_mode, uint32_t *plane_len buffer[1] != 0x00) { goto done; } - + if (buffer[12] == 0x40 && buffer[13] == 0x01) { *plane_len = *(uint32_t*)(&buffer[16]); @@ -599,7 +599,7 @@ static void *canonselphy_init(void) extern struct dyesub_backend canonselphy_backend; -static void canonselphy_attach(void *vctx, struct libusb_device_handle *dev, +static void canonselphy_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct canonselphy_ctx *ctx = vctx; @@ -678,7 +678,7 @@ static int canonselphy_read_parse(void *vctx, int data_fd) if (i != MAX_HEADER - offset) { if (i == 0) return CUPS_BACKEND_CANCEL; - ERROR("Read failed (%d/%d)\n", + ERROR("Read failed (%d/%d)\n", i, MAX_HEADER - offset); perror("ERROR: Read failed"); return CUPS_BACKEND_FAILED; @@ -691,9 +691,9 @@ static int canonselphy_read_parse(void *vctx, int data_fd) if (ctx->type == P_CP790) printer_type = P_CP790; else - printer_type = P_ES40; + printer_type = P_ES40; } - + /* Look up the printer entry */ for (i = 0; selphy_printers[i].type != -1; i++) { if (selphy_printers[i].type == printer_type) { @@ -758,7 +758,7 @@ static int canonselphy_read_parse(void *vctx, int data_fd) /* Move over chunks already read in */ memcpy(ctx->header, ctx->buffer, ctx->printer->init_length); - memcpy(ctx->plane_y, ctx->buffer+ctx->printer->init_length, + memcpy(ctx->plane_y, ctx->buffer+ctx->printer->init_length, MAX_HEADER-ctx->printer->init_length); /* Read in YELLOW plane */ @@ -864,7 +864,7 @@ top: INFO("Waiting for printer idle\n"); if (fancy_memcmp(rdbuf, ctx->printer->init_readback, READBACK_LEN)) break; - + /* Make sure paper/ribbon is correct */ if (ctx->paper_code != -1) { if (ctx->type == P_CP_XXX) { @@ -892,7 +892,7 @@ top: } else { if (rdbuf[ctx->printer->paper_code_offset] != ctx->paper_code) { - ERROR("Incorrect media/ribbon loaded (%02x vs %02x), aborting job!\n", + ERROR("Incorrect media/ribbon loaded (%02x vs %02x), aborting job!\n", ctx->paper_code, rdbuf[ctx->printer->paper_code_offset]); return CUPS_BACKEND_HOLD; /* Hold this job, don't stop queue */ @@ -904,7 +904,7 @@ top: if (ribbon == 0xf) { ERROR("No ribbon loaded, aborting!\n"); - return CUPS_BACKEND_STOP; + return CUPS_BACKEND_STOP; } else if (ribbon != ctx->paper_code) { ERROR("Incorrect ribbon loaded, aborting job!\n"); return CUPS_BACKEND_HOLD; @@ -977,7 +977,7 @@ top: if (!fancy_memcmp(rdbuf, ctx->printer->done_c_readback, READBACK_LEN)) { if (ctx->cp900) state = S_PRINTER_CP900_FOOTER; - else + else state = S_FINISHED; } break; @@ -985,7 +985,7 @@ top: uint32_t empty = 0; INFO("Sending CP900 Footer\n"); - if ((ret = send_data(ctx->dev, ctx->endp_down, + if ((ret = send_data(ctx->dev, ctx->endp_down, (uint8_t*)&empty, sizeof(empty)))) return CUPS_BACKEND_FAILED; @@ -1002,7 +1002,7 @@ top: state = S_FINISHED; /* Intentional Fallthrough */ case S_FINISHED: - INFO("All data sent to printer!\n"); + INFO("All data sent to printer!\n"); break; } if (state != S_FINISHED) @@ -1177,7 +1177,7 @@ struct dyesub_backend canonselphy_backend = { 16 01 00 00 [pg] 00 [pg2] 00 00 00 00 00 [error, cover open] 02 00 00 00 05 05 02 00 00 00 00 00 [error, no media] - [xx] can be 0x00 or 0xff, depending on if a previous print job has + [xx] can be 0x00 or 0xff, depending on if a previous print job has completed or not. [pg] is: 0x01 for P-papers @@ -1193,7 +1193,7 @@ struct dyesub_backend canonselphy_backend = { Selphy ES3/30: Init func: 40 00 [pgcode] [type] 00 00 00 00 00 00 00 00 [length, 32-bit LE] - Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00 + Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00 End func: 40 20 00 00 00 00 00 00 00 00 00 00 @@ -1232,7 +1232,7 @@ struct dyesub_backend canonselphy_backend = { Selphy ES40: Init func: 40 00 [pgcode] [type] 00 00 00 00 00 00 00 00 [length, 32-bit LE] - Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00 + Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00 End func: 40 20 00 00 00 00 00 00 00 00 00 00 @@ -1276,7 +1276,7 @@ struct dyesub_backend canonselphy_backend = { Selphy CP790: Init func: 40 00 [pgcode] 00 00 00 00 00 00 00 00 00 [length, 32-bit LE] - Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00 + Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00 End func: 40 20 00 00 00 00 00 00 00 00 00 00 @@ -1293,7 +1293,7 @@ struct dyesub_backend canonselphy_backend = { 00 00 ff 00 [pg1] [pg2] 00 00 00 00 00 02 00 00 00 00 [pg1] [pg2] 00 00 00 00 00 02 [idle, ready for header] - 00 00 01 00 [pg1] [pg2] 00 00 00 00 00 02 + 00 00 01 00 [pg1] [pg2] 00 00 00 00 00 02 00 01 01 00 [pg1] [pg2] 00 00 00 00 00 02 [ready for Y data] 00 03 01 00 [pg1] [pg2] 00 00 00 00 00 02 [transitions to this] 00 03 02 00 [pg1] [pg2] 00 00 00 00 00 02 [ready for M data] @@ -1326,7 +1326,7 @@ struct dyesub_backend canonselphy_backend = { Selphy CP-10: Init func: 40 00 00 00 00 00 00 00 00 00 00 00 - Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00 + Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00 plane codes are 0x00, 0x01, 0x02 for Y, M, and C, respectively. @@ -1353,13 +1353,13 @@ struct dyesub_backend canonselphy_backend = { *************************************************************************** Selphy CP-series (except for CP790 & CP-10): - + This is known to apply to: CP-100, CP-200, CP-300, CP-330, CP400, CP500, CP510, CP710, CP720, CP730, CP740, CP750, CP760, CP770, CP780, CP800, CP900 Init func: 40 00 00 [pgcode] 00 00 00 00 00 00 00 00 - Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00 + Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00 End func: 00 00 00 00 # NOTE: Present (and necessary) on CP900 only. Error clear: 40 10 00 00 00 00 00 00 00 00 00 00 diff --git a/backend_canonselphyneo.c b/backend_canonselphyneo.c index 189617a..8413ce0 100644 --- a/backend_canonselphyneo.c +++ b/backend_canonselphyneo.c @@ -154,7 +154,7 @@ static void *selphyneo_init(void) extern struct dyesub_backend selphyneo_backend; -static void selphyneo_attach(void *vctx, struct libusb_device_handle *dev, +static void selphyneo_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct selphyneo_ctx *ctx = vctx; @@ -197,7 +197,7 @@ static int selphyneo_read_parse(void *vctx, int data_fd) if (i != sizeof(hdr)) { if (i == 0) return CUPS_BACKEND_CANCEL; - ERROR("Read failed (%d/%d)\n", + ERROR("Read failed (%d/%d)\n", i, (int)sizeof(hdr)); perror("ERROR: Read failed"); return CUPS_BACKEND_FAILED; @@ -215,19 +215,19 @@ static int selphyneo_read_parse(void *vctx, int data_fd) hdr.data[10], le32_to_cpu(hdr.cols), le32_to_cpu(hdr.rows)); return CUPS_BACKEND_CANCEL; } - + /* Allocate a buffer */ ctx->datalen = 0; ctx->databuf = malloc(remain + sizeof(hdr)); if (!ctx->databuf) { ERROR("Memory allocation failure!\n"); return CUPS_BACKEND_FAILED; - } + } /* Store the read-in header */ memcpy(ctx->databuf, &hdr, sizeof(hdr)); ctx->datalen += sizeof(hdr); - + /* Read in data */ while (remain > 0) { i = read(data_fd, ctx->databuf + ctx->datalen, remain); @@ -243,7 +243,7 @@ static int selphyneo_read_parse(void *vctx, int data_fd) static int selphyneo_main_loop(void *vctx, int copies) { struct selphyneo_ctx *ctx = vctx; struct selphyneo_readback rdback; - + int ret, num; /* Read in the printer status to clear last state */ @@ -261,13 +261,13 @@ static int selphyneo_main_loop(void *vctx, int copies) { ATTR("marker-types=ribbonWax\n"); -top: +top: INFO("Waiting for printer idle\n"); do { ret = read_data(ctx->dev, ctx->endp_up, (uint8_t*) &rdback, sizeof(rdback), &num); - + if (ret < 0) return CUPS_BACKEND_FAILED; @@ -294,7 +294,7 @@ top: ATTR("marker-levels=%d\n", -3); /* ie Unknown but OK */ - INFO("Sending spool data\n"); + INFO("Sending spool data\n"); /* Send the data over in 256K chunks */ { int chunk = 256*1024; @@ -318,7 +318,7 @@ top: do { ret = read_data(ctx->dev, ctx->endp_up, (uint8_t*) &rdback, sizeof(rdback), &num); - + if (ret < 0) return CUPS_BACKEND_FAILED; @@ -374,7 +374,7 @@ static int selphyneo_cmdline_arg(void *vctx, int argc, char **argv) GETOPT_PROCESS_GLOBAL case 'R': selphyneo_send_reset(ctx); - break; + break; } if (j) return j; @@ -443,7 +443,7 @@ struct dyesub_backend canonselphyneo_backend = { L == 5087264 == 1695744 * 3 + 32 (1472*1152) C == 2180384 == 726784 * 3 + 32 (1088*668) - It is worth mentioning that the Y'CbCr image data is surmised to use the + It is worth mentioning that the Y'CbCr image data is surmised to use the JPEG coefficients, although we realistically have no way of confirming this. Other questions: @@ -474,7 +474,7 @@ struct dyesub_backend canonselphyneo_backend = { ZZ == Media? - 01 + 01 10 11 ^-- Ribbon diff --git a/backend_citizencw01.c b/backend_citizencw01.c index 9271788..c4e3ffa 100644 --- a/backend_citizencw01.c +++ b/backend_citizencw01.c @@ -310,7 +310,7 @@ static void cw01_attach(void *vctx, struct libusb_device_handle *dev, device = libusb_get_device(dev); libusb_get_device_descriptor(device, &desc); - + ctx->type = lookup_printer_type(&cw01_backend, desc.idVendor, desc.idProduct); } @@ -339,7 +339,7 @@ static int cw01_read_parse(void *vctx, int data_fd) { } i = read(data_fd, (uint8_t*) &ctx->hdr, sizeof(struct cw01_spool_hdr)); - + if (i < 0) return i; if (i == 0) @@ -347,7 +347,7 @@ static int cw01_read_parse(void *vctx, int data_fd) { if (i < (int)sizeof(struct cw01_spool_hdr)) return CUPS_BACKEND_CANCEL; - + if (ctx->hdr.type > 0x06 || ctx->hdr.res > 0x01) { ERROR("Unrecognized header data format!\n"); return CUPS_BACKEND_CANCEL; @@ -409,7 +409,7 @@ top: if (!resp) return CUPS_BACKEND_FAILED; cw01_cleanup_string((char*)resp, len); - + /* Check to see if we have sufficient buffers */ // XXX audit these rules...? if (!strcmp("FBP00", (char*)resp) || @@ -620,7 +620,7 @@ static int cw01_get_info(struct cw01_ctx *ctx) cw01_cleanup_string((char*)resp, len); - INFO("Media Lot Code: '%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x'\n", + INFO("Media Lot Code: '%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x'\n", *(resp+2), *(resp+3), *(resp+4), *(resp+5), *(resp+6), *(resp+7), *(resp+8), *(resp+9), *(resp+10), *(resp+11), *(resp+12), *(resp+13)); @@ -874,7 +874,7 @@ struct dyesub_backend cw01_backend = { } }; -/* +/* Basic spool file format: @@ -888,7 +888,7 @@ TT RR NN 00 XX XX XX XX 00 00 00 00 <- FILE header. Followed by three planes, each with this header: -28 00 00 00 00 08 00 00 RR RR 00 00 01 00 08 00 +28 00 00 00 00 08 00 00 RR RR 00 00 01 00 08 00 00 00 00 00 00 00 00 00 5a 33 00 00 YY YY 00 00 00 01 00 00 00 00 00 00 @@ -897,7 +897,7 @@ Followed by three planes, each with this header: Followed by 1024 bytes of color tables: - ff ff ff 00 ... 00 00 00 00 + ff ff ff 00 ... 00 00 00 00 1024+40 = 1064 bytes of header per plane. diff --git a/backend_common.c b/backend_common.c index 14683be..872b0b5 100644 --- a/backend_common.c +++ b/backend_common.c @@ -232,7 +232,7 @@ done: return ret; } -int send_data(struct libusb_device_handle *dev, uint8_t endp, +int send_data(struct libusb_device_handle *dev, uint8_t endp, uint8_t *buf, int len) { int num = 0; @@ -318,7 +318,7 @@ static char *url_encode(char *str) { } while (*pstr) { - if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~') + if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~') *pbuf++ = *pstr; else if (*pstr == ' ') *pbuf++ = '+'; @@ -410,7 +410,7 @@ static int print_scan_output(struct libusb_device *device, break; } - /* Query IEEE1284 info only if it's a PRINTER class */ + /* Query IEEE1284 info only if it's a PRINTER class */ if (desc->bDeviceClass == LIBUSB_CLASS_PRINTER || (desc->bDeviceClass == LIBUSB_CLASS_PER_INTERFACE && config->interface[iface].altsetting[altset].bInterfaceClass == LIBUSB_CLASS_PRINTER)) { @@ -519,7 +519,7 @@ static int print_scan_output(struct libusb_device *device, strncpy(buf + k, product, sizeof(buf)-k); fprintf(stdout, "direct %s://%s?serial=%s&backend=%s \"%s\" \"%s\" \"%s\" \"\"\n", - prefix, buf, serial, backend->uri_prefix, + prefix, buf, serial, backend->uri_prefix, descr, descr, ieee_id? ieee_id : ""); } @@ -577,7 +577,7 @@ extern struct dyesub_backend cw01_backend; static struct dyesub_backend *backends[] = { &canonselphy_backend, - &canonselphyneo_backend, + &canonselphyneo_backend, &kodak6800_backend, &kodak605_backend, &kodak1400_backend, @@ -588,7 +588,7 @@ static struct dyesub_backend *backends[] = { &updr150_backend, &mitsu70x_backend, &mitsu9550_backend, - &mitsup95d_backend, + &mitsup95d_backend, &dnpds40_backend, &cw01_backend, NULL, @@ -952,7 +952,7 @@ int main (int argc, char **argv) endp_down = config->interface[iface].altsetting[altset].endpoint[i].bEndpointAddress; } if (endp_up && endp_down) - break; + break; } if (config) diff --git a/backend_dnpds40.c b/backend_dnpds40.c index 341f77a..e2fdaf6 100644 --- a/backend_dnpds40.c +++ b/backend_dnpds40.c @@ -33,7 +33,7 @@ //#define DNP_ONLY -/* Enables caching of last print type to speed up +/* Enables caching of last print type to speed up job pipelining. Without this we always have to assume the worst */ //#define STATE_DIR "/tmp" @@ -88,7 +88,7 @@ struct dnpds40_ctx { uint32_t last_multicut; int last_matte; - int fullcut; + int fullcut; int matte; int cutter; int can_rewind; @@ -105,7 +105,7 @@ struct dnpds40_ctx { int supports_3x5x2; int supports_matte; int supports_finematte; - int supports_luster; + int supports_luster; int supports_advmatte; int supports_fullcut; int supports_rewind; @@ -419,7 +419,7 @@ static int dnpds40_do_cmd(struct dnpds40_ctx *ctx, (uint8_t*)cmd, sizeof(*cmd)))) return ret; - if (data && len) + if (data && len) if ((ret = send_data(ctx->dev, ctx->endp_down, data, len))) return ret; @@ -881,10 +881,10 @@ static int dnpds40_read_parse(void *vctx, int data_fd) { } /* There's no way to figure out the total job length in advance, we - have to parse the stream until we get to the image plane data, + have to parse the stream until we get to the image plane data, and even then the stream can contain arbitrary commands later. - So instead, we allocate a buffer of the maximum possible length, + So instead, we allocate a buffer of the maximum possible length, then parse the incoming stream until we hit the START command at the end of the job. */ @@ -910,7 +910,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) { while (run) { int remain, i, j; /* Read in command header */ - i = read(data_fd, ctx->databuf + ctx->datalen, + i = read(data_fd, ctx->databuf + ctx->datalen, sizeof(struct dnpds40_cmd)); if (i < 0) return i; @@ -932,7 +932,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) { /* Read in data chunk as quickly as possible */ remain = j; while (remain > 0) { - i = read(data_fd, ctx->databuf + ctx->datalen + sizeof(struct dnpds40_cmd), + i = read(data_fd, ctx->databuf + ctx->datalen + sizeof(struct dnpds40_cmd), remain); if (i < 0) { ERROR("Data Read Error: %d (%d/%d @%d)\n", i, remain, j, ctx->datalen); @@ -948,7 +948,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) { /* Check for some offsets */ if(!memcmp("CNTRL QTY", ctx->databuf + ctx->datalen+2, 9)) { /* Ignore this. We will insert our own later on */ - continue; + continue; } if(!memcmp("CNTRL CUTTER", ctx->databuf + ctx->datalen+2, 12)) { memcpy(buf, ctx->databuf + ctx->datalen + 32, 8); @@ -1125,7 +1125,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) { case P_DNP_DS80D: if (ctx->matte) { int mcut = ctx->multicut; - + if (mcut > MULTICUT_S_BACK) mcut -= MULTICUT_S_BACK; else if (mcut > MULTICUT_S_FRONT) @@ -1945,7 +1945,7 @@ static int dnpds40_get_info(struct dnpds40_ctx *ctx) dnpds40_cleanup_string((char*)resp, len); i = atoi((char*)resp); - + INFO("Standby Transition time: %d minutes\n", i); free(resp); @@ -1960,7 +1960,7 @@ static int dnpds40_get_info(struct dnpds40_ctx *ctx) dnpds40_cleanup_string((char*)resp, len); i = atoi((char*)resp); INFO("Media End kept across power cycles: %s\n", - i ? "Yes" : "No"); + i ? "Yes" : "No"); free(resp); } diff --git a/backend_kodak1400.c b/backend_kodak1400.c index 6a0b2aa..0ad6c9f 100644 --- a/backend_kodak1400.c +++ b/backend_kodak1400.c @@ -100,7 +100,7 @@ static int send_plane(struct kodak1400_ctx *ctx, cmdbuf[1] = 0x74; cmdbuf[2] = 0x00; cmdbuf[3] = 0x50; - + if ((ret = send_data(ctx->dev, ctx->endp_down, cmdbuf, CMDBUF_LEN))) return ret; @@ -127,7 +127,7 @@ static int send_plane(struct kodak1400_ctx *ctx, int i; for (i = 0 ; i < ctx->hdr.rows ; i++) { if ((ret = send_data(ctx->dev, ctx->endp_down, - planedata + i * ctx->hdr.columns, + planedata + i * ctx->hdr.columns, ctx->hdr.columns))) return ret; } @@ -138,7 +138,7 @@ static int send_plane(struct kodak1400_ctx *ctx, cmdbuf[1] = 0x74; cmdbuf[2] = 0x01; cmdbuf[3] = 0x50; - + if ((ret = send_data(ctx->dev, ctx->endp_down, cmdbuf, CMDBUF_LEN))) return ret; @@ -194,10 +194,10 @@ static int kodak1400_set_tonecurve(struct kodak1400_ctx *ctx, char *fname) ret = -3; goto done; } - + ret = read_data(dev, endp_up, respbuf, sizeof(respbuf), &num); - + if (ret < 0) goto done; if (num != 8) { @@ -231,7 +231,7 @@ static int kodak1400_set_tonecurve(struct kodak1400_ctx *ctx, char *fname) /* get the response */ ret = read_data(dev, endp_up, respbuf, sizeof(respbuf), &num); - + if (ret < 0) goto done; if (num != 8) { @@ -288,11 +288,11 @@ static void *kodak1400_init(void) return NULL; } memset(ctx, 0, sizeof(struct kodak1400_ctx)); - + return ctx; } -static void kodak1400_attach(void *vctx, struct libusb_device_handle *dev, +static void kodak1400_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct kodak1400_ctx *ctx = vctx; @@ -352,7 +352,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) { if (ret < 0 || ret != sizeof(ctx->hdr)) { if (ret == 0) return CUPS_BACKEND_CANCEL; - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, 0, (int)sizeof(ctx->hdr)); perror("ERROR: Read failed"); return CUPS_BACKEND_CANCEL; @@ -367,7 +367,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) { ctx->hdr.planesize = le32_to_cpu(ctx->hdr.planesize); ctx->hdr.rows = le16_to_cpu(ctx->hdr.rows); ctx->hdr.columns = le16_to_cpu(ctx->hdr.columns); - + /* Set up plane data */ ctx->plane_r = malloc(ctx->hdr.planesize); ctx->plane_g = malloc(ctx->hdr.planesize); @@ -392,7 +392,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) { do { ret = read(data_fd, ptr, remain); if (ret < 0) { - ERROR("Read failed (%d/%d/%u) (%d/%u @ %d)\n", + ERROR("Read failed (%d/%d/%u) (%d/%u @ %d)\n", ret, remain, ctx->hdr.columns, i, ctx->hdr.rows, j); perror("ERROR: Read failed"); @@ -437,7 +437,7 @@ top: /* Read in the printer status */ ret = read_data(ctx->dev, ctx->endp_up, rdbuf, READBACK_LEN, &num); - + if (ret < 0) return CUPS_BACKEND_FAILED; if (memcmp(rdbuf, rdbuf2, READBACK_LEN)) { @@ -454,7 +454,7 @@ top: return CUPS_BACKEND_STOP; // HOLD/CANCEL/FAILED? XXXX parse error! } - fflush(stderr); + fflush(stderr); switch (state) { case S_IDLE: @@ -650,14 +650,14 @@ struct dyesub_backend kodak1400_backend = { XX 01 to laminate, 00 to not. 01 Unknown, always set to 01 XX Lamination Strength: - + 3c Glossy 28 Matte +5 2e Matte +4 34 Matte +3 3a Matte +2 40 Matte +1 - 46 Matte + 46 Matte 52 Matte -1 5e Matte -2 6a Matte -3 @@ -674,7 +674,7 @@ struct dyesub_backend kodak1400_backend = { All readback values are 8 bytes long. Multi-byte numbers are sent BIG ENDIAN. - + Image data is sent via planes, one scanline per URB. <-- 1b 72 # Status query @@ -682,7 +682,7 @@ struct dyesub_backend kodak1400_backend = { <-- 1b 00 # Reset/attention? <-- 1b 5a 53 0a 00 0b c2 # Setup (ie hdr.columns and hdr.rows) - <-- 1b 59 01 # ?? hdr.matte ? + <-- 1b 59 01 # ?? hdr.matte ? <-- 1b 60 XX # hdr.lamination <-- 1b 62 XX # hdr.lam_strength <-- 1b 61 01 # ?? hdr.unk1 ? @@ -693,7 +693,7 @@ struct dyesub_backend kodak1400_backend = { <-- row last <-- 1b 74 01 50 # ?? - + <-- 1b 72 # Status query --> e4 72 00 00 00 00 50 59 # Printing plane 1 [ repeats until...] @@ -765,21 +765,21 @@ struct dyesub_backend kodak1400_backend = { Calibration data: <-- 1b a2 # ?? Reset cal tables? - --> 00 01 00 00 00 00 00 00 + --> 00 01 00 00 00 00 00 00 <-- 1b a0 02 03 06 10 # 06 10 == 1552 bytes aka the CAL data. <-- cal data - [[ Data is organized as three blocks of 512 bytes followed by - 16 NULL bytes. + [[ Data is organized as three blocks of 512 bytes followed by + 16 NULL bytes. - Each block appears to be 256 entries of 16-bit LE data, + Each block appears to be 256 entries of 16-bit LE data, so each input value is translated into a 16-bit number in the printer. Assuming blocks are ordered BGR. - ]] + ]] - --> 00 00 00 00 00 00 00 00 + --> 00 00 00 00 00 00 00 00 */ diff --git a/backend_kodak605.c b/backend_kodak605.c index a0e64b7..e847e32 100644 --- a/backend_kodak605.c +++ b/backend_kodak605.c @@ -291,7 +291,7 @@ static int kodak605_read_parse(void *vctx, int data_fd) { if (ret < 0 || ret != sizeof(ctx->hdr)) { if (ret == 0) return CUPS_BACKEND_CANCEL; - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, 0, (int)sizeof(ctx->hdr)); perror("ERROR: Read failed"); return CUPS_BACKEND_CANCEL; @@ -683,7 +683,7 @@ struct dyesub_backend kodak605_backend = { .teardown = kodak605_teardown, .read_parse = kodak605_read_parse, .main_loop = kodak605_main_loop, - .devices = { + .devices = { { USB_VID_KODAK, USB_PID_KODAK_605, P_KODAK_605, "Kodak"}, { 0, 0, 0, ""} } diff --git a/backend_kodak6800.c b/backend_kodak6800.c index 444b5f3..abdd899 100644 --- a/backend_kodak6800.c +++ b/backend_kodak6800.c @@ -930,7 +930,7 @@ static int kodak6850_send_unk(struct kodak6800_ctx *ctx) return CUPS_BACKEND_FAILED; } -#if 0 +#if 0 // XXX No particular idea what this actually is if (rdbuf[1] != 0x01 && rdbuf[1] != 0x00) { ERROR("Unexpected status code (0x%02x)!\n", rdbuf[1]); @@ -947,7 +947,7 @@ static void kodak6800_cmdline(void) DEBUG("\t\t[ -m ] # Query media\n"); DEBUG("\t\t[ -s ] # Query status\n"); DEBUG("\t\t[ -R ] # Reset printer\n"); - DEBUG("\t\t[ -X jobid ] # Cancel Job\n"); + DEBUG("\t\t[ -X jobid ] # Cancel Job\n"); } static int kodak6800_cmdline_arg(void *vctx, int argc, char **argv) @@ -1009,7 +1009,7 @@ static void *kodak6800_init(void) return ctx; } -static void kodak6800_attach(void *vctx, struct libusb_device_handle *dev, +static void kodak6800_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct kodak6800_ctx *ctx = vctx; @@ -1095,7 +1095,7 @@ static int kodak6800_read_parse(void *vctx, int data_fd) { do { ret = read(data_fd, ptr, remain); if (ret < 0) { - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, remain, ctx->datalen); perror("ERROR: Read failed"); return CUPS_BACKEND_CANCEL; diff --git a/backend_mitsu70x.c b/backend_mitsu70x.c index 0dcae52..9a07dae 100644 --- a/backend_mitsu70x.c +++ b/backend_mitsu70x.c @@ -43,7 +43,7 @@ #if defined(USE_DLOPEN) #define WITH_DYNAMIC #include -#define DL_INIT() do {} while(0) +#define DL_INIT() do {} while(0) #define DL_OPEN(__x) dlopen(__x, RTLD_NOW) #define DL_SYM(__x, __y) dlsym(__x, __y) #define DL_CLOSE(__x) dlclose(__x) @@ -175,7 +175,7 @@ struct mitsu70x_ctx { int sharpen; /* ie mhdr.sharpen - 1 */ uint8_t rew[2]; /* 1 for rewind ok (default!) */ - + struct BandImage output; }; @@ -350,7 +350,7 @@ struct mitsu70x_memorystatus_resp { uint8_t rsvd; } __attribute__((packed)); -// XXX also seen commands 0x67, 0x72, 0x54, 0x6e +// XXX also seen commands 0x67, 0x72, 0x54, 0x6e struct mitsu70x_hdr { uint8_t hdr[4]; /* 1b 5a 54 XX */ // XXX also, seen 1b 5a 43! @@ -411,14 +411,14 @@ static char *mitsu70x_jobstatuses(uint8_t *sts) return "Data transfer"; case JOB_STATUS0_QUEUE: return "Queued for printing"; - case JOB_STATUS0_PRINT: + case JOB_STATUS0_PRINT: switch(sts[1]) { case JOB_STATUS1_PRINT_MEDIALOAD: return "Media loading"; case JOB_STATUS1_PRINT_PRE_Y: return "Waiting to print yellow plane"; case JOB_STATUS1_PRINT_Y: - return "Printing yellow plane"; + return "Printing yellow plane"; case JOB_STATUS1_PRINT_PRE_M: return "Waiting to print magenta plane"; case JOB_STATUS1_PRINT_M: @@ -698,7 +698,7 @@ static void mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, ctx->dl_handle = NULL; return; } - + ctx->Get3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Get3DColorTable"); ctx->Load3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Load3DColorTable"); ctx->Destroy3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Destroy3DColorTable"); @@ -1465,7 +1465,7 @@ top: mitsu70x_media_types(resp.lower.media_brand, resp.lower.media_type)); ATTR("marker-types=ribbonWax\n"); } - + /* FW sanity checking */ if (ctx->type == P_KODAK_305) { if (be16_to_cpu(resp.vers[0].checksum) != EK305_0104_M_CSUM) @@ -1502,7 +1502,7 @@ skip_status: { int i; struct mitsu70x_jobs jobs; - + ret = mitsu70x_get_jobs(ctx, &jobs); if (ret) return CUPS_BACKEND_FAILED; @@ -1658,7 +1658,7 @@ skip_status: } /* Update cache for the next round */ - memcpy(last_status, jobstatus.job_status, 4); + memcpy(last_status, jobstatus.job_status, 4); } while(1); /* Clean up */ @@ -1706,7 +1706,7 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_printerstatus_resp *resp type, buf, be16_to_cpu(resp->vers[i].checksum)); } INFO("Standby Timeout: %d minutes\n", resp->sleeptime); - INFO("iSerial Reporting: %s\n", resp->iserial ? "No" : "Yes" ); + INFO("iSerial Reporting: %s\n", resp->iserial ? "No" : "Yes" ); INFO("Lower Mechanical Status: %s\n", mitsu70x_mechastatus(resp->lower.mecha_status)); @@ -1758,7 +1758,7 @@ static int mitsu70x_query_status(struct mitsu70x_ctx *ctx) struct mitsu70x_printerstatus_resp resp; #if 0 struct mitsu70x_jobs jobs; -#endif +#endif struct mitsu70x_jobstatus jobstatus; int ret; diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c index df50b8a..b3cb6a3 100644 --- a/backend_mitsu9550.c +++ b/backend_mitsu9550.c @@ -526,7 +526,7 @@ static char *mitsu9550_media_types(uint8_t type, uint8_t is_s) } return NULL; } - + switch (type & 0xf) { /* values can be 0x0? or 0x4? */ case 0x01: return "CK9035 (3.5x5)"; @@ -556,7 +556,7 @@ static int validate_media(int type, int media, int cols, int rows) return 1; break; case 0x02: /* 4x6 */ - case 0x03: /* 4x6 postcard */ + case 0x03: /* 4x6 postcard */ if (cols != 2152) return 1; if (rows != 1416 && rows != 1184 && rows != 1240) @@ -707,7 +707,7 @@ static int validate_media(int type, int media, int cols, int rows) case P_MITSU_9800S: switch(media & 0xf) { case 0x02: /* 4x6 */ - case 0x03: /* 4x6 postcard */ + case 0x03: /* 4x6 postcard */ if (cols != 1868 && rows != 1228) return 1; break; @@ -837,20 +837,20 @@ top: if (ctx->hdr4_present) if ((ret = send_data(ctx->dev, ctx->endp_down, (uint8_t*) &ctx->hdr4, sizeof(struct mitsu9550_hdr4)))) - return CUPS_BACKEND_FAILED; - + return CUPS_BACKEND_FAILED; + if (ctx->is_s) { /* Send "start data" command */ cmd.cmd[0] = 0x1b; cmd.cmd[1] = 0x5a; cmd.cmd[2] = 0x43; cmd.cmd[3] = 0x00; - + if ((ret = send_data(ctx->dev, ctx->endp_down, (uint8_t*) &cmd, sizeof(cmd)))) return CUPS_BACKEND_FAILED; } - + /* Send over plane data */ while(1) { struct mitsu9550_plane *plane = (struct mitsu9550_plane *)ptr; @@ -878,7 +878,7 @@ top: // struct mitsu9550_status2 *sts2 = (struct mitsu9550_status2*) rdbuf; struct mitsu9550_media *media = (struct mitsu9550_media *) rdbuf; uint16_t donor, remain; - + ret = mitsu9550_get_status(ctx, rdbuf, 0, 0, 1); // media if (ret < 0) return CUPS_BACKEND_FAILED; @@ -903,11 +903,11 @@ top: ret = mitsu9550_get_status(ctx, rdbuf, 0, 1, 0); // status2 if (ret < 0) return CUPS_BACKEND_FAILED; - + ret = mitsu9550_get_status(ctx, rdbuf, 1, 0, 0); // status if (ret < 0) return CUPS_BACKEND_FAILED; - + /* Make sure we're ready to proceed */ if (sts->sts5 != 0) { ERROR("Unexpected response (sts5 %02x)\n", sts->sts5); @@ -1094,7 +1094,7 @@ static int mitsu9550_query_status2(struct mitsu9550_ctx *ctx) { struct mitsu9550_status2 resp; int ret; - + ret = mitsu9550_get_status(ctx, (uint8_t*) &resp, 0, 1, 0); if (!ret) @@ -1121,13 +1121,13 @@ static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_ ret = read_data(dev, endp_up, rdbuf, READBACK_LEN, &num); - + if (ret < 0) return CUPS_BACKEND_FAILED; if ((unsigned int)num < sizeof(cmd) + 1) /* Short read */ return CUPS_BACKEND_FAILED; - + if (rdbuf[0] != 0xe4 || rdbuf[1] != 0x72 || rdbuf[2] != 0x6e || @@ -1140,7 +1140,7 @@ static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_ WARNING("Short serno read! (%d vs %u)\r\n", num, rdbuf[4]); - /* model and serial number are encoded as 16-bit unicode, + /* model and serial number are encoded as 16-bit unicode, little endian, separated by spaces. */ i = num; ptr = rdbuf + 5; @@ -1152,7 +1152,7 @@ static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_ i -= 2; } *buf = 0; /* Null-terminate the returned string */ - + return ret; } @@ -1193,7 +1193,7 @@ static int mitsu9550_cmdline_arg(void *vctx, int argc, char **argv) /* Exported */ struct dyesub_backend mitsu9550_backend = { - .name = "Mitsubishi CP-9550 family", + .name = "Mitsubishi CP-9xxx family", .version = "0.29", .uri_prefix = "mitsu9550", .cmdline_usage = mitsu9550_cmdline, @@ -1233,7 +1233,7 @@ struct dyesub_backend mitsu9550_backend = { 1b 57 20 2e 00 QQ QQ 00 00 00 00 00 00 00 XX XX :: XX XX == columns YY YY 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :: YY YY == rows 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :: QQ == 0x0a90 on 9810, 0x0a10 on all others. - 00 00 + 00 00 ~~~ Header 2 @@ -1246,15 +1246,15 @@ struct dyesub_backend mitsu9550_backend = { 1b 57 22 2e 00 QQ 00 00 00 00 00 XX 00 00 00 00 :: XX = 00 normal, 01 FineDeep 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :: QQ = 0xf0 on 9500, 0x40 on the rest - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 ~~~ Header 4 (all but 9550-S and 9800-S, involves error policy?) 1b 57 26 2e 00 QQ 00 00 00 00 00 SS RR 01 00 00 :: QQ = 0x70 on 9550/98x0, 0x60 on 9600 or 9800S 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :: RR = 0x01 on 9550/98x0, 0x00 on 9600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :: SS = 0x01 on 9800S, 0x00 otherwise. - 00 00 + 00 00 ~~~~ Data follows: @@ -1312,7 +1312,7 @@ struct dyesub_backend mitsu9550_backend = { [[ Unknown ]] -> 1b 4b 7f 00 - <- eb 4b 8f 00 02 00 5e [[ '02' seems to be a length ]] + <- eb 4b 8f 00 02 00 5e [[ '02' seems to be a length ]] [[ Unknown ]] @@ -1340,11 +1340,11 @@ struct dyesub_backend mitsu9550_backend = { <- e4 4b 01 00 02 00 78 Status Query - + -> 1b 56 30 00 -> 30 2e 00 00 00 00 MM 00 NN NN ZZ 00 00 00 00 00 :: MM, NN, ZZ QQ RR SS 00 00 00 00 00 00 00 00 00 00 00 00 00 :: QQ, RR, SS - 00 00 00 00 00 00 00 00 00 00 00 00 TT UU 00 00 :: TT, UU + 00 00 00 00 00 00 00 00 00 00 00 00 TT UU 00 00 :: TT, UU Status Query B (not sure what to call this) @@ -1417,7 +1417,7 @@ struct dyesub_backend mitsu9550_backend = { [...] 00 3e 00 00 80 44 :: Idle. - Also seen: + Also seen: 00 3e 00 00 96 4b :: Idle 00 be 00 00 96 4b :: Data submitted, pre "start" @@ -1450,8 +1450,8 @@ struct dyesub_backend mitsu9550_backend = { SS :: ?? 0x00 means "ready for another print" but 0x01 is "busy" TT :: ?? seen values between 0x7c through 0x96) UU :: ?? seen values between 0x43 and 0x4c -- temperature? - - *** + + *** Other printer commands seen: diff --git a/backend_mitsup95d.c b/backend_mitsup95d.c index 9fa2845..bc78035 100644 --- a/backend_mitsup95d.c +++ b/backend_mitsup95d.c @@ -59,7 +59,7 @@ struct mitsup95d_ctx { int mem_clr_present; uint8_t hdr[2]; // 1b 51 - + uint8_t hdr1[50]; // 1b 57 20 2e ... uint8_t hdr2[50]; // 1b 57 21 2e ... uint8_t hdr3[50]; // 1b 57 22 2e ... @@ -531,7 +531,7 @@ struct dyesub_backend mitsup95d_backend = { [[ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]] 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 XY - + P93: 1b 57 21 2e 00 4a aa 00 00 TT 00 00 00 NN 00 MM @@ -685,5 +685,3 @@ UNKNOWNS: * What "custom gamma" table does to spool file? */ - - diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c index c144abe..a5ae46f 100644 --- a/backend_shinkos1245.c +++ b/backend_shinkos1245.c @@ -125,7 +125,7 @@ struct shinkos1245_cmd_print { struct shinkos1245_cmd_getstatus { struct shinkos1245_cmd_hdr hdr; uint8_t cmd[1]; /* 0x03 */ - uint8_t pad[10]; + uint8_t pad[10]; } __attribute__((packed)); struct shinkos1245_resp_status { @@ -360,7 +360,7 @@ enum { #define TONE_CURVE_SIZE 1536 #define TONE_CURVE_DATA_BLOCK_SIZE 64 - + /* Query Model information */ struct shinkos1245_cmd_getmodel { struct shinkos1245_cmd_hdr hdr; @@ -656,7 +656,7 @@ static int shinkos1245_set_matte(struct shinkos1245_ctx *ctx, if (sts.code == CMD_CODE_BAD) return 1; - ERROR("Bad return code (%02x) on SET_MATTE command\n", sts.code); + ERROR("Bad return code (%02x) on SET_MATTE command\n", sts.code); return -99; } @@ -1267,7 +1267,7 @@ static void *shinkos1245_init(void) return ctx; } -static void shinkos1245_attach(void *vctx, struct libusb_device_handle *dev, +static void shinkos1245_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct shinkos1245_ctx *ctx = vctx; @@ -1280,9 +1280,9 @@ static void shinkos1245_attach(void *vctx, struct libusb_device_handle *dev, device = libusb_get_device(dev); libusb_get_device_descriptor(device, &desc); - + ctx->type = lookup_printer_type(&shinkos1245_backend, - desc.idVendor, desc.idProduct); + desc.idVendor, desc.idProduct); /* Ensure jobid is sane */ ctx->jobid = jobid & 0x7f; @@ -1361,7 +1361,7 @@ static int shinkos1245_read_parse(void *vctx, int data_fd) { do { ret = read(data_fd, ptr, remain); if (ret < 0) { - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, remain, ctx->datalen); perror("ERROR: Read failed"); return ret; diff --git a/backend_shinkos2145.c b/backend_shinkos2145.c index a4b92c0..36564c1 100644 --- a/backend_shinkos2145.c +++ b/backend_shinkos2145.c @@ -254,7 +254,7 @@ static char *print_modes(uint8_t v) { #define PRINT_METHOD_4x6_2UP 0x02 #define PRINT_METHOD_2x6_2UP 0x04 -static char *print_methods (uint8_t v) { +static char *print_methods (uint8_t v) { switch (v) { case PRINT_METHOD_STD: return "Standard"; @@ -320,7 +320,7 @@ static char *fwinfo_targets (uint8_t v) { return "USB Boot "; case FWINFO_TARGET_USB_APP: return "USB App "; - case FWINFO_TARGET_TABLES: + case FWINFO_TARGET_TABLES: return "Tables "; default: return "Unknown "; @@ -833,7 +833,7 @@ static int s2145_do_cmd(struct shinkos2145_ctx *ctx, } if (resp->result != RESULT_SUCCESS) { - INFO("Printer Status: %02x (%s)\n", resp->status, + INFO("Printer Status: %02x (%s)\n", resp->status, status_str(resp->status)); INFO(" Result: 0x%02x Error: 0x%02x (0x%02x/0x%02x = %s)\n", resp->result, resp->error, resp->printer_major, @@ -1086,7 +1086,7 @@ static int cancel_job(struct shinkos2145_ctx *ctx, char *str) return 0; } -static int flash_led(struct shinkos2145_ctx *ctx) +static int flash_led(struct shinkos2145_ctx *ctx) { struct s2145_cmd_hdr cmd; struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf; @@ -1150,7 +1150,7 @@ static int button_set(struct shinkos2145_ctx *ctx, int enable) return 0; } -static int get_tonecurve(struct shinkos2145_ctx *ctx, int type, char *fname) +static int get_tonecurve(struct shinkos2145_ctx *ctx, int type, char *fname) { struct s2145_readtone_cmd cmd; struct s2145_readtone_resp *resp = (struct s2145_readtone_resp *) rdbuf; @@ -1224,7 +1224,7 @@ done: return ret; } -static int set_tonecurve(struct shinkos2145_ctx *ctx, int target, char *fname) +static int set_tonecurve(struct shinkos2145_ctx *ctx, int target, char *fname) { struct s2145_update_cmd cmd; struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf; @@ -1394,7 +1394,7 @@ static void *shinkos2145_init(void) return ctx; } -static void shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, +static void shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct shinkos2145_ctx *ctx = vctx; @@ -1407,9 +1407,9 @@ static void shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, device = libusb_get_device(dev); libusb_get_device_descriptor(device, &desc); - + ctx->type = lookup_printer_type(&shinkos2145_backend, - desc.idVendor, desc.idProduct); + desc.idVendor, desc.idProduct); /* Ensure jobid is sane */ ctx->jobid = (jobid & 0x7f); @@ -1445,7 +1445,7 @@ static int shinkos2145_read_parse(void *vctx, int data_fd) { if (ret < 0 || ret != sizeof(ctx->hdr)) { if (ret == 0) return CUPS_BACKEND_CANCEL; - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, 0, (int)sizeof(ctx->hdr)); perror("ERROR: Read failed"); return ret; @@ -1482,7 +1482,7 @@ static int shinkos2145_read_parse(void *vctx, int data_fd) { do { ret = read(data_fd, ptr, remain); if (ret < 0) { - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, remain, ctx->datalen); perror("ERROR: Read failed"); return ret; @@ -1495,7 +1495,7 @@ static int shinkos2145_read_parse(void *vctx, int data_fd) { /* Make sure footer is sane too */ ret = read(data_fd, tmpbuf, 4); if (ret != 4) { - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, 4, 4); perror("ERROR: Read failed"); return ret; @@ -1522,7 +1522,7 @@ static int shinkos2145_main_loop(void *vctx, int copies) { struct s2145_cmd_hdr *cmd = (struct s2145_cmd_hdr *) cmdbuf;; struct s2145_print_cmd *print = (struct s2145_print_cmd *) cmdbuf; - struct s2145_status_resp *sts = (struct s2145_status_resp *) rdbuf; + struct s2145_status_resp *sts = (struct s2145_status_resp *) rdbuf; struct s2145_mediainfo_resp *media = (struct s2145_mediainfo_resp *) rdbuf; /* Send Media Query */ @@ -1704,9 +1704,9 @@ top: printer_error: ERROR("Printer reported error: %#x (%s) status: %#x (%s) -> %#x.%#x (%s)\n", - sts->hdr.error, + sts->hdr.error, error_str(sts->hdr.error), - sts->hdr.status, + sts->hdr.status, status_str(sts->hdr.status), sts->hdr.printer_major, sts->hdr.printer_minor, error_codes(sts->hdr.printer_major, sts->hdr.printer_minor)); @@ -1782,7 +1782,7 @@ struct dyesub_backend shinkos2145_backend = { 00 00 00 00 00 00 00 00 00 00 00 00 ce ff ff ff 00 00 00 00 ce ff ff ff QQ QQ 00 00 ce ff ff ff QQ == DPI, ie 300. 00 00 00 00 ce ff ff ff 00 00 00 00 00 00 00 00 - 00 00 00 00 + 00 00 00 00 [[Packed RGB payload of WW*HH*3 bytes]] diff --git a/backend_shinkos6145.c b/backend_shinkos6145.c index ee4c0f1..ed3387a 100644 --- a/backend_shinkos6145.c +++ b/backend_shinkos6145.c @@ -32,7 +32,7 @@ * * You must still adhere to all other terms of the license to this program * (ie GPLv3) and the license of the libS6145ImageProcess library. - * + * */ #include @@ -55,7 +55,7 @@ #if defined(USE_DLOPEN) #define WITH_DYNAMIC #include -#define DL_INIT() do {} while(0) +#define DL_INIT() do {} while(0) #define DL_OPEN(__x) dlopen(__x, RTLD_NOW) #define DL_SYM(__x, __y) dlsym(__x, __y) #define DL_CLOSE(__x) dlclose(__x) @@ -151,8 +151,8 @@ struct tankParamTable { uint32_t fstOutConductivity; uint32_t plusMaxEnergy; uint32_t minusMaxEnergy; - uint32_t plusMaxEnergyPreRead; - uint32_t minusMaxEnergyPreRead; + uint32_t plusMaxEnergyPreRead; + uint32_t minusMaxEnergyPreRead; uint32_t preReadLevelDiff; uint32_t rsvd[14]; // null? } __attribute__((packed)); @@ -277,7 +277,7 @@ struct shinkos6145_ctx { uint8_t ribbon_type; uint8_t input_ymc; - + uint16_t last_donor; uint16_t last_remain; uint16_t last_ribbon; @@ -336,7 +336,7 @@ static char *cmd_names(uint16_t v) { case S6145_CMD_GETPARAM: return "Get Parameter"; case S6145_CMD_GETSERIAL: - return "Get Serial Number"; + return "Get Serial Number"; case S6145_CMD_PRINTSTAT: return "Get Print ID Status"; case S6145_CMD_EXTCOUNTER: @@ -379,7 +379,7 @@ struct s6145_print_cmd { uint8_t reserved[6]; uint8_t unk_1; /* Brava 21 sets this to 1 */ uint8_t method; - uint8_t image_avg; + uint8_t image_avg; } __attribute__((packed)); #define PRINT_MODE_NO_OC 0x01 @@ -407,7 +407,7 @@ static char *print_modes(uint8_t v) { #define PRINT_METHOD_DOUBLE 0x08 #define PRINT_METHOD_NOTRIM 0x80 -static char *print_methods (uint8_t v) { +static char *print_methods (uint8_t v) { switch (v & 0xf) { case PRINT_METHOD_STD: return "Standard"; @@ -700,7 +700,7 @@ static char *error_codes(uint8_t major, uint8_t minor) return "Paper Jam: Precut Print Position Off"; case 0x20: return "Paper Jam: Precut Print Position On"; - + case 0x29: return "Paper Jam: Printing Paper Top On"; case 0x2A: @@ -1036,7 +1036,7 @@ static const char *print_ribbons (uint8_t v) { return "6x8"; case RIBBON_6x9: return "6x9"; - // XXX 89x??? rubbons. + // XXX 89x??? rubbons. default: return "Unknown"; } @@ -1148,7 +1148,7 @@ static int s6145_do_cmd(struct shinkos6145_ctx *ctx, } if (resp->result != RESULT_SUCCESS) { - INFO("Printer Status: %02x (%s)\n", resp->status, + INFO("Printer Status: %02x (%s)\n", resp->status, status_str(resp->status)); INFO(" Result: 0x%02x Error: 0x%02x (0x%02x/0x%02x = %s)\n", resp->result, resp->error, resp->printer_major, @@ -1232,7 +1232,7 @@ static int get_status(struct shinkos6145_ctx *ctx) INFO("Lifetime Distance: %08u inches\n", le32_to_cpu(resp2->lifetime_distance)); INFO("Maintenance Distance: %08u inches\n", le32_to_cpu(resp2->maint_distance)); INFO("Head Distance: %08u inches\n", le32_to_cpu(resp2->head_distance)); - + /* Query various params */ if(ctx->type == P_SHINKO_S6145D) { if ((ret = get_param(ctx, PARAM_REGION_CODE, &val))) { @@ -1280,7 +1280,7 @@ static int get_status(struct shinkos6145_ctx *ctx) val = 240; // default? INFO("Sleep delay: %u minutes\n", val); - + return 0; } @@ -1310,7 +1310,7 @@ static int get_fwinfo(struct shinkos6145_ctx *ctx) if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6145_fwinfo_resp) - sizeof(struct s6145_status_hdr))) continue; - + INFO(" %s\t ver %02x.%02x\n", fwinfo_targets(i), resp->major, resp->minor); #if 0 @@ -1341,7 +1341,7 @@ static int get_errorlog(struct shinkos6145_ctx *ctx) ERROR("Failed to execute %s command\n", cmd_names(cmd.cmd)); return ret; } - + if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6145_errorlog_resp) - sizeof(struct s6145_status_hdr))) return -2; @@ -1349,13 +1349,13 @@ static int get_errorlog(struct shinkos6145_ctx *ctx) for (i = 0 ; i < resp->count ; i++) { INFO(" %02d: @ %08u prints : 0x%02x/0x%02x (%s)\n", i, le32_to_cpu(resp->items[i].print_counter), - resp->items[i].major, resp->items[i].minor, + resp->items[i].major, resp->items[i].minor, error_codes(resp->items[i].major, resp->items[i].minor)); } return 0; } -static int get_mediainfo(struct shinkos6145_ctx *ctx) +static int get_mediainfo(struct shinkos6145_ctx *ctx) { struct s6145_cmd_hdr cmd; struct s6145_mediainfo_resp *resp = (struct s6145_mediainfo_resp *) rdbuf; @@ -1413,7 +1413,7 @@ static int cancel_job(struct shinkos6145_ctx *ctx, char *str) return 0; } -static int flash_led(struct shinkos6145_ctx *ctx) +static int flash_led(struct shinkos6145_ctx *ctx) { struct s6145_cmd_hdr cmd; struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf; @@ -1465,7 +1465,7 @@ static int get_param(struct shinkos6145_ctx *ctx, int target, uint32_t *param) /* Set up command */ cmd.target = target; - + cmd.hdr.cmd = cpu_to_le16(S6145_CMD_GETPARAM); cmd.hdr.len = cpu_to_le16(sizeof(struct s6145_getparam_cmd)-sizeof(cmd.hdr)); @@ -1529,7 +1529,7 @@ static int shinkos6145_dump_corrdata(struct shinkos6145_ctx *ctx, char *fname) free(ctx->corrdata); ctx->corrdata = NULL; ctx->corrdatalen = 0; - + return ret; } @@ -1563,7 +1563,7 @@ static int shinkos6145_dump_eeprom(struct shinkos6145_ctx *ctx, char *fname) return ret; } -static int get_tonecurve(struct shinkos6145_ctx *ctx, int type, char *fname) +static int get_tonecurve(struct shinkos6145_ctx *ctx, int type, char *fname) { struct s6145_readtone_cmd cmd; struct s6145_readtone_resp *resp = (struct s6145_readtone_resp *) rdbuf; @@ -1637,7 +1637,7 @@ done: return ret; } -static int set_tonecurve(struct shinkos6145_ctx *ctx, int target, char *fname) +static int set_tonecurve(struct shinkos6145_ctx *ctx, int target, char *fname) { struct s6145_update_cmd cmd; struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf; @@ -1738,7 +1738,7 @@ static int shinkos6145_get_imagecorr(struct shinkos6145_ctx *ctx) while (total < ctx->corrdatalen) { struct s6145_imagecorr_data data; - + ret = read_data(ctx->dev, ctx->endp_up, (uint8_t *) &data, sizeof(data), &num); @@ -1806,7 +1806,7 @@ static void shinkos6145_cmdline(void) DEBUG("\t\t[ -m ] # Query media\n"); DEBUG("\t\t[ -q filename ] # Extract eeprom data\n"); DEBUG("\t\t[ -Q filename ] # Extract image correction params\n"); - DEBUG("\t\t[ -r ] # Reset user/NV tone curve\n"); + DEBUG("\t\t[ -r ] # Reset user/NV tone curve\n"); DEBUG("\t\t[ -R ] # Reset printer to factory defaults\n"); DEBUG("\t\t[ -s ] # Query status\n"); DEBUG("\t\t[ -X jobid ] # Abort a printjob\n"); @@ -1905,11 +1905,11 @@ static void *shinkos6145_init(void) memset(ctx, 0, sizeof(struct shinkos6145_ctx)); DL_INIT(); - + return ctx; } -static void shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, +static void shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct shinkos6145_ctx *ctx = vctx; @@ -1922,12 +1922,12 @@ static void shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, device = libusb_get_device(dev); libusb_get_device_descriptor(device, &desc); - + ctx->type = lookup_printer_type(&shinkos6145_backend, - desc.idVendor, desc.idProduct); + desc.idVendor, desc.idProduct); /* Attempt to open the library */ -#if defined(WITH_DYNAMIC) +#if defined(WITH_DYNAMIC) INFO("Attempting to load image processing library\n"); ctx->dl_handle = DL_OPEN(LIB_NAME); /* Try the Sinfonia one first */ if (!ctx->dl_handle) @@ -1972,7 +1972,7 @@ static void shinkos6145_teardown(void *vctx) { DL_CLOSE(ctx->dl_handle); DL_EXIT(); - + free(ctx); } @@ -2005,7 +2005,7 @@ static void lib6145_process_image(uint8_t *src, uint16_t *dest, pad_r = pad_l + le16_to_cpu(corrdata->width); out = 0; in = 0; - + /* Convert YMC 8-bit to 16-bit, and pad appropriately to full stripe */ for (row = 0 ; row < le16_to_cpu(corrdata->height) ; row++) { for (col = 0 ; col < row_lim; col++) { @@ -2045,7 +2045,7 @@ static void lib6145_process_image(uint8_t *src, uint16_t *dest, } dest[out++] = val; } - } + } /* Generate lamination plane, if desired */ if (oc_mode > PRINT_MODE_NO_OC) { @@ -2100,7 +2100,7 @@ static int shinkos6145_read_parse(void *vctx, int data_fd) { /* Extended spool format to re-purpose an unused header field. When bit 0 is set, this tells the backend that the data is - already in planar YMC format (vs packed RGB) so we don't need + already in planar YMC format (vs packed RGB) so we don't need to do the conversion ourselves. Saves some processing overhead */ ctx->input_ymc = le32_to_cpu(ctx->hdr.ext_flags) & 0x01; @@ -2108,7 +2108,7 @@ static int shinkos6145_read_parse(void *vctx, int data_fd) { free(ctx->databuf); ctx->databuf = NULL; } - + ctx->datalen = le32_to_cpu(ctx->hdr.rows) * le32_to_cpu(ctx->hdr.columns) * 3; ctx->databuf = malloc(ctx->datalen); if (!ctx->databuf) { @@ -2162,7 +2162,7 @@ static int shinkos6145_main_loop(void *vctx, int copies) { struct s6145_cmd_hdr *cmd = (struct s6145_cmd_hdr *) cmdbuf; struct s6145_print_cmd *print = (struct s6145_print_cmd *) cmdbuf; - struct s6145_status_resp *sts = (struct s6145_status_resp *) rdbuf; + struct s6145_status_resp *sts = (struct s6145_status_resp *) rdbuf; struct s6145_mediainfo_resp *media = (struct s6145_mediainfo_resp *) rdbuf; uint32_t cur_mode; @@ -2240,7 +2240,7 @@ top: memcpy(rdbuf2, rdbuf, READBACK_LEN); - INFO("Printer Status: 0x%02x (%s)\n", + INFO("Printer Status: 0x%02x (%s)\n", sts->hdr.status, status_str(sts->hdr.status)); /* Guessimate a percentage for the remaining media */ @@ -2271,8 +2271,8 @@ top: case S_IDLE: INFO("Waiting for printer idle\n"); /* If either bank is free, continue */ - if (sts->bank1_status == BANK_STATUS_FREE || - sts->bank2_status == BANK_STATUS_FREE) + if (sts->bank1_status == BANK_STATUS_FREE || + sts->bank2_status == BANK_STATUS_FREE) state = S_PRINTER_READY_CMD; break; @@ -2287,7 +2287,7 @@ top: if (cur_mode != oc_mode) { /* If cur_mode is not the same as desired oc_mode, - change it -- but we have to wait until the printer + change it -- but we have to wait until the printer is COMPLETELY idle */ if (sts->bank1_status != BANK_STATUS_FREE || sts->bank2_status != BANK_STATUS_FREE) { @@ -2331,7 +2331,7 @@ top: if (!ctx->input_ymc) { int planelen = le16_to_cpu(ctx->corrdata->width) * le16_to_cpu(ctx->corrdata->height); uint8_t *databuf3 = malloc(ctx->datalen); - + for (i = 0 ; i < planelen ; i++) { uint8_t r, g, b; r = ctx->databuf[3*i]; @@ -2357,7 +2357,7 @@ top: } else { WARNING("Utilizing fallback internal image processing code\n"); WARNING(" *** Output quality will be poor! *** \n"); - + lib6145_calc_avg(ctx, le32_to_cpu(ctx->hdr.columns), le32_to_cpu(ctx->hdr.rows)); lib6145_process_image(ctx->databuf, databuf2, ctx->corrdata, oc_mode); } @@ -2431,16 +2431,16 @@ top: if (state != S_FINISHED) goto top; - + INFO("Print complete\n"); return CUPS_BACKEND_OK; printer_error: ERROR("Printer reported error: %#x (%s) status: %#x (%s) -> %#x.%#x (%s)\n", - sts->hdr.error, + sts->hdr.error, error_str(sts->hdr.error), - sts->hdr.status, + sts->hdr.status, status_str(sts->hdr.status), sts->hdr.printer_major, sts->hdr.printer_minor, error_codes(sts->hdr.printer_major, sts->hdr.printer_minor)); @@ -2500,7 +2500,7 @@ struct dyesub_backend shinkos6145_backend = { .query_serno = shinkos6145_query_serno, .devices = { { USB_VID_SHINKO, USB_PID_SHINKO_S6145, P_SHINKO_S6145, ""}, - { USB_VID_SHINKO, USB_PID_SHINKO_S6145D, P_SHINKO_S6145D, ""}, + { USB_VID_SHINKO, USB_PID_SHINKO_S6145D, P_SHINKO_S6145D, ""}, { 0, 0, 0, ""} } }; diff --git a/backend_shinkos6245.c b/backend_shinkos6245.c index fbd4fda..0d892a7 100644 --- a/backend_shinkos6245.c +++ b/backend_shinkos6245.c @@ -148,7 +148,7 @@ static char *cmd_names(uint16_t v) { case S6245_CMD_GETPARAM: return "Get Parameter"; case S6245_CMD_GETSERIAL: - return "Get Serial Number"; + return "Get Serial Number"; case S6245_CMD_PRINTSTAT: return "Get Print ID Status"; case S6245_CMD_EXTCOUNTER: @@ -189,7 +189,7 @@ struct s6245_print_cmd { uint8_t reserved[8]; // columns and rows repeated, then nulls uint8_t mode; uint8_t method; - uint8_t reserved2; + uint8_t reserved2; } __attribute__((packed)); #define PRINT_MODE_NO_OC 0x01 @@ -217,7 +217,7 @@ static char *print_modes(uint8_t v) { #define PRINT_METHOD_DISABLE_ERR 0x10 -static char *print_methods (uint8_t v) { +static char *print_methods (uint8_t v) { switch (v & 0xf) { case PRINT_METHOD_STD: return "Standard"; @@ -957,7 +957,7 @@ static int s6245_do_cmd(struct shinkos6245_ctx *ctx, } if (resp->result != RESULT_SUCCESS) { - INFO("Printer Status: %02x (%s)\n", resp->status, + INFO("Printer Status: %02x (%s)\n", resp->status, status_str(resp->status)); INFO(" Result: 0x%02x Error: 0x%02x (0x%02x/0x%02x = %s)\n", resp->result, resp->error, resp->printer_major, @@ -1070,7 +1070,7 @@ static int get_fwinfo(struct shinkos6245_ctx *ctx) if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6245_fwinfo_resp) - sizeof(struct s6245_status_hdr))) continue; - + INFO(" %s\t ver %02x.%02x\n", fwinfo_targets(i), resp->major, resp->minor); #if 0 @@ -1097,7 +1097,7 @@ static int get_errorlog(struct shinkos6245_ctx *ctx) do { int ret; cmd.index = i; - + if ((ret = s6245_do_cmd(ctx, (uint8_t*)&cmd, sizeof(cmd), sizeof(*resp), @@ -1114,16 +1114,16 @@ static int get_errorlog(struct shinkos6245_ctx *ctx) resp->time_year + 2000, resp->time_month, resp->time_day, resp->time_hour, resp->time_min, resp->time_sec, le32_to_cpu(resp->print_counter), - resp->error_major, resp->error_minor, + resp->error_major, resp->error_minor, error_codes(resp->error_major, resp->error_minor)); INFO(" Temp: %02u/%02u Hum: %02u\n", resp->printer_thermistor, resp->head_thermistor, resp->printer_humidity); } while (++i < le16_to_cpu(resp->error_count)); - + return 0; } -static int get_mediainfo(struct shinkos6245_ctx *ctx) +static int get_mediainfo(struct shinkos6245_ctx *ctx) { struct s6245_cmd_hdr cmd; struct s6245_mediainfo_resp *resp = (struct s6245_mediainfo_resp *) rdbuf; @@ -1150,7 +1150,7 @@ static int get_mediainfo(struct shinkos6245_ctx *ctx) INFO(" %02d: C 0x%02x (%s), %04ux%04u, P 0x%02x (%s)\n", i, resp->items[i].media_code, print_sizes(resp->items[i].media_code), le16_to_cpu(resp->items[i].columns), - le16_to_cpu(resp->items[i].rows), + le16_to_cpu(resp->items[i].rows), resp->items[i].print_method, print_methods(resp->items[i].print_method)); } return 0; @@ -1181,7 +1181,7 @@ static int cancel_job(struct shinkos6245_ctx *ctx, char *str) return 0; } -static int flash_led(struct shinkos6245_ctx *ctx) +static int flash_led(struct shinkos6245_ctx *ctx) { struct s6245_cmd_hdr cmd; struct s6245_status_hdr *resp = (struct s6245_status_hdr *) rdbuf; @@ -1247,7 +1247,7 @@ static int reset_curve(struct shinkos6245_ctx *ctx, int target) return 0; } -static int get_tonecurve(struct shinkos6245_ctx *ctx, int type, char *fname) +static int get_tonecurve(struct shinkos6245_ctx *ctx, int type, char *fname) { struct s6245_readtone_cmd cmd; struct s6245_readtone_resp *resp = (struct s6245_readtone_resp *) rdbuf; @@ -1321,7 +1321,7 @@ done: return ret; } -static int set_tonecurve(struct shinkos6245_ctx *ctx, int target, char *fname) +static int set_tonecurve(struct shinkos6245_ctx *ctx, int target, char *fname) { struct s6245_update_cmd cmd; struct s6245_status_hdr *resp = (struct s6245_status_hdr *) rdbuf; @@ -1491,7 +1491,7 @@ static void *shinkos6245_init(void) return ctx; } -static void shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, +static void shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct shinkos6245_ctx *ctx = vctx; @@ -1542,7 +1542,7 @@ static int shinkos6245_read_parse(void *vctx, int data_fd) { if (ret < 0 || ret != sizeof(ctx->hdr)) { if (ret == 0) return CUPS_BACKEND_CANCEL; - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, 0, (int)sizeof(ctx->hdr)); perror("ERROR: Read failed"); return ret; @@ -1560,7 +1560,7 @@ static int shinkos6245_read_parse(void *vctx, int data_fd) { return CUPS_BACKEND_CANCEL; } - + if (ctx->databuf) { free(ctx->databuf); ctx->databuf = NULL; @@ -1579,7 +1579,7 @@ static int shinkos6245_read_parse(void *vctx, int data_fd) { do { ret = read(data_fd, ptr, remain); if (ret < 0) { - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, remain, ctx->datalen); perror("ERROR: Read failed"); return ret; @@ -1592,7 +1592,7 @@ static int shinkos6245_read_parse(void *vctx, int data_fd) { /* Make sure footer is sane too */ ret = read(data_fd, tmpbuf, 4); if (ret != 4) { - ERROR("Read failed (%d/%d/%d)\n", + ERROR("Read failed (%d/%d/%d)\n", ret, 4, 4); perror("ERROR: Read failed"); return ret; @@ -1620,7 +1620,7 @@ static int shinkos6245_main_loop(void *vctx, int copies) { struct s6245_cmd_hdr *cmd = (struct s6245_cmd_hdr *) cmdbuf;; struct s6245_print_cmd *print = (struct s6245_print_cmd *) cmdbuf; - struct s6245_status_resp *sts = (struct s6245_status_resp *) rdbuf; + struct s6245_status_resp *sts = (struct s6245_status_resp *) rdbuf; struct s6245_mediainfo_resp *media = (struct s6245_mediainfo_resp *) rdbuf; /* Cap copies */ @@ -1656,7 +1656,7 @@ static int shinkos6245_main_loop(void *vctx, int copies) { ERROR("Failed to execute %s command\n", cmd_names(cmd->cmd)); return CUPS_BACKEND_FAILED; } - + if (le16_to_cpu(media->hdr.payload_len) != (sizeof(struct s6245_mediainfo_resp) - sizeof(struct s6245_status_hdr))) return CUPS_BACKEND_FAILED; @@ -1734,7 +1734,7 @@ top: memcpy(rdbuf2, rdbuf, READBACK_LEN); - INFO("Printer Status: 0x%02x (%s)\n", + INFO("Printer Status: 0x%02x (%s)\n", sts->hdr.status, status_str(sts->hdr.status)); /* Guessimate a percentage for the remaining media */ @@ -1776,8 +1776,8 @@ top: } /* If either bank is free, continue */ - if (sts->bank1_status == BANK_STATUS_FREE || - sts->bank2_status == BANK_STATUS_FREE) + if (sts->bank1_status == BANK_STATUS_FREE || + sts->bank2_status == BANK_STATUS_FREE) state = S_PRINTER_READY_CMD; break; @@ -1839,16 +1839,16 @@ top: if (state != S_FINISHED) goto top; - + INFO("Print complete\n"); return CUPS_BACKEND_OK; printer_error: ERROR("Printer reported error: %#x (%s) status: %#x (%s) -> %#x.%#x (%s)\n", - sts->hdr.error, + sts->hdr.error, error_str(sts->hdr.error), - sts->hdr.status, + sts->hdr.status, status_str(sts->hdr.status), sts->hdr.printer_major, sts->hdr.printer_minor, error_codes(sts->hdr.printer_major, sts->hdr.printer_minor)); diff --git a/backend_sonyupdr150.c b/backend_sonyupdr150.c index 5fe8afe..32dcbe6 100644 --- a/backend_sonyupdr150.c +++ b/backend_sonyupdr150.c @@ -69,7 +69,7 @@ static void* updr150_init(void) return ctx; } -static void updr150_attach(void *vctx, struct libusb_device_handle *dev, +static void updr150_attach(void *vctx, struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, uint8_t jobid) { struct updr150_ctx *ctx = vctx; @@ -86,7 +86,7 @@ static void updr150_attach(void *vctx, struct libusb_device_handle *dev, libusb_get_device_descriptor(device, &desc); ctx->type = lookup_printer_type(&updr150_backend, - desc.idVendor, desc.idProduct); + desc.idVendor, desc.idProduct); ctx->copies_offset = 0; } @@ -380,21 +380,21 @@ struct dyesub_backend updr150_backend = { Sony UP-CL10 / DNP SL-10 spool format: -60 ff ff ff +60 ff ff ff f8 ff ff ff -fd ff ff ff 14 00 00 00 1b 15 00 00 00 0d 00 00 00 00 00 07 00 00 00 00 WW WW HH HH +fd ff ff ff 14 00 00 00 1b 15 00 00 00 0d 00 00 00 00 00 07 00 00 00 00 WW WW HH HH fb ff ff ff f4 ff ff ff 0b 00 00 00 1b ea 00 00 00 00 SH SH SH SH 00 SL SL SL SL [[ Data, rows * cols * 3 bytes ]] -f3 ff ff ff 0f 00 00 00 1b e5 00 00 00 08 00 00 00 00 00 00 00 00 00 - 12 00 00 00 1b e1 00 00 00 0b 00 00 80 00 00 00 00 00 WW WW HH HH -fa ff ff ff 09 00 00 00 1b ee 00 00 00 02 00 00 NN - 07 00 00 00 1b 0a 00 00 00 00 00 -f9 ff ff ff -fc ff ff ff 07 00 00 00 1b 17 00 00 00 00 00 -f7 ff ff ff +f3 ff ff ff 0f 00 00 00 1b e5 00 00 00 08 00 00 00 00 00 00 00 00 00 + 12 00 00 00 1b e1 00 00 00 0b 00 00 80 00 00 00 00 00 WW WW HH HH +fa ff ff ff 09 00 00 00 1b ee 00 00 00 02 00 00 NN + 07 00 00 00 1b 0a 00 00 00 00 00 +f9 ff ff ff +fc ff ff ff 07 00 00 00 1b 17 00 00 00 00 00 +f7 ff ff ff WW WW == Columns, Big Endian HH HH == Rows, Big Endian diff --git a/blacklist b/blacklist index 191e97d..ed9399f 100644 --- a/blacklist +++ b/blacklist @@ -99,7 +99,7 @@ # Canon SELPHY ES20 0x04a9 0x3186 blacklist -# Canon SELPHY ES3 +# Canon SELPHY ES3 0x04a9 0x31af blacklist # Canon SELPHY ES30