Compare commits

...

4 Commits

Author SHA1 Message Date
Solomon Peachy 78179680a3 selphyneo: Add USB ID for new SELPHY CP1500 2022-10-10 15:03:09 -04:00
Solomon Peachy a9bd694245 canonselphyneo: Decode more error codes and battery status 2022-10-07 12:37:51 -04:00
Solomon Peachy b2c5fbeac1 regression: Add in the only new size to the QW410 set. 2022-10-03 16:07:17 -04:00
Solomon Peachy 642a150101 dnp: Handle the 4x3, 4.5x3, 4x4. and 5,4.5x4 sizes.
These have unique MULTICUT values.   There's a gap in the sequence
that lends me to think there's another size in play, but dunno.

Updates to Gutenprint will follow
2022-10-03 16:07:15 -04:00
4 changed files with 115 additions and 36 deletions

10
README
View File

@ -25,7 +25,7 @@
Supported Printers:
Canon SELPHY ES series
Canon SELPHY CP series (except CP1500)
Canon SELPHY CP series
Ciaat Brava 21
Citizen CW-01
Citizen CW-02 / OP900II
@ -447,7 +447,7 @@
Model IDs recognized:
canon-cp820 canon-cp910 canon-cp1000 canon-cp1200 canon-cp1300
canon-cp820 canon-cp910 canon-cp1000 canon-cp1200 canon-cp1300 canon-cp1500
Model IDs for backwards compatibility with older releases:
@ -459,11 +459,7 @@
Untested, but expected to work:
CP820, CP910
Not supported (Unknown USB VID/PID):
CP1500
CP820, CP910, CP1500
Valid commands:

View File

