|
|
|
@ -44,6 +44,7 @@ |
|
|
|
|
#define BACKEND kodak6800_backend |
|
|
|
|
|
|
|
|
|
#include "backend_common.h" |
|
|
|
|
#include "backend_shinko.h" |
|
|
|
|
|
|
|
|
|
#define USB_VID_KODAK 0x040A |
|
|
|
|
#define USB_PID_KODAK_6800 0x4021 |
|
|
|
@ -75,9 +76,9 @@ struct kodak68x0_status_readback { |
|
|
|
|
uint8_t errtype; /* seen 0x00 or 0xd0 */ |
|
|
|
|
uint8_t donor; /* Percentage, 0-100 */ |
|
|
|
|
uint16_t main_boot; /* Always 003 */ |
|
|
|
|
uint16_t main_fw; /* seen 652, 656, 670, 671 (6850) and 232 (6800) */ |
|
|
|
|
uint16_t main_fw; /* seen 6xx/8xx (6850) and 2xx/3xx/4xx (6800) */ |
|
|
|
|
uint16_t dsp_boot; /* Always 001 */ |
|
|
|
|
uint16_t dsp_fw; /* Seen 540, 541, 560 (6850) and 131 (6800) */ |
|
|
|
|
uint16_t dsp_fw; /* Seen 5xx (6850) and 1xx (6800) */ |
|
|
|
|
uint8_t b1_jobid; |
|
|
|
|
uint8_t b2_jobid; |
|
|
|
|
uint16_t b1_remain; /* Remaining prints in job */ |
|
|
|
@ -89,111 +90,6 @@ struct kodak68x0_status_readback { |
|
|
|
|
uint8_t curve_status; /* Always seems to be 0x00 */ |
|
|
|
|
} __attribute__((packed)); |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
CMD_CODE_OK = 1, |
|
|
|
|
CMD_CODE_BAD = 2, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
STATUS_PRINTING = 1, |
|
|
|
|
STATUS_IDLE = 2, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
STATE_STATUS1_STANDBY = 1, |
|
|
|
|
STATE_STATUS1_ERROR = 2, |
|
|
|
|
STATE_STATUS1_WAIT = 3, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#define STATE_STANDBY_STATUS2 0x0 |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
WAIT_STATUS2_INIT = 0, |
|
|
|
|
WAIT_STATUS2_RIBBON = 1, |
|
|
|
|
WAIT_STATUS2_THERMAL = 2, |
|
|
|
|
WAIT_STATUS2_OPERATING = 3, |
|
|
|
|
WAIT_STATUS2_BUSY = 4, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#define ERROR_STATUS2_CTRL_CIRCUIT (0x80000000) |
|
|
|
|
#define ERROR_STATUS2_MECHANISM_CTRL (0x40000000) |
|
|
|
|
#define ERROR_STATUS2_SENSOR (0x00002000) |
|
|
|
|
#define ERROR_STATUS2_COVER_OPEN (0x00001000) |
|
|
|
|
#define ERROR_STATUS2_TEMP_SENSOR (0x00000200) |
|
|
|
|
#define ERROR_STATUS2_PAPER_JAM (0x00000100) |
|
|
|
|
#define ERROR_STATUS2_PAPER_EMPTY (0x00000040) |
|
|
|
|
#define ERROR_STATUS2_RIBBON_ERR (0x00000010) |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
CTRL_CIR_ERROR_EEPROM1 = 0x01, |
|
|
|
|
CTRL_CIR_ERROR_EEPROM2 = 0x02, |
|
|
|
|
CTRL_CIR_ERROR_DSP = 0x04, |
|
|
|
|
CTRL_CIR_ERROR_CRC_MAIN = 0x06, |
|
|
|
|
CTRL_CIR_ERROR_DL_MAIN = 0x07, |
|
|
|
|
CTRL_CIR_ERROR_CRC_DSP = 0x08, |
|
|
|
|
CTRL_CIR_ERROR_DL_DSP = 0x09, |
|
|
|
|
CTRL_CIR_ERROR_ASIC = 0x0a, |
|
|
|
|
CTRL_CIR_ERROR_DRAM = 0x0b, |
|
|
|
|
CTRL_CIR_ERROR_DSPCOMM = 0x29, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
MECH_ERROR_HEAD_UP = 0x01, |
|
|
|
|
MECH_ERROR_HEAD_DOWN = 0x02, |
|
|
|
|
MECH_ERROR_MAIN_PINCH_UP = 0x03, |
|
|
|
|
MECH_ERROR_MAIN_PINCH_DOWN = 0x04, |
|
|
|
|
MECH_ERROR_SUB_PINCH_UP = 0x05, |
|
|
|
|
MECH_ERROR_SUB_PINCH_DOWN = 0x06, |
|
|
|
|
MECH_ERROR_FEEDIN_PINCH_UP = 0x07, |
|
|
|
|
MECH_ERROR_FEEDIN_PINCH_DOWN = 0x08, |
|
|
|
|
MECH_ERROR_FEEDOUT_PINCH_UP = 0x09, |
|
|
|
|
MECH_ERROR_FEEDOUT_PINCH_DOWN = 0x0a, |
|
|
|
|
MECH_ERROR_CUTTER_LR = 0x0b, |
|
|
|
|
MECH_ERROR_CUTTER_RL = 0x0c, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
SENSOR_ERROR_CUTTER = 0x05, |
|
|
|
|
SENSOR_ERROR_HEAD_DOWN = 0x09, |
|
|
|
|
SENSOR_ERROR_HEAD_UP = 0x0a, |
|
|
|
|
SENSOR_ERROR_MAIN_PINCH_DOWN = 0x0b, |
|
|
|
|
SENSOR_ERROR_MAIN_PINCH_UP = 0x0c, |
|
|
|
|
SENSOR_ERROR_FEED_PINCH_DOWN = 0x0d, |
|
|
|
|
SENSOR_ERROR_FEED_PINCH_UP = 0x0e, |
|
|
|
|
SENSOR_ERROR_EXIT_PINCH_DOWN = 0x0f, |
|
|
|
|
SENSOR_ERROR_EXIT_PINCH_UP = 0x10, |
|
|
|
|
SENSOR_ERROR_LEFT_CUTTER = 0x11, |
|
|
|
|
SENSOR_ERROR_RIGHT_CUTTER = 0x12, |
|
|
|
|
SENSOR_ERROR_CENTER_CUTTER = 0x13, |
|
|
|
|
SENSOR_ERROR_UPPER_CUTTER = 0x14, |
|
|
|
|
SENSOR_ERROR_PAPER_FEED_COVER = 0x15, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
TEMP_SENSOR_ERROR_HEAD_HIGH = 0x01, |
|
|
|
|
TEMP_SENSOR_ERROR_HEAD_LOW = 0x02, |
|
|
|
|
TEMP_SENSOR_ERROR_ENV_HIGH = 0x03, |
|
|
|
|
TEMP_SENSOR_ERROR_ENV_LOW = 0x04, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
COVER_OPEN_ERROR_UPPER = 0x01, |
|
|
|
|
COVER_OPEN_ERROR_LOWER = 0x02, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
PAPER_EMPTY_ERROR = 0x00, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
RIBBON_ERROR = 0x00, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
CURVE_TABLE_STATUS_INITIAL = 0x00, |
|
|
|
|
CURVE_TABLE_STATUS_USERSET = 0x01, |
|
|
|
|
CURVE_TABLE_STATUS_CURRENT = 0x02, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct kodak6800_printsize { |
|
|
|
|
uint8_t hdr; /* Always 0x06 */ |
|
|
|
@ -425,153 +321,6 @@ static int kodak68x0_reset(struct kodak6800_ctx *ctx) |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Structure dumps */ |
|
|
|
|
static char *kodak68x0_status_str(struct kodak68x0_status_readback *resp) |
|
|
|
|
{ |
|
|
|
|
switch(resp->status1) { |
|
|
|
|
case STATE_STATUS1_STANDBY: |
|
|
|
|
return "Standby (Ready)"; |
|
|
|
|
case STATE_STATUS1_WAIT: |
|
|
|
|
switch (be32_to_cpu(resp->status2)) { |
|
|
|
|
case WAIT_STATUS2_INIT: |
|
|
|
|
return "Wait (Initializing)"; |
|
|
|
|
case WAIT_STATUS2_RIBBON: |
|
|
|
|
return "Wait (Ribbon Winding)"; |
|
|
|
|
case WAIT_STATUS2_THERMAL: |
|
|
|
|
return "Wait (Thermal Protection)"; |
|
|
|
|
case WAIT_STATUS2_OPERATING: |
|
|
|
|
return "Wait (Operating)"; |
|
|
|
|
case WAIT_STATUS2_BUSY: |
|
|
|
|
return "Wait (Busy)"; |
|
|
|
|
default: |
|
|
|
|
return "Wait (Unknown)"; |
|
|
|
|
} |
|
|
|
|
case STATE_STATUS1_ERROR: |
|
|
|
|
switch (be32_to_cpu(resp->status2)) { |
|
|
|
|
case ERROR_STATUS2_CTRL_CIRCUIT: |
|
|
|
|
switch (resp->errcode) { |
|
|
|
|
case CTRL_CIR_ERROR_EEPROM1: |
|
|
|
|
return "Error (EEPROM1)"; |
|
|
|
|
case CTRL_CIR_ERROR_EEPROM2: |
|
|
|
|
return "Error (EEPROM2)"; |
|
|
|
|
case CTRL_CIR_ERROR_DSP: |
|
|
|
|
return "Error (DSP)"; |
|
|
|
|
case CTRL_CIR_ERROR_CRC_MAIN: |
|
|
|
|
return "Error (Main CRC)"; |
|
|
|
|
case CTRL_CIR_ERROR_DL_MAIN: |
|
|
|
|
return "Error (Main Download)"; |
|
|
|
|
case CTRL_CIR_ERROR_CRC_DSP: |
|
|
|
|
return "Error (DSP CRC)"; |
|
|
|
|
case CTRL_CIR_ERROR_DL_DSP: |
|
|
|
|
return "Error (DSP Download)"; |
|
|
|
|
case CTRL_CIR_ERROR_ASIC: |
|
|
|
|
return "Error (ASIC)"; |
|
|
|
|
case CTRL_CIR_ERROR_DRAM: |
|
|
|
|
return "Error (DRAM)"; |
|
|
|
|
case CTRL_CIR_ERROR_DSPCOMM: |
|
|
|
|
return "Error (DSP Communincation)"; |
|
|
|
|
default: |
|
|
|
|
return "Error (Unknown Circuit)"; |
|
|
|
|
} |
|
|
|
|
case ERROR_STATUS2_MECHANISM_CTRL: |
|
|
|
|
switch (resp->errcode) { |
|
|
|
|
case MECH_ERROR_HEAD_UP: |
|
|
|
|
return "Error (Head Up Mechanism)"; |
|
|
|
|
case MECH_ERROR_HEAD_DOWN: |
|
|
|
|
return "Error (Head Down Mechanism)"; |
|
|
|
|
case MECH_ERROR_MAIN_PINCH_UP: |
|
|
|
|
return "Error (Main Pinch Up Mechanism)"; |
|
|
|
|
case MECH_ERROR_MAIN_PINCH_DOWN: |
|
|
|
|
return "Error (Main Pinch Down Mechanism)"; |
|
|
|
|
case MECH_ERROR_SUB_PINCH_UP: |
|
|
|
|
return "Error (Sub Pinch Up Mechanism)"; |
|
|
|
|
case MECH_ERROR_SUB_PINCH_DOWN: |
|
|
|
|
return "Error (Sub Pinch Down Mechanism)"; |
|
|
|
|
case MECH_ERROR_FEEDIN_PINCH_UP: |
|
|
|
|
return "Error (Feed-in Pinch Up Mechanism)"; |
|
|
|
|
case MECH_ERROR_FEEDIN_PINCH_DOWN: |
|
|
|
|
return "Error (Feed-in Pinch Down Mechanism)"; |
|
|
|
|
case MECH_ERROR_FEEDOUT_PINCH_UP: |
|
|
|
|
return "Error (Feed-out Pinch Up Mechanism)"; |
|
|
|
|
case MECH_ERROR_FEEDOUT_PINCH_DOWN: |
|
|
|
|
return "Error (Feed-out Pinch Down Mechanism)"; |
|
|
|
|
case MECH_ERROR_CUTTER_LR: |
|
|
|
|
return "Error (Left->Right Cutter)"; |
|
|
|
|
case MECH_ERROR_CUTTER_RL: |
|
|
|
|
return "Error (Right->Left Cutter)"; |
|
|
|
|
default: |
|
|
|
|
return "Error (Unknown Mechanism)"; |
|
|
|
|
} |
|
|
|
|
case ERROR_STATUS2_SENSOR: |
|
|
|
|
switch (resp->errcode) { |
|
|
|
|
case SENSOR_ERROR_CUTTER: |
|
|
|
|
return "Error (Cutter Sensor)"; |
|
|
|
|
case SENSOR_ERROR_HEAD_DOWN: |
|
|
|
|
return "Error (Head Down Sensor)"; |
|
|
|
|
case SENSOR_ERROR_HEAD_UP: |
|
|
|
|
return "Error (Head Up Sensor)"; |
|
|
|
|
case SENSOR_ERROR_MAIN_PINCH_DOWN: |
|
|
|
|
return "Error (Main Pinch Down Sensor)"; |
|
|
|
|
case SENSOR_ERROR_MAIN_PINCH_UP: |
|
|
|
|
return "Error (Main Pinch Up Sensor)"; |
|
|
|
|
case SENSOR_ERROR_FEED_PINCH_DOWN: |
|
|
|
|
return "Error (Feed Pinch Down Sensor)"; |
|
|
|
|
case SENSOR_ERROR_FEED_PINCH_UP: |
|
|
|
|
return "Error (Feed Pinch Up Sensor)"; |
|
|
|
|
case SENSOR_ERROR_EXIT_PINCH_DOWN: |
|
|
|
|
return "Error (Exit Pinch Up Sensor)"; |
|
|
|
|
case SENSOR_ERROR_EXIT_PINCH_UP: |
|
|
|
|
return "Error (Exit Pinch Up Sensor)"; |
|
|
|
|
case SENSOR_ERROR_LEFT_CUTTER: |
|
|
|
|
return "Error (Left Cutter Sensor)"; |
|
|
|
|
case SENSOR_ERROR_RIGHT_CUTTER: |
|
|
|
|
return "Error (Right Cutter Sensor)"; |
|
|
|
|
case SENSOR_ERROR_CENTER_CUTTER: |
|
|
|
|
return "Error (Center Cutter Sensor)"; |
|
|
|
|
case SENSOR_ERROR_UPPER_CUTTER: |
|
|
|
|
return "Error (Upper Cutter Sensor)"; |
|
|
|
|
case SENSOR_ERROR_PAPER_FEED_COVER: |
|
|
|
|
return "Error (Paper Feed Cover)"; |
|
|
|
|
default: |
|
|
|
|
return "Error (Unknown Sensor)"; |
|
|
|
|
} |
|
|
|
|
case ERROR_STATUS2_COVER_OPEN: |
|
|
|
|
switch (resp->errcode) { |
|
|
|
|
case COVER_OPEN_ERROR_UPPER: |
|
|
|
|
return "Error (Upper Cover Open)"; |
|
|
|
|
case COVER_OPEN_ERROR_LOWER: |
|
|
|
|
return "Error (Lower Cover Open)"; |
|
|
|
|
default: |
|
|
|
|
return "Error (Unknown Cover Open)"; |
|
|
|
|
} |
|
|
|
|
case ERROR_STATUS2_TEMP_SENSOR: |
|
|
|
|
switch (resp->errcode) { |
|
|
|
|
case TEMP_SENSOR_ERROR_HEAD_HIGH: |
|
|
|
|
return "Error (Head Temperature High)"; |
|
|
|
|
case TEMP_SENSOR_ERROR_HEAD_LOW: |
|
|
|
|
return "Error (Head Temperature Low)"; |
|
|
|
|
case TEMP_SENSOR_ERROR_ENV_HIGH: |
|
|
|
|
return "Error (Environmental Temperature High)"; |
|
|
|
|
case TEMP_SENSOR_ERROR_ENV_LOW: |
|
|
|
|
return "Error (Environmental Temperature Low)"; |
|
|
|
|
default: |
|
|
|
|
return "Error (Unknown Temperature)"; |
|
|
|
|
} |
|
|
|
|
case ERROR_STATUS2_PAPER_JAM: |
|
|
|
|
return "Error (Paper Jam)"; |
|
|
|
|
case ERROR_STATUS2_PAPER_EMPTY: |
|
|
|
|
return "Error (Paper Empty)"; |
|
|
|
|
case ERROR_STATUS2_RIBBON_ERR: |
|
|
|
|
return "Error (Ribbon)"; |
|
|
|
|
default: |
|
|
|
|
return "Error (Unknown)"; |
|
|
|
|
} |
|
|
|
|
default: |
|
|
|
|
return "Unknown!"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void kodak68x0_dump_status(struct kodak6800_ctx *ctx, struct kodak68x0_status_readback *status) |
|
|
|
|
{ |
|
|
|
|
char *detail; |
|
|
|
@ -590,8 +339,8 @@ static void kodak68x0_dump_status(struct kodak6800_ctx *ctx, struct kodak68x0_st |
|
|
|
|
INFO("Printer Status : %s\n", detail); |
|
|
|
|
|
|
|
|
|
INFO("Printer State : %s # %02x %08x %02x\n", |
|
|
|
|
kodak68x0_status_str(status), |
|
|
|
|
status->status1, be32_to_cpu(status->status2), status->errcode); |
|
|
|
|
sinfonia_1x45_status_str(status->status1, status->status2, status->errcode), |
|
|
|
|
status->status1, status->status2, status->errcode); |
|
|
|
|
|
|
|
|
|
INFO("Bank 1 ID: %u\n", status->b1_jobid); |
|
|
|
|
INFO("\tPrints: %d/%d complete\n", |
|
|
|
@ -676,11 +425,12 @@ static int kodak6800_get_status(struct kodak6800_ctx *ctx, |
|
|
|
|
return -99; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Byteswap important stuff */ |
|
|
|
|
status->status2 = be32_to_cpu(status->status2); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define UPDATE_SIZE 1536 |
|
|
|
|
static int kodak6800_get_tonecurve(struct kodak6800_ctx *ctx, char *fname) |
|
|
|
|
{ |
|
|
|
|
uint8_t cmdbuf[16]; |
|
|
|
@ -688,7 +438,7 @@ static int kodak6800_get_tonecurve(struct kodak6800_ctx *ctx, char *fname) |
|
|
|
|
int ret, num = 0; |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
uint16_t *data = malloc(UPDATE_SIZE); |
|
|
|
|
uint16_t *data = malloc(TONE_CURVE_SIZE); |
|
|
|
|
if (!data) { |
|
|
|
|
ERROR("Memory Allocation Failure\n"); |
|
|
|
|
return -1; |
|
|
|
@ -786,7 +536,7 @@ static int kodak6800_set_tonecurve(struct kodak6800_ctx *ctx, char *fname) |
|
|
|
|
int ret, num = 0; |
|
|
|
|
int remain; |
|
|
|
|
|
|
|
|
|
uint16_t *data = malloc(UPDATE_SIZE); |
|
|
|
|
uint16_t *data = malloc(TONE_CURVE_SIZE); |
|
|
|
|
uint8_t *ptr; |
|
|
|
|
|
|
|
|
|
if (!data) { |
|
|
|
@ -797,13 +547,13 @@ static int kodak6800_set_tonecurve(struct kodak6800_ctx *ctx, char *fname) |
|
|
|
|
INFO("Set Tone Curve from '%s'\n", fname); |
|
|
|
|
|
|
|
|
|
/* Read in file */ |
|
|
|
|
if ((ret = dyesub_read_file(fname, data, UPDATE_SIZE, NULL))) { |
|
|
|
|
if ((ret = dyesub_read_file(fname, data, TONE_CURVE_SIZE, NULL))) { |
|
|
|
|
ERROR("Failed to read Tone Curve file\n"); |
|
|
|
|
goto done; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Byteswap data to printer's format */ |
|
|
|
|
for (ret = 0; ret < (UPDATE_SIZE)/2 ; ret++) { |
|
|
|
|
for (ret = 0; ret < (TONE_CURVE_SIZE)/2 ; ret++) { |
|
|
|
|
data[ret] = cpu_to_le16(be16_to_cpu(data[ret])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -844,7 +594,7 @@ static int kodak6800_set_tonecurve(struct kodak6800_ctx *ctx, char *fname) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ptr = (uint8_t*) data; |
|
|
|
|
remain = UPDATE_SIZE; |
|
|
|
|
remain = TONE_CURVE_SIZE; |
|
|
|
|
while (remain > 0) { |
|
|
|
|
int count = remain > 63 ? 63 : remain; |
|
|
|
|
|
|
|
|
@ -1256,8 +1006,8 @@ static int kodak6800_main_loop(void *vctx, const void *vjob) { |
|
|
|
|
|
|
|
|
|
if (ctx->sts.status1 == STATE_STATUS1_ERROR) { |
|
|
|
|
INFO("Printer State: %s # %02x %08x %02x\n", |
|
|
|
|
kodak68x0_status_str(&ctx->sts), |
|
|
|
|
ctx->sts.status1, be32_to_cpu(ctx->sts.status2), ctx->sts.errcode); |
|
|
|
|
sinfonia_1x45_status_str(ctx->sts.status1, ctx->sts.status2, ctx->sts.errcode), |
|
|
|
|
ctx->sts.status1, ctx->sts.status2, ctx->sts.errcode); |
|
|
|
|
return CUPS_BACKEND_FAILED; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1318,8 +1068,8 @@ static int kodak6800_main_loop(void *vctx, const void *vjob) { |
|
|
|
|
|
|
|
|
|
if (ctx->sts.status1 == STATE_STATUS1_ERROR) { |
|
|
|
|
INFO("Printer State: %s # %02x %08x %02x\n", |
|
|
|
|
kodak68x0_status_str(&ctx->sts), |
|
|
|
|
ctx->sts.status1, be32_to_cpu(ctx->sts.status2), ctx->sts.errcode); |
|
|
|
|
sinfonia_1x45_status_str(ctx->sts.status1, ctx->sts.status2, ctx->sts.errcode), |
|
|
|
|
ctx->sts.status1, ctx->sts.status2, ctx->sts.errcode); |
|
|
|
|
return CUPS_BACKEND_FAILED; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|