Debian Codegraph @

src/cups/backend_sonyupdneo.c

raw symbols SCIP
1 /*
2 * Sony UP-D series (new) Photo Printer CUPS backend
3 *
4 * (c) 2019-2025 Solomon Peachy <[email protected]>
5 *
6 * The latest version of this program can be found at:
7 *
8 * https://git.shaftnet.org/gitea/slp/selphy_print.git
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <https://www.gnu.org/licenses/>.
22 *
23 * SPDX-License-Identifier: GPL-2.0+
24 *
25 */
26
27 #define BACKEND sonyupdneo_backend
28
29 #include "backend_common.h"
30
31 /* Private data structures */
32 struct updneo_printjob {
33 struct dyesub_job_common common;
34
35 uint8_t *databuf;
36 int datalen;
37 uint8_t *hdrbuf;
38 int hdrlen;
39 uint8_t *ftrbuf;
40 int ftrlen;
41
42 uint16_t rows;
43 uint16_t cols;
44 };
45
46 struct updneo_sts {
47 uint16_t scdiv;
48 uint32_t scsyv;
49 char scsno[17]; /* 16 char string, leading 0s, possibly trailing -- */
50 char scsys[23]; /* 22 char string, mostly unknown */
51 uint16_t scmds[5];
52 uint16_t scprs;
53 uint16_t scses;
54 uint16_t scwts;
55 uint16_t scjbs;
56 uint8_t scsye;
57 uint16_t scmde;
58 uint8_t scmce;
59 char scjbi[17]; /* 16 char string, unknown */
60 char scsyi[31]; /* 30 char string, max resolutions * 3, one more 6-char field */
61 uint32_t scsvi[2]; /* 2* 6char numbers */
62 uint32_t scmni[2]; /* 2* 6char numbers */
63 char sccai[15]; /* 14 char string, unknown */
64 uint16_t scgai;
65 uint8_t scgsi;
66 uint32_t scmdi; /* xxxyyy : xxx is ribbon type, yyy is paper type? */
67 uint32_t scqti;
68 uint32_t spuqi;
69 };
70
71 struct updneo_ctx {
72 struct dyesub_connection *conn;
73
74 int native_bpp;
75
76 struct updneo_sts sts;
77
78 struct marker marker;
79 };
80
81 /* Forward declaration */
82 static int updneo_get_status(struct updneo_ctx *ctx);
83
84 /* Now for the code */
85 static const char* updneo_decode_errors(uint16_t mde, uint8_t mce, uint8_t sye)
86 {
87 if (!mde && !mce && sye)
88 return "None";
89 if (mde == 0x0800 || mce == 0x1)
90 return "Cover open";
91 if (mce == 0x08)
92 return "Paper feed error";
93 if (mde == 0x0a00)
94 return "No paper loaded";
95 if (mde == 0x0002)
96 return "No ribbon loaded";
97 if (mde == 0x0300)
98 return "No media loaded";
99 if (mde == 0x2000)
100 return "Job does not match installed media";
101
102 return "Unknown";
103 }
104
105 static void* updneo_init(void)
106 {
107 struct updneo_ctx *ctx = malloc(sizeof(struct updneo_ctx));
108 if (!ctx) {
109 ERROR("Memory Allocation Failure!\n");
110 return NULL;
111 }
112 memset(ctx, 0, sizeof(struct updneo_ctx));
113 return ctx;
114 }
115
116 static const char *updneo_medias(uint32_t mdi)
117 {
118 uint32_t mdi2 = mdi >> 12;
119 mdi2 &= 0xfff;
120
121 switch(mdi2) {
122 case 0x110: return "UPC-R81MD (Letter)";
123 // unknown: UPC-R80MD (A4)
124 case 0x200:
125 if ((mdi & 0xfff) == 0x404) {
126 return "UPP-110 Roll"; // UPP-110HD, UPP-110HG, UPP-110S
127 } else if ((mdi & 0xfff) == 0x406) {
128 return "UPP-210 Roll"; // UPP-210HD, UPP-210SE, UPT-210BL
129 } else {
130 return "Unknown thermal roll";
131 }
132 break;
133 default: return "Unknown";
134 }
135 }
136
137 static int updneo_attach(void *vctx, struct dyesub_connection *conn, uint8_t jobid)
138 {
139 struct updneo_ctx *ctx = vctx;
140 int ret;
141
142 UNUSED(jobid);
143
144 ctx->conn = conn;
145
146 if (test_mode < TEST_MODE_NOATTACH) {
147 if ((ret = updneo_get_status(ctx))) {
148 return ret;
149 }
150
151 if (ctx->native_bpp == 1) /* Necessary for UP-D898 and 9x1 */
152 libusb_reset_device(ctx->conn->dev);
153 } else {
154 if (ctx->conn->type == P_SONY_UPD898) {
155 strcpy(ctx->sts.scsyi, "100005001000050000000000014500");
156 } else if (ctx->conn->type == P_SONY_UP9x1) {
157 strcpy(ctx->sts.scsyi, "1E000A001E000A0000000000014500");
158 } else if (ctx->conn->type == P_SONY_UPDR80) {
159 strcpy(ctx->sts.scsyi, "0A300E5609A00C7809A00C78012D00");
160 }
161 // XXX don't forget cr20l here!
162 }
163
164 if (test_mode >= TEST_MODE_NOATTACH && getenv("MEDIA_CODE"))
165 ctx->marker.numtype = strtol(getenv("MEDIA_CODE"), NULL, 16);
166 else
167 ctx->marker.numtype = (ctx->sts.scmdi >> 12) & 0xfff;
168
169 ctx->marker.name = updneo_medias(ctx->sts.scmdi);
170
171 if (ctx->conn->type == P_SONY_UPD898 || ctx->conn->type == P_SONY_UP9x1) {
172 ctx->marker.color = "#000000"; /* Ie black! */
173 ctx->native_bpp = 1;
174 ctx->marker.levelmax = CUPS_MARKER_UNAVAILABLE;
175 ctx->marker.levelnow = CUPS_MARKER_UNKNOWN;
176 } else {
177 ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
178 ctx->native_bpp = 3;
179 ctx->marker.levelmax = 50;
180 ctx->marker.numtype = (ctx->sts.scmdi >> 12) & 0xfff;
181 ctx->marker.levelnow = ctx->sts.scmds[4];
182 }
183
184 return CUPS_BACKEND_OK;
185 }
186
187 static void updneo_cleanup_job(const void *vjob)
188 {
189 const struct updneo_printjob *job = vjob;
190
191 if (job->databuf)
192 free(job->databuf);
193 if (job->hdrbuf)
194 free(job->hdrbuf);
195 if (job->ftrbuf)
196 free(job->ftrbuf);
197
198 free((void*)job);
199 }
200
201 #define MAX_PRINTJOB_LEN (3400*2392*3 + 2048)
202
203 static int updneo_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
204 struct updneo_ctx *ctx = vctx;
205 int run = 1;
206
207 uint8_t tmpbuf[257];
208
209 struct updneo_printjob *job = NULL;
210
211 if (!ctx)
212 return CUPS_BACKEND_FAILED;
213
214 /* Allocate job */
215 job = malloc(sizeof(*job));
216 if (!job) {
217 ERROR("Memory allocation failure!\n");
218 return CUPS_BACKEND_RETRY_CURRENT;
219 }
220 memset(job, 0, sizeof(*job));
221
222 /* Read in data chunks. */
223 while(run) {
224 uint8_t *ptr = NULL;
225 int i, len, *lenptr;
226
227 /* Read in data block header (256 bytes) */
228 i = read(data_fd, tmpbuf, 256);
229 if (i < 0) {
230 ERROR("Read failed (%d)\n", i);
231 updneo_cleanup_job(job);
232 return CUPS_BACKEND_CANCEL;
233 }
234 if (i == 0)
235 break;
236
237 /* Explicitly null terminate just in case */
238 tmpbuf[256] = 0;
239
240 /* Parse header. Format:
241
242 JOBSIZE=pdlname,blocklen,printsize,arg1,..,argN<NULL>
243
244 */
245
246 if (strncmp("JOBSIZE=", (char*) tmpbuf, 8)) {
247 updneo_cleanup_job(job);
248 ERROR("Invalid spool format!\n");
249 return CUPS_BACKEND_CANCEL;
250 }
251
252 /* PDL type */
253 char *tok = strtok((char*)&tmpbuf[8], "\r\n,");
254 if (!tok) {
255 updneo_cleanup_job(job);
256 ERROR("Invalid spool format (PDL)!\n");
257 return CUPS_BACKEND_CANCEL;
258 }
259
260 /* Payload length */
261 const char *tokl = strtok(NULL, "\r\n,");
262 if (!tokl) {
263 updneo_cleanup_job(job);
264 ERROR("Invalid spool format (block length missing)!\n");
265 return CUPS_BACKEND_CANCEL;
266 }
267 len = atoi(tokl);
268 if (len == 0 || len > MAX_PRINTJOB_LEN) {
269 updneo_cleanup_job(job);
270 ERROR("Invalid spool format (block length %d)!\n", len);
271 return CUPS_BACKEND_CANCEL;
272 }
273
274 /* Behavior based on the various PDL blocks */
275 if (!strncmp("PJL-H", tok, 5)) {
276 job->hdrbuf = malloc(len);
277 if (!job->hdrbuf) {
278 ERROR("Memory allocation failure!\n");
279 updneo_cleanup_job(job);
280 return CUPS_BACKEND_RETRY_CURRENT;
281 }
282 ptr = job->hdrbuf;
283 lenptr = &job->hdrlen;
284 } else if (!strncmp("PJL-T", tok, 5)) {
285 job->ftrbuf = malloc(len);
286 if (!job->ftrbuf) {
287 ERROR("Memory allocation failure!\n");
288 updneo_cleanup_job(job);
289 return CUPS_BACKEND_RETRY_CURRENT;
290 }
291 ptr = job->ftrbuf;
292 lenptr = &job->ftrlen;
293 run = 0;
294 } else if (!strncmp("PDL", tok, 3)) {
295 job->databuf = malloc(len);
296 if (!job->databuf) {
297 ERROR("Memory allocation failure!\n");
298 updneo_cleanup_job(job);
299 return CUPS_BACKEND_RETRY_CURRENT;
300 }
301 ptr = job->databuf;
302 lenptr = &job->datalen;
303 } else {
304 ERROR("Unrecognized PDL type '%s'\n", tok);
305 updneo_cleanup_job(job);
306 return CUPS_BACKEND_CANCEL;
307 }
308
309 // DEBUG("Read block '%s' @ %d ...\n", tok, job->datalen);
310
311 // DEBUG("...len '%d'\n", len);
312
313 // parse the rest?
314 // 898MD: 6,0,0,0
315 // D80MD: 4
316 // CR20L: 64,0,0,0
317
318 /* Read in the data chunk */
319 while(len > 0) {
320 i = read(data_fd, ptr + *lenptr, len);
321 if (i < 0) {
322 updneo_cleanup_job(job);
323 return CUPS_BACKEND_CANCEL;
324 }
325 if (i == 0)
326 break;
327
328 *lenptr += i;
329 len -= i;
330 }
331 }
332
333 if (!job->datalen || !job->hdrlen || !job->ftrlen) {
334 if (job->datalen + job->hdrlen + job->ftrlen) {
335 ERROR("Necessary block missing!\n");
336 }
337 updneo_cleanup_job(job);
338 return CUPS_BACKEND_CANCEL;
339 }
340
341 /* Sanity check job parameters */
342
343 /* Validate against max print size in SCSYI */
344 {
345 char w[5], h[5];
346 uint16_t mw, mh;
347 uint16_t jw, jh;
348 memcpy(w, ctx->sts.scsyi, 4);
349 h[4] = 0;
350 memcpy(h, ctx->sts.scsyi + 4, 4);
351 w[4] = 0;
352
353 if (ctx->conn->type == P_SONY_UPD898 || ctx->conn->type == P_SONY_UP9x1) {
354 mw = strtol(h, NULL, 16);
355 mh = strtol(w, NULL, 16);
356 } else {
357 mw = strtol(w, NULL, 16);
358 mh = strtol(h, NULL, 16);
359 }
360
361 if (ctx->conn->type == P_SONY_UPDR80) {
362 memcpy(&jw, job->databuf + 84, 2);
363 memcpy(&jh, job->databuf + 84 + 2, 2);
364 } else {
365 memcpy(&jw, job->databuf + 40, 2);
366 memcpy(&jh, job->databuf + 40 + 2, 2);
367 }
368
369 jw = be16_to_cpu(jw);
370 jh = be16_to_cpu(jh);
371
372 if (mw && mh && (jw > mw || jh > mh)) {
373 ERROR("Job (%d/%d) exceeds max dimensions(%d/%d)\n",
374 jw,jh,mw,mh);
375 updneo_cleanup_job(job);
376 return CUPS_BACKEND_CANCEL;
377 }
378 }
379
380 // XXX Check vs loaded media type (ctx->marker.numtype?)
381
382 // XXX set job copies to max(job, parameter)?
383 /* Find copy offset */
384 for (int i = 0 ; i < 312 ; i++ ) {
385 if (job->databuf[i] == 0x02 &&
386 job->databuf[i+1] == 0x00 &&
387 job->databuf[i+2] == 0x09) {
388 if (job->databuf[i+4] < copies)
389 job->databuf[i+4] = copies;
390 else
391 copies = job->databuf[i+4];
392 break;
393 }
394 }
395 job->common.copies = copies;
396
397 *vjob = job;
398
399 return CUPS_BACKEND_OK;
400 }
401
402 static int dlen;
403 static struct deviceid_dict dict[MAX_DICT];
404
405 static int updneo_get_status(struct updneo_ctx *ctx)
406 {
407 char *ieee_id = get_device_id(ctx->conn->dev, ctx->conn->iface);
408 int i;
409
410 if (!ieee_id)
411 return CUPS_BACKEND_FAILED;
412
413 dlen = parse1284_data(ieee_id, dict);
414
415 /* Don't forget to log! */
416 if (dyesub_debug >= 1) {
417 DEBUG("IEEE1284: (%d) %s\n", dlen, ieee_id);
418 }
419
420 /* Parse out data */
421 for (i = 0; i < dlen ; i++) {
422 if(!dict[i].key || !dict[i].val)
423 continue;
424 if (!strcmp("SCDIV", dict[i].key)) {
425 ctx->sts.scdiv = strtol(dict[i].val, NULL, 16);
426 } else if (!strcmp("SCSYV", dict[i].key)) {
427 ctx->sts.scsyv = strtol(dict[i].val, NULL, 16);
428 } else if (!strcmp("SCSNO", dict[i].key)) {
429 strncpy(ctx->sts.scsno, dict[i].val, sizeof(ctx->sts.scsno) - 1);
430
431 /* Trim trailing '-'s off of serial number (UP-D898, UP-9x1), UP-DR80MD, etc */
432 for (int j = 0; j < (int) sizeof(ctx->sts.scsno); j++) {
433 if (ctx->sts.scsno[j] == '-') {
434 ctx->sts.scsno[j] = 0;
435 break;
436 }
437 }
438 } else if (!strcmp("SCSYS", dict[i].key)) {
439 strncpy(ctx->sts.scsys, dict[i].val, sizeof(ctx->sts.scsys) - 1);
440 } else if (!strcmp("SCMDS", dict[i].key)) {
441 int j;
442 char buf[5];
443 buf[4] = 0;
444 for (j = 0 ; j < 5 ; j++) {
445 memcpy(buf, dict[i].val + (4*j), 4);
446 ctx->sts.scmds[j] = strtol(buf, NULL, 16);
447 }
448 } else if (!strcmp("SCPRS", dict[i].key)) {
449 ctx->sts.scprs = strtol(dict[i].val, NULL, 16);
450 } else if (!strcmp("SCSES", dict[i].key)) {
451 ctx->sts.scses = strtol(dict[i].val, NULL, 16);
452 } else if (!strcmp("SCWTS", dict[i].key)) {
453 ctx->sts.scwts = strtol(dict[i].val, NULL, 16);
454 } else if (!strcmp("SCJBS", dict[i].key)) {
455 ctx->sts.scjbs = strtol(dict[i].val, NULL, 16);
456 } else if (!strcmp("SCSYE", dict[i].key)) {
457 ctx->sts.scsye = strtol(dict[i].val, NULL, 16);
458 } else if (!strcmp("SCMDE", dict[i].key)) {
459 ctx->sts.scmde = strtol(dict[i].val, NULL, 16);
460 } else if (!strcmp("SCMCE", dict[i].key)) {
461 ctx->sts.scmce = strtol(dict[i].val, NULL, 16);
462 } else if (!strcmp("SCJBI", dict[i].key)) {
463 strncpy(ctx->sts.scjbi, dict[i].val, sizeof(ctx->sts.scjbi) - 1);
464 } else if (!strcmp("SCSYI", dict[i].key)) {
465 strncpy(ctx->sts.scsyi, dict[i].val, sizeof(ctx->sts.scsyi) - 1);
466 } else if (!strcmp("SCSVI", dict[i].key)) {
467 int j;
468 char buf[7];
469 buf[6] = 0;
470 for (j = 0 ; j < 2 ; j++) {
471 memcpy(buf, dict[i].val + (6*j), 6);
472 ctx->sts.scsvi[j] = strtol(buf, NULL, 16);
473 }
474 } else if (!strcmp("SCMNI", dict[i].key)) {
475 int j;
476 char buf[7];
477 buf[6] = 0;
478 for (j = 0 ; j < 2 ; j++) {
479 memcpy(buf, dict[i].val + (6*j), 6);
480 ctx->sts.scmni[j] = strtol(buf, NULL, 16);
481 }
482 } else if (!strcmp("SCCAI", dict[i].key)) {
483 strncpy(ctx->sts.sccai, dict[i].val, sizeof(ctx->sts.sccai) - 1);
484 } else if (!strcmp("SCGAI", dict[i].key)) {
485 ctx->sts.scgai = strtol(dict[i].val, NULL, 16);
486 } else if (!strcmp("SCGSI", dict[i].key)) {
487 ctx->sts.scgsi = strtol(dict[i].val, NULL, 16);
488 } else if (!strcmp("SCMDI", dict[i].key)) {
489 ctx->sts.scmdi = strtol(dict[i].val, NULL, 16);
490 } else if (!strcmp("SCQTI", dict[i].key)) {
491 ctx->sts.scqti = strtol(dict[i].val, NULL, 16);
492 } else if (!strcmp("SPUQI", dict[i].key)) {
493 ctx->sts.spuqi = strtol(dict[i].val, NULL, 16);
494 } else if (!strcmp("MFG", dict[i].key) ||
495 !strcmp("MDL", dict[i].key) ||
496 !strcmp("DES", dict[i].key) ||
497 !strcmp("CMD", dict[i].key) ||
498 !strcmp("CLS", dict[i].key)) {
499 /* Ignore standard IEEE1284 attributes! */
500 } else {
501 if (!strncmp("SC", dict[i].key, 2) || !strncmp("SP", dict[i].key, 2))
502 DEBUG("Extra/Unknown IEEE1284 field '%s' = '%s'\n",
503 dict[i].key, dict[i].val);
504 }
505
506 };
507
508 /* Clean up */
509 if (ieee_id) free(ieee_id);
510 while (dlen--) {
511 free (dict[dlen].key);
512 free (dict[dlen].val);
513 }
514
515 return CUPS_BACKEND_OK;
516 }
517
518 static void updneo_dump_status(struct updneo_ctx *ctx, struct updneo_sts *sts)
519 {
520 /* Dump status */
521 INFO("Serial Number: %s\n", sts->scsno);
522 INFO("Firmware Version: %02x.%02x.%02x.%02x\n",
523 (sts->scsyv >> 24) & 0xff,
524 (sts->scsyv >> 16) & 0xff,
525 (sts->scsyv >> 8) & 0xff,
526 (sts->scsyv >> 0) & 0xff);
527 INFO("Media type: %s\n", updneo_medias(sts->scmdi));
528
529 if (ctx->conn->type == P_SONY_UPDR80)
530 INFO("Remaining prints: %u/50\n", sts->scmds[4]);
531
532 INFO("Print count: %u\n", sts->scsvi[0]);
533
534 /* If the printer reports an error, pass it on */
535 if (sts->scmde || sts->scmce || sts->scsye) {
536 ERROR("Printer error: %s (MD=%04x, MC=%02x, SY=%02x)\n",
537 updneo_decode_errors(sts->scmde, sts->scmce, sts->scsye),
538 sts->scmde, sts->scmce, sts->scsye);
539 }
540 }
541
542 static int updneo_main_loop(void *vctx, const void *vjob, int wait_for_return) {
543 struct updneo_ctx *ctx = vctx;
544 int ret;
545
546 const struct updneo_printjob *job = vjob;
547
548 if (!ctx)
549 return CUPS_BACKEND_FAILED;
550 if (!job)
551 return CUPS_BACKEND_FAILED;
552
553 // XXX update/insert stream to include job->common.copies parameter
554 top:
555
556 /* Query printer status */
557 if ((ret = updneo_get_status(ctx))) {
558 return ret;
559 }
560
561 /* If the printer reports an error, bail */
562 if (ctx->sts.scmde || ctx->sts.scmce || ctx->sts.scsye) {
563 ERROR("Printer error: %s (MD=%04x, MC=%02x, SY=%02x)\n",
564 updneo_decode_errors(ctx->sts.scmde, ctx->sts.scmce, ctx->sts.scsye),
565 ctx->sts.scmde, ctx->sts.scmce, ctx->sts.scsye);
566 return CUPS_BACKEND_STOP;
567 }
568 /* Wait for the printer to become idle */
569 if (ctx->sts.scprs) {
570 sleep(1);
571 goto top;
572 }
573
574 /* Send over header */
575 if ((ret = send_data(ctx->conn,
576 job->hdrbuf, job->hdrlen)))
577 return CUPS_BACKEND_FAILED;
578
579 /* Send over data */
580 if ((ret = send_data(ctx->conn,
581 job->databuf, job->datalen)))
582 return CUPS_BACKEND_FAILED;
583
584 /* Send over footer */
585 if ((ret = send_data(ctx->conn,
586 job->ftrbuf, job->ftrlen)))
587 return CUPS_BACKEND_FAILED;
588
589 /* Wait for completion! */
590 retry:
591 sleep(1);
592
593 if ((ret = updneo_get_status(ctx))) {
594 return ret;
595 }
596
597 /* If the printer reports an error, bail */
598 if (ctx->sts.scmde || ctx->sts.scmce || ctx->sts.scsye) {
599 ERROR("Printer error: %s (MD=%04x, MC=%02x, SY=%02x)\n",
600 updneo_decode_errors(ctx->sts.scmde, ctx->sts.scmce, ctx->sts.scsye),
601 ctx->sts.scmde, ctx->sts.scmce, ctx->sts.scsye);
602 return CUPS_BACKEND_STOP;
603 }
604
605 /* See if we're busy... */
606 if (ctx->sts.scprs != 0) {
607 if (!wait_for_return) {
608 INFO("Fast return mode enabled.\n");
609 } else {
610 goto retry;
611 }
612 }
613
614 INFO("Print complete\n");
615
616 if (ctx->native_bpp == 1) /* Necessary for UP-D898 and 9x1 */
617 libusb_reset_device(ctx->conn->dev);
618
619 return CUPS_BACKEND_OK;
620 }
621
622 static void updneo_cmdline(void)
623 {
624 DEBUG("\t\t[ -s ] # Query status\n");
625 }
626
627 static int updneo_cmdline_arg(void *vctx, int argc, char **argv)
628 {
629 struct updneo_ctx *ctx = vctx;
630 int i, j = 0;
631
632 if (!ctx)
633 return -1;
634
635 while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "s")) >= 0) {
636 switch(i) {
637 GETOPT_PROCESS_GLOBAL
638 case 's':
639 j = updneo_get_status(ctx);
640 if (!j)
641 updneo_dump_status(ctx, &ctx->sts);
642 break;
643 }
644
645 if (j) return j;
646 }
647
648 return CUPS_BACKEND_OK;
649 }
650
651 static int updneo_query_serno(struct dyesub_connection *conn, char *buf, int buf_len)
652 {
653 int ret;
654 char *ptr;
655 struct updneo_ctx ctx = {
656 .conn = conn,
657 };
658 if ((ret = updneo_get_status(&ctx))) {
659 return ret;
660 }
661 ptr = ctx.sts.scsno;
662 while (*ptr == 0x30) ptr++;
663 strncpy(buf, ptr, buf_len);
664 buf[buf_len-1] = 0;
665 return CUPS_BACKEND_OK;
666 }
667
668 static int updneo_query_markers(void *vctx, struct marker **markers, int *count)
669 {
670 struct updneo_ctx *ctx = vctx;
671 int ret;
672
673 *markers = &ctx->marker;
674 *count = 1;
675
676 /* Query printer status */
677 if ((ret = updneo_get_status(ctx))) {
678 return ret;
679 }
680
681 if (ctx->conn->type != P_SONY_UPD898 && ctx->conn->type != P_SONY_UP9x1) {
682 ctx->marker.levelnow = ctx->sts.scmds[4];
683 }
684
685 return CUPS_BACKEND_OK;
686 }
687
688 static const char *sonyupdneo_prefixes[] = {
689 "sonyupdneo", /* Family Name */
690 "dnp-sl20", // extra, unknown if shared with CR20L
691 NULL
692 };
693
694 static const struct device_id sonyupdneo_devices[] = {
695 { 0x054c, 0x0877, P_SONY_UPD898, NULL, "sony-upd898"},
696 // { 0x054c, 0x589a, P_SONY_UPD898, NULL, "sony-upd898"}, // ???
697 { 0x054c, 0xbcde, P_SONY_UPCR20L, NULL, "sony-upcr20l"}, // XXXX
698 { 0x054c, 0x03c5, P_SONY_UPDR80, NULL, "sony-updr80"},
699 { 0x054c, 0x03c3, P_SONY_UPDR80, NULL, "sony-updr80md"},
700 { 0x054c, 0x03c4, P_SONY_UPDR80, NULL, "stryker-sdp1000"},
701 { 0x054c, 0x0873, P_SONY_UP9x1, NULL, "sony-up971ad"},
702 // { 0x054c, 0x0873, P_SONY_UP9x1, NULL, "sony-up991ad"}, // Dupe ?
703 { 0, 0, 0, NULL, NULL}
704 };
705
706 const struct dyesub_backend sonyupdneo_backend = {
707 .name = "Sony UP-D Neo",
708 .version = "0.23",
709 .flags = BACKEND_FLAG_BADISERIAL, /* UP-D898MD at least */
710 .uri_prefixes = sonyupdneo_prefixes,
711 .devices = sonyupdneo_devices,
712 .cmdline_arg = updneo_cmdline_arg,
713 .cmdline_usage = updneo_cmdline,
714 .init = updneo_init,
715 .attach = updneo_attach,
716 .cleanup_job = updneo_cleanup_job,
717 .read_parse = updneo_read_parse,
718 .main_loop = updneo_main_loop,
719 .query_markers = updneo_query_markers,
720 .query_serno = updneo_query_serno,
721 };
722
723 /* Sony UP-D (new) printer spool format
724
725 Covers UP-CR20L, UP-DR80/DR80MD, UP-D898/UP-X898
726
727 HP-PJL wrapper around custom Sony PDL:
728
729 JOBSIZE=PJL-H,size,arg1,arg2,etc [null terminated, padded to 256 bytes]
730 [ size bytes of PJL header! ]
731 JOBSIZE=PDL,size,args [null terminated, padded to 256 bytes]
732 [ size bytes of PDL data! ]
733 JOBSIZE=PJL-T,size,args [null terminated, padded to 256 bytes]
734 [ size bytes of PJL trailer! ]
735
736 PJL header:
737
738 <ESC>%-12345X<CR><LF>
739 @PJL COMMENT free form text here <CR><LF>
740 @PJL JOB NAME="name me" ID="someid"<CR><LF>
741 @PJL .... <CR><LF>
742 @PJL ENTER LANGUAGE=SONY-PDL-DS2<CR><LF>
743
744 PJL footer:
745
746 @PJL EOJ<CR><LF>
747 <ESC>%-12345X<CR><LF>
748
749 PDL notes:
750
751 size is the length mentioned in the payload (ie rows * cols * planes)
752 plus the PDL header (varies) and PDL footer (7 bytes)
753
754 Note: All multi-byte values are BIG ENDIAN
755
756 UP-D898MD: 18*16+2 == 290 byte header
757
758 00000250 00 00 YY YY = rows
759 00000260 01 00 00 10 0f 00 1c 00 00 00 00 00 00 00 00 00 XX XX = columns (fixed at 05 00)
760 00000270 00 00 00 00 00 01 02 00 09 00 NN 01 00 11 01 08 NN = Copies (01..?) <-- GUESS
761 00000280 00 1a 00 00 00 00 XX XX YY YY 09 00 28 01 00 d4
762 00000290 00 00 03 58 YY YY 00 00 13 01 00 04 00 80 00 23
763 000002a0 00 0c 01 09 XX XX YY YY 00 00 00 00 08 ff 08 00
764 000002b0 19 00 00 00 00 XX XX YY YY 00 00 81 80 00 8f 00
765 000002c0 b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
766 000002d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
767 000002f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
768 00000300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
769 00000310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
770 00000320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
771 00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
772 00000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
773 00000350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
774 00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
775 00000370 00 00 00 00 00 00 00 00 00 c0 00 82 LL LL LL LL LL == payload bytes, BE (== XX * YY * 1)
776
777 [payload of LL bytes follows]
778
779 UP-971/991AD 18*16+2 == 290 byte header
780
781 00000250 00 00 XX XX = columns (fixed at 0a 00)
782 00000260 01 00 00 10 0f 00 1c 00 00 00 00 00 00 00 00 00 YY YY = rows (varies)
783 00000270 00 00 SS TT TT GG 02 00 09 00 NN 01 00 11 01 08 SS == sharpening (00-0e)
784 00000280 00 1a 00 00 00 00 XX XX YY YY 09 00 28 01 01 26 GG == gamma (00/01/02 == 1/2/3)
785 00000290 00 00 07 b3 YY YY 00 00 13 01 00 04 00 80 00 23 TT TT == tone, +-32 (signed, BE)
786 000002a0 00 0c 01 09 XX XX YY YY 00 00 00 00 08 ff 08 00 NN == copies (00 for printer, 01-???)
787 000002b0 19 00 00 00 00 XX XX YY YY 00 00 81 80 00 8f 00
788 000002c0 b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
789 000002d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
790 000002e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
791 000002f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
792 00000300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
793 00000310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
794 00000320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
795 00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
796 00000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
797 00000350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
798 00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
799 00000370 00 00 00 00 00 00 00 00 00 c0 00 82 LL LL LL LL LL == payload bytes, BE (== XX * YY * 1)
800
801 UP-CR20L: 290 byte header, 330 dpi, 1210x1728/1382x2048/1728*2380/2724*2048 (L/PC/2L/2PC)
802
803 00000250 00 00
804 00000260 01 00 00 10 0f 00 1c 00 00 00 00 00 00 00 00 00
805 00000270 00 00 01 00 00 00 02 00 16 00 00 02 00 09 00 NN NN = Copies (01..??)
806 00000280 02 00 06 01 01 03 00 1d 00 00 00 01 00 20 01 01
807 00000290 00 27 40 01 00 11 01 08 00 1a 00 00 00 00 RR RR
808 000002a0 CC CC 00 00 13 01 00 04 00 80 00 23 00 10 03 00 CC CC == Columns (BE)
809 000002b0 RR RR CC CC 00 00 00 00 08 08 08 ff ff ff 01 00 RR RR == Rows (BE)
810 000002c0 17 00 08 00 19 00 00 00 00 RR RR CC CC 00 00 81
811 000002d0 80 00 8f 00 a4 00 00 00 00 00 00 00 00 00 00 00
812 000002e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
813 000002f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
814 00000300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
815 00000310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
816 00000320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
817 00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
818 00000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
819 00000350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
820 00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
821 00000370 00 00 00 00 00 00 00 00 00 c0 00 82 LL LL LL LL LL == payload bytes, BE (== RR * CC * 3)
822
823 [payload of LL bytes follows]
824
825 UP-DR80MD: (19*16+8) = 312 byte header (A4 = 3400x2392, Letter = 3192*2464)
826
827 00000240 00 00 01 00 00 10 0f 00
828 00000250 1c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ZZ ZZ = 0x00 (Letter) 0x56 (A4)
829 00000260 02 00 16 00 01 80 00 15 00 12 55 50 44 52 38 30 SS = 0x00 (LUT0) 0xff (No LUT)
830 00000270 00 00 4c 55 54 QQ 00 00 00 00 00 SS 02 00 09 00 QQ = 0x30 (LUT0) 0x2f (No LUT)
831 00000280 NN 02 00 06 01 03 04 00 1d 01 00 00 05 01 00 20 NN = Copies (01...??)
832 00000290 00 01 00 11 01 08 00 1a 00 00 00 00 CC CC RR RR RR RR = Rows (BE)
833 000002a0 00 00 13 01 00 04 00 80 00 23 00 10 03 00 CC CC CC CC = Cols (BE)
834 000002b0 RR RR 00 00 00 00 08 08 08 ff ff ff 01 00 17 00
835 000002c0 08 00 19 00 00 00 00 CC CC RR RR 00 00 81 80 00
836 000002d0 8f 00 a6 00 00 00 00 00 00 00 00 00 00 00 00 00
837 000002e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
838 000002f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
839 00000300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
840 00000310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
841 00000320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
842 00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
843 00000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
844 00000350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
845 00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
846 00000370 00 00 00 00 00 00 00 00 00 c0 00 82 LL LL LL LL LL == payload, BE (== RR * CC * 3)
847
848 [payload of LL bytes follows]
849
850 *********
851
852 898 Format:
853
854 00 00 01
855 00 00 10
856 0f 00 1c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
857 02 00 09 00 NN
858 01 00 11 01
859 08 00 1a 00 00 00 00 XX XX YY YY
860 09 00 28 01 00 d4 00 00 03 58 YY YY
861 00 00 13
862 01 00 04 00
863 80 00 23 00 0c 01 09 XX XX YY YY 00 00 00 00 08 ff
864 08 00 19 00 00 00 00 XX XX YY YY
865 00 00 81
866 80 00 8f ## ## [ follwed by ## zeros ] [ b8 on 898 ]
867 c0 00 82 LL LL LL LL
868
869 DR80MD format:
870
871 00 00 01
872 00 00 10
873 0f 00 1c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ZZ
874 02 00 16 00 01
875 80 00 15 00 12 55 50 44 52 38 30 00 00 4c 55 54 QQ 00 00
876 00 00 00 SS
877 02 00 09 00 NN
878 02 00 06 01 03
879 04 00 1d 01 00 00 05
880 01 00 20 00
881 01 00 11 01
882 08 00 1a 00 00 00 00 CC CC RR RR
883 00 00 13
884 01 00 04 00
885 80 00 23 00 10 03 00 CC CC RR RR 00 00 00 00 08 08 08 ff
886 ff ff 01 00 17 00
887 08 00 19 00 00 00 00 CC CC RR RR
888 00 00 81
889 80 00 8f ## ## [ followed by ## zeros ] [ a6 on dr80md ]
890 c0 00 82 LL LL LL LL
891
892 CR20L format:
893
894 00 00 01
895 00 00 10
896 0f 00 1c 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00
897 02 00 16 00 00
898 02 00 09 00 NN
899 02 00 06 01 01
900 03 00 1d 00 00 00
901 03 00 13 00 01 02 [ only when multicut is on ]
902 01 00 20 01
903 01 00 27 40
904 01 00 11 01
905 08 00 1a 00 00 00 00 RR RR CC CC
906 00 00 13
907 01 00 04 00
908 80 00 23 00 10 03 00 RR RR CC CC 00 00 00 00 08 08 08 ff
909 ff ff 01 00 17 00
910 08 00 19 00 00 00 00 RR RR CC CC
911 00 00 81
912 80 00 8f ## ## [ followed by ## zeros ] [ a4/9d if mcut is off/on ]
913 c0 00 82 LL LL LL LL
914
915 *** COMBINED / COMMON :
916
917 XX ZZ ZZ [ XX = length, ZZ = code, followed by XX bytes ]
918
919 00 00 01
920 00 00 10
921 0f 00 1c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ZZ [ ZZ = pagecode; 01 for 898, 00 for CR20L, 00/56 for Letter/A4 on DR80MD ]
922 02 00 09 00 NN [ NN = copies ]
923 01 00 11 01
924 08 00 1a 00 00 00 00 CC CC RR RR [ CC = cols, RR = rows ]
925 00 00 13
926 01 00 04 00
927 [ more/unique stuff in here ]
928 [ always ends with these ]
929 08 00 19 00 00 00 00 RR RR CC CC
930 00 00 81
931 80 00 8f ## ## [ follwed by ## zeros, pad to fill out header ]
932 c0 00 82 LL LL LL LL
933
934 *** 898 unique [ 290 byte header ]
935
936 09 00 28 01 00 d4 00 00 03 58 CC CC
937 80 00 23 00 0c 01 09 RR RR CC CC 00 00 00 00 08 ff
938 ^^ ^^
939 length of data to follow
940
941 ** CR20L unique [ 290 byte header ]
942
943 03 00 1d 00 00 00
944 03 00 13 00 01 02 [ only when multicut is on ]
945 01 00 27 40
946
947 02 00 16 00 00
948 02 00 06 01 01
949 01 00 20 01
950
951 80 00 23 00 10 03 00 RR RR CC CC 00 00 00 00 08 08 08 ff ff ff
952 01 00 17 00
953
954 ** DR80MD unique [ 312 byte header ]
955
956 80 00 15 00 12 55 50 44 52 38 30 00 00 4c 55 54 QQ 00 00
957 00 00 00 SS [ SS/QQ = LUT (See above) ]
958 04 00 1d 01 00 00 05
959
960 02 00 16 00 01
961 02 00 06 01 03
962 01 00 20 00
963
964 80 00 23 00 10 03 00 RR RR CC CC 00 00 00 00 08 08 08 ff ff ff
965 01 00 17 00
966
967 *****************
968
969 PRINTER COMMS:
970
971 * Strip out "JOBSIZE=" headers
972 * Send PJL header
973 * Send PDL payload (every 9*256KB, do a status query..)
974 * Send PJL footer
975
976 PJL header and footer need to be sent separately.
977 the PJL wrapper around the PDL block needs to be
978 stripped.
979
980 ***********
981
982 It appears that the printer status is tacked onto the IEEE1284 string: Examples:
983
984 IDLE
985 MFG:SONY;MDL:UP-DR80MD;DES:Sony UP-DR80MD;CMD:SPJL-DS,SPDL-DS;CLS:PRINTER;SCDIV:0100;SCSYV:01060000;SCSNO:0000000000089864;SCSYS:0000001000010001000100;SCMDS:00000000002C002C002C;SCPRS:0000;SCSES:0000;SCWTS:0000;SCJBS:0000;SCSYE:00;SCMDE:0000;SCMCE:00;SCJBI:0000000000000000;SCSYI:0A300E5609A00C7809A00C78012D00;SCSVI:000342000342;SCMNI:000342000342;SCCAI:00000000000000;SCGAI:0000;SCGSI:00;SCMDI:110154
986
987 DATA XFER:
988 MFG:SONY;MDL:UP-DR80MD;DES:Sony UP-DR80MD;CMD:SPJL-DS,SPDL-DS;CLS:PRINTER;SCDIV:0100;SCSYV:01060000;SCSNO:0000000000089864;SCSYS:0000011000010001000000;SCMDS:00000000002C002C002C;SCPRS:0005;SCSES:0000;SCWTS:0000;SCJBS:0000;SCSYE:00;SCMDE:0000;SCMCE:00;SCJBI:0000000000000000;SCSYI:0A300E5609A00C7809A00C78012D00;SCSVI:000342000342;SCMNI:000342000342;SCCAI:00000000000000;SCGAI:0000;SCGSI:00;SCMDI:110154
989
990 NO PAPER:
991 MFG:SONY;MDL:UP-DR80MD;DES:Sony UP-DR80MD;CMD:SPJL-DS,SPDL-DS;CLS:PRINTER;SCDIV:0100;SCSYV:01060000;SCSNO:0000000000089864;SCSYS:0000003800010000000100;SCMDS:00000000000000000000;SCPRS:0000;SCSES:0000;SCWTS:0000;SCJBS:0000;SCSYE:00;SCMDE:0A00;SCMCE:00;SCJBI:0000000000000000;SCSYI:0A300E560000000000000000012D00;SCSVI:000345000345;SCMNI:000345000345;SCCAI:00000000000000;SCGAI:0000;SCGSI:00;SCMDI:1100FF
992
993 NO RIBBON:
994 MFG:SONY;MDL:UP-DR80MD;DES:Sony UP-DR80MD;CMD:SPJL-DS,SPDL-DS;CLS:PRINTER;SCDIV:0100;SCSYV:01060000;SCSNO:0000000000089864;SCSYS:0000003800010000000100;SCMDS:00000000000000000000;SCPRS:0000;SCSES:0000;SCWTS:0000;SCJBS:0000;SCSYE:00;SCMDE:0002;SCMCE:00;SCJBI:0000000000000000;SCSYI:0A300E5609A00C7809A00C78012D00;SCSVI:000345000345;SCMNI:000345000345;SCCAI:00000000000000;SCGAI:0000;SCGSI:00;SCMDI:000154
995
996 COVER OPEN:
997 MFG:SONY;MDL:UP-DR80MD;DES:Sony UP-DR80MD;CMD:SPJL-DS,SPDL-DS;CLS:PRINTER;SCDIV:0100;SCSYV:01060000;SCSNO:0000000000089864;SCSYS:0000001800010000000100;SCMDS:00000000000000000000;SCPRS:0000;SCSES:0000;SCWTS:0000;SCJBS:0000;SCSYE:00;SCMDE:0800;SCMCE:01;SCJBI:0000000000000000;SCSYI:0A300E560000000000000000012D00;SCSVI:000345000345;SCMNI:000345000345;SCCAI:00000000000000;SCGAI:0000;SCGSI:00;SCMDI:1100FF
998
999 Stryker SDP1000
1000
1001 MFG:Stryker;MDL:SDP1000;DES:Stryker SDP1000;CMD:SPJL-DS,SPDL-DS2;CLS:PRINTER;SCDIV:0100;SCSYV:01010000;SCSNO:0000000000083389;SCSYS:0000001000010000000100;SCMDS:00000000002D002D002D;SCPRS:0000;SCSES:0000;SCWTS:0000;SCJBS:0000;SCSYE:00;SCMDE:0000;SCMCE:00;SCJBI:0000000000000000;SCSYI:0A300E5609A00C7809A00C78012D00;SCSVI:000047000047;SCMNI:000047000047;SCCAI:00000000000000;SCGAI:0000;SCGSI:00;SCMDI:110154;
1002
1003 [ Notable difference is SCSYI ]
1004
1005 UP-DR898MD
1006
1007 MFG:Sony;MDL:UP-D898MD_X898MD;DES:Sony UP-D898MD_X898MD;CMD:SPJL-DS,SPDL-DS2;CLS:PRINTER;SCDIV:0100;SCSYV:01010000;SCSYS:0000001000010000000000;SCMDS:00000500000100000000;SCSYE:00;SCMDE:0000;SCMCE:00;SCSYI:100005001000050000000000014500;SCSVI:000204000204;SCMDI:200406;SCSNO:7100886---------;SCJBS:0000;SCCAI:00000000000000;SCGSI:01;SCQTI:0001;SPUQI:0000
1008
1009 [ This adds SCQTI; SCSNO is formatted differently, no SCPRS/SCJBI ]
1010
1011 UP-971AD / UP-991AD
1012
1013 MFG:Sony;MDL:UP-991AD_971AD;DES:Sony UP-991AD_971AD;CMD:SPJL-DS,SPDL-DS2;CLS:PRINTER;SCDIV:0100;SCSYV:01050000;SCSYS:0000001000010000000000;SCMDS:00000500000100000000;SCSYE:00;SCMDE:0000;SCMCE:00;SCSYI:1E000A001E000A0000000000014500;SCSVI:000002000002;SCMDI:200404;SCSNO:0739166---------;SCJBS:0000;SCCAI:00000000000000;SCGSI:00;SCQTI:0001;SPUQI:0000
1014
1015 [ Appears to be largely similar to 898 series ]
1016
1017 Breakdown:
1018
1019 (+) means referenced by their Windows driver
1020
1021 SCDIV # Data Info Version (?) Always seems to be 0100
1022 +SCSYV # SYstemVersion (?) (01.06.00.00) ??
1023 SCSNO # SerialNO
1024 +SCSYS # SystemStatus (?) some sort of state array? 22 fields. b19 is 1 when data can be sent?, b5 is 1 when printer busy?, b20:21 is 64 sometimes, maybe paper or ribbon feed. b6:7 is 38 with no paper&|ribbon, or 18 with cover open
1025 +SCMDS # MeDiaStatus: five 4-value hex numbers, last three decrease in unison (remaining prints). second one is 0000/0100/0200/0300/0600, maybe Y/M/C/O?
1026 SCPRS # PRinterStatus: (0000 = idle, 0002 = printing, 0005 = data xfer?)
1027 +SCSES # "SE" Status
1028 +SCWTS # "WT" Status
1029 +SCJBS # JoBStatus (?)
1030 SCSYE # SYstemError (?)
1031 +SCMDE # MeDiaError: 2000 media mismatch, 0A00 no paper, 0800 cover open, 0002 no ribbon
1032 +SCMCE # MediaCoverError: 01 cover open, 08 jam/feed problem?
1033 SCJBI # JoBInfo (?)
1034 SCSYI # SYstemInfo (?) Includes legal job max dimensions/parameters; up to three dimension sets and a fourth unknown field
1035 +SCSVI # print counter(s)? (XXXXXXYYYYYY, and X = Y so far. SCSVI and SCMNI are identical so far)
1036 SCMNI # print counter(s)? (see SCSVI)
1037 SCCAI # "CA" Info (?)
1038 SCGAI # "GA" Info (?)
1039 SCGSI # "GS" Info (?)
1040 +SCMDI # MeDiaInfo: 110154 OK w/UPD-R81MD(Letter), 1100FF with no paper, 000154 with no ribbon, 200404 on A4 thermal printers, 2000406 on A6 thermal printers?
1041 SCQTI # "QT" Info (?) (898MD, UP9x1)
1042 SPUQI # "UQ" Info (?) (898MD, UP9x1)
1043
1044 Guess:
1045
1046 SCxxy SC = Sony Corp
1047 xx = class/field (eg MD = media)
1048 y = var type (S = status, I = info, E = error V = version, O
1049
1050 */