@ -79,22 +79,38 @@ static const char *selphyneo_errors(uint8_t err)
switch(err) {
case 0x00:
return "None";
case 0x01:
return "Low battery";
case 0x02:
return "Paper Feed";
return "Paper Feed (No Paper?)";
case 0x03:
return "No Paper";
return "No Paper Tray";
case 0x04:
return "Incorrect Paper Tray";
case 0x05:
return "Incorrect Paper loaded";
case 0x06:
return "Ink Cassette Empty";
case 0x07:
return "No Ink";
case 0x08:
return "Incorrect Ink loaded";
case 0x09:
return "No Paper and Ink";
case 0x0A:
return "Incorrect media for job";
return "Incorrect paper tray and ink for job";
case 0x0B:
return "Paper jam";
case 0x0C:
return "Ink jam";
case 0x0D:
return "Ink illegal";
case 0x0E:
return "Unknown Ink";
case 0x0F:
return "Unknown Paper";
case 0x10:
return "Unknown Command";
default:
return "Unknown Error";
}
@ -116,6 +132,20 @@ static const char *selphynew_pgcodes(uint8_t type) {
}
}
static const char *selphyneo_powers(uint8_t sts) {
switch (sts & 0x3) {
case 0x00:
return "Line Power";
case 0x01:
return "Battery OK";
case 0x03:
return "Battery Low";
default:
return "Unknown";
}
}
static int selphyneo_send_reset(struct selphyneo_ctx *ctx)
{
uint8_t rstcmd[12] = { 0x40, 0x10, 0x00, 0x00,
@ -150,6 +180,7 @@ static int selphyneo_get_status(struct selphyneo_ctx *ctx)
return CUPS_BACKEND_FAILED;
INFO("Printer state: %s\n", selphyneo_statuses(rdback.data[0]));
INFO("Printer power state: %s\n", selphyneo_powers(rdback.data[7]));
INFO("Media type: %s\n", selphynew_pgcodes(rdback.data[6]));
if (rdback.data[2]) {
INFO("Printer error: %s\n", selphyneo_errors(rdback.data[2]));
@ -503,7 +534,7 @@ static const char *canonselphyneo_prefixes[] = {
const struct dyesub_backend canonselphyneo_backend = {
.name = "Canon SELPHY CP (new)",
.version = "0.22",
.version = "0.24",
.uri_prefixes = canonselphyneo_prefixes,
.cmdline_usage = selphyneo_cmdline,
.cmdline_arg = selphyneo_cmdline_arg,
@ -519,7 +550,7 @@ const struct dyesub_backend canonselphyneo_backend = {
{ 0x04a9, 0x32ae, P_CP910, NULL, "canon-cp1000"},
{ 0x04a9, 0x32b1, P_CP910, NULL, "canon-cp1200"},
{ 0x04a9, 0x32db, P_CP910, NULL, "canon-cp1300"},
// { 0x04a9, 0x32db, P_CP910, NULL, "canon-cp1500"},
{ 0x04a9, 0x3302, P_CP910, NULL, "canon-cp1500"},
{ 0, 0, 0, NULL, NULL}
}
};
@ -530,7 +561,7 @@ const struct dyesub_backend canonselphyneo_backend = {
Stream formats and readback codes for supported printers
***************************************************************************
Selphy CP820/CP910/CP1000/CP1200/CP1300:
Selphy CP820/CP910/CP1000/CP1200/CP1300/CP1500:
Radically different spool file format from older Selphy models.
300dpi, same nominal print sizes but slightly different dimensions.
@ -548,7 +579,7 @@ const struct dyesub_backend canonselphyneo_backend = {
4c 80 04 c0 05 1152 * 1472 (L)
43 40 04 9c 02 1088 * 668 (C)
ZZ == 00 Y'CbCr data follows
ZZ == 00 YUV444 data follows
== 01 CMY data follows
Followed by three planes of image data:
@ -557,8 +588,11 @@ const struct dyesub_backend canonselphyneo_backend = {
L == 5087264 (1695744 * 3)
C == 2180384 (726784 * 3)
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.
RGB -> YUV444 is as follows:
Y = ( 77 * R + 150 * G + 29 * B + 128 ) >> 8
U = ( ( -43 * R + 85 * G + 128 * B + 128 ) >> 8 ) + 128
V = ( ( 128 * R - 107 * G - 21 * B + 128 ) >> 8 ) + 128
Other questions:
@ -567,11 +601,10 @@ const struct dyesub_backend canonselphyneo_backend = {
- Pattern 1 (Matte)
- Pattern 2 (Fine Matte)
- Pattern 3 (Grid - not all models?)
* How to detect battery pack
Data Readback:
XX 00 YY 00 00 00 ZZ 00 00 00 00 00
XX 00 YY 00 00 00 ZZ PP 00 00 00 00
XX == Status
@ -593,7 +626,7 @@ const struct dyesub_backend canonselphyneo_backend = {
0A Media/Job mismatch
0B Paper Jam
ZZ == Media?
ZZ == Media
01
10
@ -602,9 +635,15 @@ const struct dyesub_backend canonselphyneo_backend = {
^-- Paper
1 == P
2 == L (??)
2 == L
3 == C
PP == Power state
00 = A/C power
01 = Battery OK
03 = Battery Low
Also, the first time a readback happens after plugging in the printer:
34 44 35 31 01 00 01 00 01 00 45 00 "4D51" ...??

View File

@ -192,12 +192,19 @@ struct dnpds40_cmd {
#define MULTICUT_4_5x6 51
#define MULTICUT_4_5x8 52
// #define MULTICUT_4x3 XXX // 1266x936
// #define MULTICUT_4x3X2 XXX
// #define MULTICUT_4x4X2 XXX
// #define MULTICUT_4_5x3 XXX // 1408x936
// #define MULTICUT_4_5x3X2 XXX
// #define MULTICUT_4_5x4X2 XXX
#define MULTICUT_4x3 53
#define MULTICUT_4x4_5 54
#define MULTICUT_4_5x3 55
// #define MULTICUT_??? 56 // XXX WTF is missing?
#define MULTICUT_4_5x4 57
#if 0
// XXX do these exist? Or are they just the larger print cut in two?
// #define MULTICUT_4x3X2
// #define MULTICUT_4x4X2
// #define MULTICUT_4_5x3X2
// #define MULTICUT_4_5x4X2
#endif
#define MULTICUT_S_SIMPLEX 100
#define MULTICUT_S_FRONT 200
@ -320,6 +327,33 @@ static void *dnp_combine_jobs(const void *vjob1,
new_h = 3702;
gap_bytes = 30;
break;
#if 0 // XXX Do these printers handle automatic multicut?
// if not, implement using FULL_CUTTER_CONTROL!
case MULTICUT_4x3:
new_multicut = MULTICUT_4x6;
new_w = 1408;
new_h = 1836;
gap_bytes = 36;
break;
case MULTICUT_4x4:
new_multicut = MULTICUT_4x8;
new_w = 1408;
new_h = 2436;
gap_bytes = 36;
break;
case MULTICUT_4_5x3:
new_multicut = MULTICUT_4_5x6;
new_w = 1408;
new_h = 1836;
gap_bytes = 36;
break;
case MULTICUT_4_5x4:
new_multicut = MULTICUT_4_5x8;
new_w = 1408;
new_h = 2436;
gap_bytes = 36;
break;
#endif
default:
/* Everything else is NOT handled */
goto done;
@ -1883,8 +1917,9 @@ parsed:
if (job->multicut < 100) {
switch(ctx->media) {
case 150: // 4x6, QW410
if (job->multicut != MULTICUT_4x4 &&
// XXX job->multicut != MULTICUT_4x3 &&
if(job->multicut != MULTICUT_4x3 &&
job->multicut != MULTICUT_4x4 &&
job->multicut != MULTICUT_4x4_5 &&
// XXX job->multicut != MULTICUT_4x3X2 &&
job->multicut != MULTICUT_4x6) {
ERROR("Incorrect media for job loaded (%u vs %u)\n", ctx->media, job->multicut);
@ -1893,9 +1928,10 @@ parsed:
}
break;
case 151: // 4x8, QW410
if (job->multicut != MULTICUT_4x4 &&
if (job->multicut != MULTICUT_4x3 &&
job->multicut != MULTICUT_4x4 &&
job->multicut != MULTICUT_4x4_5 &&
job->multicut != MULTICUT_4x6 &&
// XXX job->multicut != MULTICUT_4x3 &&
// XXX job->multicut != MULTICUT_4x3X2 &&
// XXX job->multicut != MULTICUT_4x4X2 &&
job->multicut != MULTICUT_4x8) {
@ -1905,7 +1941,9 @@ parsed:
}
break;
case 160: // 4.5x6, QW410
if (job->multicut != MULTICUT_4_5x4_5 &&
if (job->multicut != MULTICUT_4_5x3 &&
job->multicut != MULTICUT_4_5x4 &&
job->multicut != MULTICUT_4_5x4_5 &&
// XXX job->multicut != MULTICUT_4_5x3X2 &&
job->multicut != MULTICUT_4_5x6) {
ERROR("Incorrect media for job loaded (%u vs %u)\n", ctx->media, job->multicut);
@ -1914,9 +1952,11 @@ parsed:
}
break;
case 161: // 4.5x8, QW410
if (job->multicut != MULTICUT_4_5x4_5 &&
if (job->multicut != MULTICUT_4_5x3 &&
job->multicut != MULTICUT_4_5x4 &&
job->multicut != MULTICUT_4_5x4_5 &&
job->multicut != MULTICUT_4_5x6 &&
// XXX job->multicut != MULTICUT_4_5x4_X2 &&
// XXX job->multicut != MULTICUT_4_5x4X2 &&
// XXX job->multicut != MULTICUT_4_5x3X2 &&
job->multicut != MULTICUT_4_5x8) {
ERROR("Incorrect media for job loaded (%u vs %u)\n", ctx->media, job->multicut);
@ -3510,7 +3550,7 @@ static const char *dnpds40_prefixes[] = {
const struct dyesub_backend dnpds40_backend = {
.name = "DNP DS-series / Citizen C-series",
.version = "0.145",
.version = "0.146",
.uri_prefixes = dnpds40_prefixes,
.cmdline_usage = dnpds40_cmdline,
.cmdline_arg = dnpds40_cmdline_arg,
@ -3863,7 +3903,9 @@ struct qw410_spool_hdr {
uint8_t null3[3];
uint8_t hd;
uint8_t null4[7];
uint8_t null4[3];
uint8_t dc;
uint8_t null5[3];
} __attribute__((packed));
static int legacy_qw410_read_parse(struct dnpds40_printjob *job, int data_fd, int read_data)
@ -3877,7 +3919,7 @@ static int legacy_qw410_read_parse(struct dnpds40_printjob *job, int data_fd, in
/* Early parsing and sanity checking */
plane_len = le32_to_cpu(hdr.plane_len);
if (hdr.type < MULTICUT_4x4 || hdr.type > MULTICUT_4_5x8 ||
if (hdr.type < MULTICUT_4x4 || hdr.type > MULTICUT_4_5x4 ||
hdr.null0[0] || hdr.null0[1] || hdr.null0[2]) {
ERROR("Unrecognized header data format @%d!\n", job->datalen);
return CUPS_BACKEND_CANCEL;
@ -3888,6 +3930,7 @@ static int legacy_qw410_read_parse(struct dnpds40_printjob *job, int data_fd, in
job->matte = hdr.matte;
job->cutter = (hdr.cut2) ? 120 : 0;
job->printspeed = (hdr.hd) ? 3 : 0;
// XXX decurl = hdr.dc (Decurl: 2 = auto, 1 = on, 0 = off)
return legacy_spool_helper(job, data_fd, read_data,
sizeof(hdr), plane_len, 1);

View File

@ -736,6 +736,7 @@ dnp-ds80dx,0x1343,0x0008,510,PageSize=w576h864;Resolution=300x600dpi;MediaType=S
#
dnp-qw410,0x1452,0x9201,150,PageSize=w288h216
dnp-qw410,0x1452,0x9201,150,PageSize=w288h288
dnp-qw410,0x1452,0x9201,150,PageSize=w288h324
dnp-qw410,0x1452,0x9201,150,PageSize=w288h288-div2
dnp-qw410,0x1452,0x9201,150,PageSize=w288h288_w288h144
dnp-qw410,0x1452,0x9201,150,PageSize=w288h432

1 #gp_printername,vid,pid,type,gp_options[,pano_options]
736 #
737 dnp-qw410,0x1452,0x9201,150,PageSize=w288h216
738 dnp-qw410,0x1452,0x9201,150,PageSize=w288h288
739 dnp-qw410,0x1452,0x9201,150,PageSize=w288h324
740 dnp-qw410,0x1452,0x9201,150,PageSize=w288h288-div2
741 dnp-qw410,0x1452,0x9201,150,PageSize=w288h288_w288h144
742 dnp-qw410,0x1452,0x9201,150,PageSize=w288h432