sinfonia: Fix header definitions for Kodak 8810 and 6900.
8810 _should_ work now, but 6900 is probably broken still.
This commit is contained in:
parent
1ee70bd6dc
commit
1ffe35832d
|
@ -1197,7 +1197,7 @@ static int shinkos6145_read_parse(void *vctx, const void **vjob, int data_fd, in
|
|||
|
||||
/* Common read/parse code */
|
||||
if (ctx->dev.type == P_KODAK_6900) {
|
||||
ret = sinfonia_raw10_read_parse(data_fd, job);
|
||||
ret = sinfonia_raw28_read_parse(data_fd, job);
|
||||
} else {
|
||||
ret = sinfonia_read_parse(data_fd, model, job);
|
||||
}
|
||||
|
|
|
@ -260,6 +260,62 @@ int sinfonia_raw18_read_parse(int data_fd, struct sinfonia_printjob *job)
|
|||
return CUPS_BACKEND_OK;
|
||||
}
|
||||
|
||||
int sinfonia_raw28_read_parse(int data_fd, struct sinfonia_printjob *job)
|
||||
{
|
||||
struct sinfonia_printcmd28_hdr hdr;
|
||||
int ret;
|
||||
|
||||
/* Read in header */
|
||||
ret = read(data_fd, &hdr, sizeof(hdr));
|
||||
if (ret < 0 || ret != sizeof(hdr)) {
|
||||
if (ret == 0)
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ret, 0, (int)sizeof(hdr));
|
||||
perror("ERROR: Read failed");
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
/* Validate header */
|
||||
if (le16_to_cpu(hdr.hdr.cmd) != SINFONIA_CMD_PRINTJOB ||
|
||||
le16_to_cpu(hdr.hdr.len) != 28) {
|
||||
ERROR("Unrecognized data format!\n");
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
job->jp.copies = le16_to_cpu(hdr.copies);
|
||||
job->jp.rows = le16_to_cpu(hdr.rows);
|
||||
job->jp.columns = le16_to_cpu(hdr.columns);
|
||||
job->jp.media = hdr.media;
|
||||
job->jp.oc_mode = hdr.options & 0x03;
|
||||
job->jp.quality = hdr.options & 0x08;
|
||||
job->jp.method = hdr.method;
|
||||
|
||||
/* Allocate buffer */
|
||||
job->datalen = job->jp.rows * job->jp.columns * 3;
|
||||
job->databuf = malloc(job->datalen);
|
||||
if (!job->databuf) {
|
||||
ERROR("Memory allocation failure!\n");
|
||||
return CUPS_BACKEND_RETRY_CURRENT;
|
||||
}
|
||||
|
||||
{
|
||||
int remain = job->datalen;
|
||||
uint8_t *ptr = job->databuf;
|
||||
do {
|
||||
ret = read(data_fd, ptr, remain);
|
||||
if (ret < 0) {
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ret, remain, job->datalen);
|
||||
perror("ERROR: Read failed");
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
ptr += ret;
|
||||
remain -= ret;
|
||||
} while (remain);
|
||||
}
|
||||
|
||||
return CUPS_BACKEND_OK;
|
||||
}
|
||||
|
||||
void sinfonia_cleanup_job(const void *vjob)
|
||||
{
|
||||
const struct sinfonia_printjob *job = vjob;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define LIBSINFONIA_VER "0.04"
|
||||
#define LIBSINFONIA_VER "0.05"
|
||||
|
||||
#define SINFONIA_HDR1_LEN 0x10
|
||||
#define SINFONIA_HDR2_LEN 0x64
|
||||
|
@ -64,6 +64,7 @@ int sinfonia_read_parse(int data_fd, uint32_t model,
|
|||
|
||||
int sinfonia_raw10_read_parse(int data_fd, struct sinfonia_printjob *job);
|
||||
int sinfonia_raw18_read_parse(int data_fd, struct sinfonia_printjob *job);
|
||||
int sinfonia_raw28_read_parse(int data_fd, struct sinfonia_printjob *job);
|
||||
void sinfonia_cleanup_job(const void *vjob);
|
||||
|
||||
/* Common usb functions */
|
||||
|
@ -315,11 +316,25 @@ struct sinfonia_printcmd18_hdr {
|
|||
uint16_t copies;
|
||||
uint16_t columns;
|
||||
uint16_t rows;
|
||||
uint8_t reserved[8]; // columns and rows repeated, then nulls
|
||||
uint8_t media;
|
||||
uint8_t oc_mode;
|
||||
uint8_t method;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct sinfonia_printcmd28_hdr {
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t jobid;
|
||||
uint16_t copies;
|
||||
uint16_t columns;
|
||||
uint16_t rows;
|
||||
uint8_t media;
|
||||
uint8_t reserved[7];
|
||||
uint8_t options;
|
||||
uint8_t method;
|
||||
uint8_t reserved2[11];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define CODE_4x6 0x00
|
||||
#define CODE_3_5x5 0x01
|
||||
#define CODE_5x7 0x03
|
||||
|
|
Loading…
Reference in a new issue