[all] Add printjob detection for CP810 and CP900.
Also, fix problems with ES40/CP790 on Big Endian systems.
This commit is contained in:
parent
fa002b0517
commit
881ff9b369
33
README.TXT
33
README.TXT
|
@ -1,6 +1,6 @@
|
|||
***************************************************************************
|
||||
|
||||
Canon SELPHY ES series print assister
|
||||
Canon SELPHY ES/CP series print assister
|
||||
|
||||
(c) 2007-2012 Solomon Peachy <pizza@shaftnet.org>
|
||||
|
||||
|
@ -10,8 +10,9 @@
|
|||
|
||||
***************************************************************************
|
||||
|
||||
The SELPHY ES-series printers from Canon requires intelligent buffering
|
||||
of the raw print data in order to keep the printer from locking up.
|
||||
The SELPHY ES/CP series of printers from Canon generally require
|
||||
intelligent buffering of the raw print data in order to keep the printer
|
||||
from locking up. This tool accomplishes just that.
|
||||
|
||||
Verified supported printers:
|
||||
|
||||
|
@ -22,14 +23,12 @@
|
|||
SELPHY ES20, ES3
|
||||
SELPHY CP10, CP100, CP200, CP220, CP300, CP330, CP400, CP500, CP510,
|
||||
CP520, CP530, CP600, CP710, CP720, CP730, CP740, CP750, CP760,
|
||||
CP770, CP780
|
||||
CP770, CP780, CP810
|
||||
|
||||
NOT currently supported:
|
||||
|
||||
SELPHY ES40, CP790
|
||||
I need the readback codes for these printers in order to proceed.
|
||||
SELPHY CP810, CP900
|
||||
Currently unknown stream format (and possibly unknown readback codes)
|
||||
SELPHY ES40, CP790, CP900
|
||||
I need the readback codes for these printers.
|
||||
|
||||
***************************************************************************
|
||||
Selphy ES1:
|
||||
|
@ -182,7 +181,22 @@
|
|||
Readback codes are unknown.
|
||||
|
||||
***************************************************************************
|
||||
Selphy CP-series (except for CP790, CP810, CP900):
|
||||
Selphy CP-900
|
||||
|
||||
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
|
||||
End func: 00 00 00 00
|
||||
|
||||
plane codes are 0x00, 0x01, 0x02 for Y, M, and C, respectively.
|
||||
|
||||
'P' paper pgcode 0x01 plane length 2227456 bytes.
|
||||
'CP_L' pgcode 0x02 plane length 1601600 bytes.
|
||||
'Card' paper pgcode 0x03 plane length 698880 bytes.
|
||||
|
||||
Readback codes are unknown, but likely identical to the other CP-series.
|
||||
|
||||
***************************************************************************
|
||||
Selphy CP-series (except for CP790/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
|
||||
|
@ -207,3 +221,4 @@
|
|||
'CP_L' paper has a code of 0x22
|
||||
|
||||
Readback codes for other paper types are unknown.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Canon SELPHY ES series print assister -- Common Code
|
||||
* Canon SELPHY ES/CP series print assister -- Common Code
|
||||
*
|
||||
* (c) 2007-2012 Solomon Peachy <pizza@shaftnet.org>
|
||||
*
|
||||
|
@ -25,12 +25,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define VERSION "0.21"
|
||||
#define VERSION "0.22"
|
||||
|
||||
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
#define cpu_to_le32(__x) __x
|
||||
#define le32_to_cpu(__x) __x
|
||||
#else
|
||||
#define cpu_to_le32(x) \
|
||||
#define le32_to_cpu(x) \
|
||||
({ \
|
||||
uint32_t __x = (x); \
|
||||
((uint32_t)( \
|
||||
|
@ -62,7 +62,8 @@ enum {
|
|||
P_ES1 = 0,
|
||||
P_ES2_20,
|
||||
P_ES3_30,
|
||||
P_ES40,
|
||||
P_ES40_CP790,
|
||||
P_CP900,
|
||||
P_CP_XXX,
|
||||
P_END
|
||||
};
|
||||
|
@ -104,7 +105,7 @@ struct printer_data printers[P_END] = {
|
|||
// .paper_codes
|
||||
.paper_code_offset = -1,
|
||||
},
|
||||
{ .type = P_ES40,
|
||||
{ .type = P_ES40_CP790,
|
||||
.model = "SELPHY ES40/CP790",
|
||||
.init_length = 16,
|
||||
.foot_length = 12,
|
||||
|
@ -112,12 +113,24 @@ struct printer_data printers[P_END] = {
|
|||
// .ready_y_readback =
|
||||
// .ready_m_readback =
|
||||
// .ready_c_readback =
|
||||
// .done_c_readback =
|
||||
// .paper_codes
|
||||
// .paper_code_offset = -1,
|
||||
},
|
||||
{ .type = P_CP900,
|
||||
.model = "SELPHY CP900",
|
||||
.init_length = 16,
|
||||
.foot_length = 4,
|
||||
// .init_readback =
|
||||
// .ready_y_readback =
|
||||
// .ready_m_readback =
|
||||
// .ready_c_readback =
|
||||
// .done_c_readback =
|
||||
// .paper_codes
|
||||
// .paper_code_offset = -1,
|
||||
},
|
||||
{ .type = P_CP_XXX,
|
||||
.model = "SELPHY CP Series (Except CP790)",
|
||||
.model = "SELPHY CP Series (Except CP790/CP900)",
|
||||
.init_length = 12,
|
||||
.foot_length = 0,
|
||||
.init_readback = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
|
@ -145,12 +158,12 @@ static void setup_paper_codes(void)
|
|||
|
||||
/* SELPHY ES1 paper codes */
|
||||
printers[P_ES1].paper_codes[0x11] = 0x01;
|
||||
printers[P_ES1].paper_codes[0x12] = 0x02; // ?
|
||||
printers[P_ES1].paper_codes[0x12] = 0x02; // ? guess
|
||||
printers[P_ES1].paper_codes[0x13] = 0x03;
|
||||
|
||||
/* SELPHY ES2/20 paper codes */
|
||||
printers[P_ES2_20].paper_codes[0x01] = 0x01;
|
||||
printers[P_ES2_20].paper_codes[0x02] = 0x02; // ?
|
||||
printers[P_ES2_20].paper_codes[0x02] = 0x02; // ? guess
|
||||
printers[P_ES2_20].paper_codes[0x03] = 0x03;
|
||||
|
||||
/* SELPHY ES3/30 paper codes */
|
||||
|
@ -159,12 +172,18 @@ static void setup_paper_codes(void)
|
|||
// printers[P_ES3_30]paper_codes[0x03] = -1;
|
||||
|
||||
/* SELPHY ES40/CP790 paper codes */
|
||||
// printers[P_ES40].paper_codes[0x00] = -1;
|
||||
// printers[P_ES40].paper_codes[0x01] = -1;
|
||||
// printers[P_ES40].paper_codes[0x02] = -1;
|
||||
// printers[P_ES40].paper_codes[0x03] = -1;
|
||||
// printers[P_ES40_CP790].paper_codes[0x00] = -1;
|
||||
// printers[P_ES40_CP790].paper_codes[0x01] = -1;
|
||||
// printers[P_ES40_CP790].paper_codes[0x02] = -1;
|
||||
// printers[P_ES40_CP790].paper_codes[0x03] = -1;
|
||||
|
||||
/* SELPHY CP-760 paper codes */
|
||||
/* SELPHY CP-900 paper codes */
|
||||
printers[P_CP900].paper_codes[0x01] = 0x11; // ? guess
|
||||
printers[P_CP900].paper_codes[0x02] = 0x22; // ? guess
|
||||
// printers[P_CP900].paper_codes[0x03] = -1;
|
||||
// printers[P_CP900].paper_codes[0x04] = -1;
|
||||
|
||||
/* SELPHY CP-760 (and most others) paper codes */
|
||||
printers[P_CP_XXX].paper_codes[0x01] = 0x11;
|
||||
printers[P_CP_XXX].paper_codes[0x02] = 0x22;
|
||||
// printers[P_CP_XXX].paper_codes[0x03] = -1;
|
||||
|
@ -222,16 +241,21 @@ static int parse_printjob(uint8_t *buffer, int *bw_mode, int *plane_len)
|
|||
buffer[13] == 0x01) {
|
||||
if (buffer[2] == 0x00) {
|
||||
printer_type = P_CP_XXX;
|
||||
// XXX the P_CP900 is identical, but has extra
|
||||
// data at the very end of the file. No way to detect
|
||||
// from a streamed source.
|
||||
} else {
|
||||
printer_type = P_ES1;
|
||||
*bw_mode = (buffer[2] == 0x20);
|
||||
}
|
||||
|
||||
*plane_len = *(uint32_t*)(&buffer[16]);
|
||||
*plane_len = le32_to_cpu(*plane_len);
|
||||
goto done;
|
||||
}
|
||||
|
||||
*plane_len = *(uint32_t*)(&buffer[12]);
|
||||
*plane_len = le32_to_cpu(*plane_len);
|
||||
|
||||
if (buffer[16] == 0x40 &&
|
||||
buffer[17] == 0x01) {
|
||||
|
@ -243,7 +267,7 @@ static int parse_printjob(uint8_t *buffer, int *bw_mode, int *plane_len)
|
|||
}
|
||||
|
||||
if (es40_plane_lengths[buffer[2]] == *plane_len) {
|
||||
printer_type = P_ES40;
|
||||
printer_type = P_ES40_CP790;
|
||||
*bw_mode = (buffer[3] == 0x01);
|
||||
goto done;
|
||||
} else {
|
||||
|
@ -257,7 +281,6 @@ static int parse_printjob(uint8_t *buffer, int *bw_mode, int *plane_len)
|
|||
return -1;
|
||||
|
||||
done:
|
||||
*plane_len = cpu_to_le32(*plane_len);
|
||||
|
||||
return printer_type;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Canon SELPHY series print assister -- libusb-1.0 version
|
||||
* Canon SELPHY ES/CP series print assister -- libusb-1.0 version
|
||||
*
|
||||
* (c) 2007-2012 Solomon Peachy <pizza@shaftnet.org>
|
||||
*
|
||||
|
@ -66,12 +66,12 @@
|
|||
#define USB_PID_CANON_CP740 0x3171
|
||||
#define USB_PID_CANON_CP750 750 // XXX
|
||||
#define USB_PID_CANON_CP760 0x31AB
|
||||
#define USB_PID_CANON_CP770 770 // XXX
|
||||
#define USB_PID_CANON_CP780 780 // XXX - maybe incoming
|
||||
#define USB_PID_CANON_CP770 770 // XXX - maybe incoming
|
||||
#define USB_PID_CANON_CP780 780 // XXX - incoming
|
||||
#define USB_PID_CANON_CP790 790 // XXX
|
||||
#define USB_PID_CANON_CP800 0x3214 // - maybe incoming
|
||||
#define USB_PID_CANON_CP810 0x3256 // XXX -- as of yet unknown file format
|
||||
#define USB_PID_CANON_CP900 0x3255 // XXX -- as of yet unknown file format
|
||||
#define USB_PID_CANON_CP800 0x3214
|
||||
#define USB_PID_CANON_CP810 0x3256
|
||||
#define USB_PID_CANON_CP900 0x3255
|
||||
|
||||
#define ENDPOINT_UP 0x81
|
||||
#define ENDPOINT_DOWN 0x02
|
||||
|
@ -151,7 +151,7 @@ int main (int argc, char **argv)
|
|||
|
||||
/* Cmdline help */
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "SELPHY Print Assist version %s\n\nUsage:\n\t%s [ infile | - ]\n",
|
||||
fprintf(stderr, "SELPHY ES/CP Print Assist version %s\n\nUsage:\n\t%s [ infile | - ]\n",
|
||||
VERSION,
|
||||
argv[0]);
|
||||
fprintf(stderr, "\n");
|
||||
|
@ -213,7 +213,13 @@ int main (int argc, char **argv)
|
|||
break;
|
||||
case USB_PID_CANON_ES40:
|
||||
case USB_PID_CANON_CP790:
|
||||
if (printer_type == P_ES40)
|
||||
if (printer_type == P_ES40_CP790)
|
||||
goto found2;
|
||||
break;
|
||||
case USB_PID_CANON_CP900:
|
||||
/* XXX deliberate. no way to distinguish P_CP900 based
|
||||
on a streamed-in print job */
|
||||
if (printer_type == P_CP_XXX)
|
||||
goto found2;
|
||||
break;
|
||||
case USB_PID_CANON_CP10:
|
||||
|
@ -237,6 +243,7 @@ int main (int argc, char **argv)
|
|||
case USB_PID_CANON_CP770:
|
||||
case USB_PID_CANON_CP780:
|
||||
case USB_PID_CANON_CP800:
|
||||
case USB_PID_CANON_CP810:
|
||||
if (printer_type == P_CP_XXX)
|
||||
goto found2;
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Canon SELPHY series print assister -- Native Linux version
|
||||
* Canon SELPHY ES/CP series print assister -- Native Linux version
|
||||
*
|
||||
* (c) 2007-2012 Solomon Peachy <pizza@shaftnet.org>
|
||||
*
|
||||
|
@ -96,7 +96,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Cmdline help */
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "SELPHY Print Assist version %s\n\nUsage:\n\t%s [ infile | - ] [ outdev ]\n",
|
||||
fprintf(stderr, "SELPHY ES/CP Print Assist version %s\n\nUsage:\n\t%s [ infile | - ] [ outdev ]\n",
|
||||
VERSION,
|
||||
argv[0]);
|
||||
fprintf(stderr, "\n");
|
||||
|
|
Loading…
Reference in a new issue