shinko: More common structs and definitions.
This commit is contained in:
parent
dd6a0c756f
commit
bfd6e1b72a
|
@ -73,9 +73,6 @@ struct kodak605_sts_hdr {
|
|||
uint16_t length; /* LE, not counting this header */
|
||||
} __attribute__((packed));
|
||||
|
||||
#define RESULT_SUCCESS 0x01
|
||||
#define RESULT_FAIL 0x02
|
||||
|
||||
/* ERROR_* and STATUS_* are all guesses */
|
||||
#define STATUS_INIT_CPU 0x31
|
||||
#define STATUS_INIT_RIBBON 0x32
|
||||
|
@ -118,12 +115,6 @@ struct kodak605_media_list {
|
|||
struct kodak605_medium entries[];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define KODAK68x0_MEDIA_6R 0x0b // 197-4096
|
||||
#define KODAK68x0_MEDIA_UNK 0x03
|
||||
#define KODAK68x0_MEDIA_6TR2 0x2c // 396-2941
|
||||
#define KODAK68x0_MEDIA_NONE 0x00
|
||||
/* 6R: Also seen: 101-0867, 141-9597, 659-9054, 169-6418, DNP 900-060 */
|
||||
|
||||
#define MAX_MEDIA_LEN 128
|
||||
|
||||
/* Status response */
|
||||
|
@ -173,20 +164,6 @@ struct kodak605_hdr {
|
|||
uint8_t mode; /* Print mode -- 0x00, 0x01 seen */
|
||||
} __attribute__((packed));
|
||||
|
||||
static const char *kodak68xx_mediatypes(int type)
|
||||
{
|
||||
switch(type) {
|
||||
case KODAK68x0_MEDIA_NONE:
|
||||
return "No media";
|
||||
case KODAK68x0_MEDIA_6R:
|
||||
case KODAK68x0_MEDIA_6TR2:
|
||||
return "Kodak 6R";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
#define CMDBUF_LEN 4
|
||||
|
||||
/* Private data structure */
|
||||
|
@ -313,7 +290,7 @@ static int kodak605_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
} else {
|
||||
int media_code = KODAK68x0_MEDIA_6TR2;
|
||||
int media_code = KODAK6_MEDIA_6TR2;
|
||||
if (getenv("MEDIA_CODE"))
|
||||
media_code = atoi(getenv("MEDIA_CODE"));
|
||||
|
||||
|
@ -321,7 +298,7 @@ static int kodak605_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
}
|
||||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = kodak68xx_mediatypes(ctx->media->type);
|
||||
ctx->marker.name = kodak6_mediatypes(ctx->media->type);
|
||||
ctx->marker.levelmax = 100; /* Ie percentage */
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
@ -587,8 +564,8 @@ static void kodak605_dump_status(struct kodak605_ctx *ctx, struct kodak605_statu
|
|||
int max;
|
||||
|
||||
switch(ctx->media->type) {
|
||||
case KODAK68x0_MEDIA_6R:
|
||||
case KODAK68x0_MEDIA_6TR2:
|
||||
case KODAK6_MEDIA_6R:
|
||||
case KODAK6_MEDIA_6TR2:
|
||||
max = 375;
|
||||
break;
|
||||
default:
|
||||
|
@ -652,22 +629,11 @@ static void kodak605_dump_mediainfo(struct kodak605_media_list *media)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (media->type == KODAK68x0_MEDIA_NONE) {
|
||||
if (media->type == KODAK6_MEDIA_NONE) {
|
||||
DEBUG("No Media Loaded\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (media->type) {
|
||||
case KODAK68x0_MEDIA_6R:
|
||||
INFO("Media type: 6R (Kodak 197-4096 or equivalent)\n");
|
||||
break;
|
||||
case KODAK68x0_MEDIA_6TR2:
|
||||
INFO("Media type: 6R (Kodak 396-2941 or equivalent)\n");
|
||||
break;
|
||||
default:
|
||||
INFO("Media type %02x (unknown, please report!)\n", media->type);
|
||||
break;
|
||||
}
|
||||
kodak6_dumpmediacommon(media->type);
|
||||
|
||||
DEBUG("Legal print sizes:\n");
|
||||
for (i = 0 ; i < media->count ; i++) {
|
||||
|
|
|
@ -111,12 +111,6 @@ struct kodak68x0_media_readback {
|
|||
struct kodak6800_printsize sizes[];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define KODAK68x0_MEDIA_6R 0x0b // 197-4096
|
||||
#define KODAK68x0_MEDIA_UNK 0x03
|
||||
#define KODAK68x0_MEDIA_6TR2 0x2c // 396-2941
|
||||
#define KODAK68x0_MEDIA_NONE 0x00
|
||||
/* 6R: Also seen: 101-0867, 141-9597, 659-9054, 169-6418, DNP 900-060 */
|
||||
|
||||
#define CMDBUF_LEN 17
|
||||
|
||||
/* Private data structure */
|
||||
|
@ -147,20 +141,6 @@ struct kodak6800_ctx {
|
|||
|
||||
};
|
||||
|
||||
static const char *kodak68xx_mediatypes(int type)
|
||||
{
|
||||
switch(type) {
|
||||
case KODAK68x0_MEDIA_NONE:
|
||||
return "No media";
|
||||
case KODAK68x0_MEDIA_6R:
|
||||
case KODAK68x0_MEDIA_6TR2:
|
||||
return "Kodak 6R";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
/* Baseline commands */
|
||||
static int kodak6800_do_cmd(struct kodak6800_ctx *ctx,
|
||||
void *cmd, int cmd_len,
|
||||
|
@ -185,22 +165,13 @@ static int kodak6800_do_cmd(struct kodak6800_ctx *ctx,
|
|||
|
||||
static void kodak68x0_dump_mediainfo(struct kodak6800_printsize *sizes, uint8_t media_count, uint8_t media_type) {
|
||||
int i;
|
||||
if (media_type == KODAK68x0_MEDIA_NONE) {
|
||||
|
||||
if (media_type == KODAK6_MEDIA_NONE) {
|
||||
INFO("No Media Loaded\n");
|
||||
return;
|
||||
}
|
||||
kodak6_dumpmediacommon(media_type);
|
||||
|
||||
switch (media_type) {
|
||||
case KODAK68x0_MEDIA_6R:
|
||||
INFO("Media type: 6R (Kodak 197-4096 or equivalent)\n");
|
||||
break;
|
||||
case KODAK68x0_MEDIA_6TR2:
|
||||
INFO("Media type: 6R (Kodak 396-2941 or equivalent)\n");
|
||||
break;
|
||||
default:
|
||||
INFO("Media type %02x (unknown, please report!)\n", media_type);
|
||||
break;
|
||||
}
|
||||
INFO("Legal print sizes:\n");
|
||||
for (i = 0 ; i < media_count ; i++) {
|
||||
INFO("\t%d: %dx%d (%02x)\n", i,
|
||||
|
@ -375,8 +346,8 @@ static void kodak68x0_dump_status(struct kodak6800_ctx *ctx, struct kodak68x0_st
|
|||
INFO("\tMedia : %u\n", be32_to_cpu(status->media));
|
||||
|
||||
switch(ctx->media_type) {
|
||||
case KODAK68x0_MEDIA_6R:
|
||||
case KODAK68x0_MEDIA_6TR2:
|
||||
case KODAK6_MEDIA_6R:
|
||||
case KODAK6_MEDIA_6TR2:
|
||||
max = 375;
|
||||
break;
|
||||
default:
|
||||
|
@ -817,7 +788,7 @@ static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev, int ty
|
|||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
} else {
|
||||
int media_code = KODAK68x0_MEDIA_6TR2;
|
||||
int media_code = KODAK6_MEDIA_6TR2;
|
||||
if (getenv("MEDIA_CODE"))
|
||||
media_code = atoi(getenv("MEDIA_CODE"));
|
||||
|
||||
|
@ -825,7 +796,7 @@ static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev, int ty
|
|||
}
|
||||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = kodak68xx_mediatypes(ctx->media_type);
|
||||
ctx->marker.name = kodak6_mediatypes(ctx->media_type);
|
||||
ctx->marker.levelmax = 100; /* Ie percentage */
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -228,6 +228,35 @@ char *media_types(uint8_t v) {
|
|||
}
|
||||
}
|
||||
|
||||
const char *kodak6_mediatypes(int type)
|
||||
{
|
||||
switch(type) {
|
||||
case KODAK6_MEDIA_NONE:
|
||||
return "No media";
|
||||
case KODAK6_MEDIA_6R:
|
||||
case KODAK6_MEDIA_6TR2:
|
||||
return "Kodak 6R";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
void kodak6_dumpmediacommon(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case KODAK6_MEDIA_6R:
|
||||
INFO("Media type: 6R (Kodak 197-4096 or equivalent)\n");
|
||||
break;
|
||||
case KODAK6_MEDIA_6TR2:
|
||||
INFO("Media type: 6R (Kodak 396-2941 or equivalent)\n");
|
||||
break;
|
||||
default:
|
||||
INFO("Media type %02x (unknown, please report!)\n", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Below are for S1145 (EK68xx) and S1245 only! */
|
||||
char *sinfonia_1x45_status_str(uint8_t status1, uint32_t status2, uint8_t error)
|
||||
{
|
||||
|
|
|
@ -110,6 +110,54 @@ enum {
|
|||
|
||||
char *media_types(uint8_t v);
|
||||
|
||||
/* Common command structs */
|
||||
struct sinfonia_cmd_hdr {
|
||||
uint16_t cmd;
|
||||
uint16_t len; /* Not including this header */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct sinfonia_status_hdr {
|
||||
uint8_t result;
|
||||
uint8_t error;
|
||||
uint8_t printer_major;
|
||||
uint8_t printer_minor;
|
||||
uint8_t reserved[2];
|
||||
uint8_t mode; /* S6245 only, so far */
|
||||
uint8_t status;
|
||||
uint16_t payload_len;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct sinfonia_cancel_cmd {
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct sinfonia_fwinfo_cmd {
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct sinfonia_fwinfo_resp {
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t name[8];
|
||||
uint8_t type[16];
|
||||
uint8_t date[10];
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
uint16_t checksum;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* 6R: Also seen: 101-0867, 141-9597, 659-9054, 169-6418, DNP 900-060 */
|
||||
#define KODAK6_MEDIA_6R 0x0b // 197-4096
|
||||
#define KODAK6_MEDIA_UNK 0x03
|
||||
#define KODAK6_MEDIA_6TR2 0x2c // 396-2941
|
||||
#define KODAK6_MEDIA_NONE 0x00
|
||||
|
||||
const char *kodak6_mediatypes(int type);
|
||||
void kodak6_dumpmediacommon(int type);
|
||||
|
||||
#define RESULT_SUCCESS 0x01
|
||||
#define RESULT_FAIL 0x02
|
||||
|
||||
/* ********** Below are for the old S1145 (EK68xx) and S1245 only! */
|
||||
|
||||
|
|
|
@ -96,11 +96,6 @@ struct s2145_printjob_hdr {
|
|||
#endif
|
||||
|
||||
/* Structs for printer */
|
||||
struct s2145_cmd_hdr {
|
||||
uint16_t cmd;
|
||||
uint16_t len; /* Not including this header */
|
||||
} __attribute__((packed));
|
||||
|
||||
#define S2145_CMD_STATUS 0x0001
|
||||
#define S2145_CMD_MEDIAINFO 0x0002
|
||||
#define S2145_CMD_MODELNAME 0x0003
|
||||
|
@ -152,7 +147,7 @@ static char *cmd_names(uint16_t v) {
|
|||
}
|
||||
|
||||
struct s2145_print_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
uint16_t count;
|
||||
uint16_t columns;
|
||||
|
@ -218,7 +213,7 @@ static char *print_modes(uint8_t v) {
|
|||
switch (v) {
|
||||
case PRINT_MODE_DEFAULT:
|
||||
return "Default";
|
||||
case PRINT_MODE_STD_GLOSSY:
|
||||
s case PRINT_MODE_STD_GLOSSY:
|
||||
return "Std Glossy";
|
||||
case PRINT_MODE_FINE_GLOSSY:
|
||||
return "Fine Glossy";
|
||||
|
@ -253,13 +248,8 @@ static char *print_methods (uint8_t v) {
|
|||
}
|
||||
}
|
||||
|
||||
struct s2145_cancel_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s2145_reset_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -267,23 +257,18 @@ struct s2145_reset_cmd {
|
|||
#define RESET_USER_CURVE 0x04
|
||||
|
||||
struct s2145_readtone_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t curveid;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s2145_button_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t enabled;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define BUTTON_ENABLED 0x01
|
||||
#define BUTTON_DISABLED 0x00
|
||||
|
||||
struct s2145_fwinfo_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define FWINFO_TARGET_MAIN_BOOT 0x01
|
||||
#define FWINFO_TARGET_MAIN_APP 0x02
|
||||
#define FWINFO_TARGET_DSP_BOOT 0x03
|
||||
|
@ -314,33 +299,18 @@ static char *fwinfo_targets (uint8_t v) {
|
|||
}
|
||||
|
||||
struct s2145_update_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint32_t reserved;
|
||||
uint32_t size;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define TONE_CURVE_SIZE 0x600
|
||||
|
||||
struct s2145_setunique_cmd {
|
||||
struct s2145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t len;
|
||||
uint8_t data[23]; /* Not necessarily all used. */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s2145_status_hdr {
|
||||
uint8_t result;
|
||||
uint8_t error;
|
||||
uint8_t printer_major;
|
||||
uint8_t printer_minor;
|
||||
uint8_t reserved[3];
|
||||
uint8_t status;
|
||||
uint16_t payload_len;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define RESULT_SUCCESS 0x01
|
||||
#define RESULT_FAIL 0x02
|
||||
|
||||
static char *error_codes(uint8_t major, uint8_t minor)
|
||||
{
|
||||
switch(major) {
|
||||
|
@ -615,7 +585,7 @@ static char *status_str(uint8_t v) {
|
|||
}
|
||||
|
||||
struct s2145_status_resp {
|
||||
struct s2145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint32_t count_lifetime;
|
||||
uint32_t count_maint;
|
||||
uint32_t count_paper;
|
||||
|
@ -636,7 +606,7 @@ struct s2145_status_resp {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct s2145_readtone_resp {
|
||||
struct s2145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint16_t total_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -650,36 +620,26 @@ struct s2145_mediainfo_item {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct s2145_mediainfo_resp {
|
||||
struct s2145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t count;
|
||||
struct s2145_mediainfo_item items[10]; /* Not all necessarily used */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s2145_modelname_resp {
|
||||
struct s2145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t vendor[4];
|
||||
uint8_t product[4];
|
||||
uint8_t modelname[40];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s2145_errorlog_resp {
|
||||
struct s2145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t count;
|
||||
struct sinfonia_error_item items[10]; /* Not all necessarily used */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s2145_fwinfo_resp {
|
||||
struct s2145_status_hdr hdr;
|
||||
uint8_t name[8];
|
||||
uint8_t type[16];
|
||||
uint8_t date[10];
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
uint16_t checksum;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s2145_getunique_resp {
|
||||
struct s2145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t data[24]; /* Not necessarily all used. */
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -708,7 +668,7 @@ static int s2145_do_cmd(struct shinkos2145_ctx *ctx,
|
|||
int minlen, int *num)
|
||||
{
|
||||
int ret;
|
||||
struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
|
||||
libusb_device_handle *dev = ctx->dev;
|
||||
uint8_t endp_up = ctx->endp_up;
|
||||
|
@ -742,7 +702,7 @@ static int s2145_do_cmd(struct shinkos2145_ctx *ctx,
|
|||
|
||||
static int get_status(struct shinkos2145_ctx *ctx)
|
||||
{
|
||||
struct s2145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s2145_status_resp *resp = (struct s2145_status_resp *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
|
@ -768,7 +728,7 @@ static int get_status(struct shinkos2145_ctx *ctx)
|
|||
resp->hdr.printer_major,
|
||||
resp->hdr.printer_minor, error_codes(resp->hdr.printer_major, resp->hdr.printer_minor));
|
||||
}
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s2145_status_resp) - sizeof(struct s2145_status_hdr)))
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s2145_status_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return 0;
|
||||
|
||||
INFO(" Print Counts:\n");
|
||||
|
@ -799,8 +759,8 @@ static int get_status(struct shinkos2145_ctx *ctx)
|
|||
|
||||
static int get_fwinfo(struct shinkos2145_ctx *ctx)
|
||||
{
|
||||
struct s2145_fwinfo_cmd cmd;
|
||||
struct s2145_fwinfo_resp *resp = (struct s2145_fwinfo_resp *)rdbuf;
|
||||
struct sinfonia_fwinfo_cmd cmd;
|
||||
struct sinfonia_fwinfo_resp *resp = (struct sinfonia_fwinfo_resp *)rdbuf;
|
||||
int num = 0;
|
||||
int i;
|
||||
|
||||
|
@ -821,7 +781,7 @@ static int get_fwinfo(struct shinkos2145_ctx *ctx)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s2145_fwinfo_resp) - sizeof(struct s2145_status_hdr)))
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct sinfonia_fwinfo_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
continue;
|
||||
|
||||
INFO(" %s\t ver %02x.%02x\n", fwinfo_targets(i),
|
||||
|
@ -839,7 +799,7 @@ static int get_fwinfo(struct shinkos2145_ctx *ctx)
|
|||
|
||||
static int get_errorlog(struct shinkos2145_ctx *ctx)
|
||||
{
|
||||
struct s2145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s2145_errorlog_resp *resp = (struct s2145_errorlog_resp *) rdbuf;
|
||||
int ret, num = 0;
|
||||
int i;
|
||||
|
@ -855,7 +815,7 @@ static int get_errorlog(struct shinkos2145_ctx *ctx)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s2145_errorlog_resp) - sizeof(struct s2145_status_hdr)))
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s2145_errorlog_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return -2;
|
||||
|
||||
INFO("Stored Error Events: %u entries:\n", resp->count);
|
||||
|
@ -884,7 +844,7 @@ static void dump_mediainfo(struct s2145_mediainfo_resp *resp)
|
|||
|
||||
static int get_user_string(struct shinkos2145_ctx *ctx)
|
||||
{
|
||||
struct s2145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s2145_getunique_resp *resp = (struct s2145_getunique_resp*) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
|
@ -911,7 +871,7 @@ static int get_user_string(struct shinkos2145_ctx *ctx)
|
|||
static int set_user_string(struct shinkos2145_ctx *ctx, char *str)
|
||||
{
|
||||
struct s2145_setunique_cmd cmd;
|
||||
struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
if (str) {
|
||||
|
@ -940,8 +900,8 @@ static int set_user_string(struct shinkos2145_ctx *ctx, char *str)
|
|||
|
||||
static int cancel_job(struct shinkos2145_ctx *ctx, char *str)
|
||||
{
|
||||
struct s2145_cancel_cmd cmd;
|
||||
struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf;
|
||||
struct sinfonia_cancel_cmd cmd;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
if (!str)
|
||||
|
@ -965,8 +925,8 @@ static int cancel_job(struct shinkos2145_ctx *ctx, char *str)
|
|||
|
||||
static int flash_led(struct shinkos2145_ctx *ctx)
|
||||
{
|
||||
struct s2145_cmd_hdr cmd;
|
||||
struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
cmd.cmd = cpu_to_le16(S2145_CMD_FLASHLED);
|
||||
|
@ -986,7 +946,7 @@ static int flash_led(struct shinkos2145_ctx *ctx)
|
|||
static int reset_curve(struct shinkos2145_ctx *ctx, int target)
|
||||
{
|
||||
struct s2145_reset_cmd cmd;
|
||||
struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
cmd.target = target;
|
||||
|
@ -1008,7 +968,7 @@ static int reset_curve(struct shinkos2145_ctx *ctx, int target)
|
|||
static int button_set(struct shinkos2145_ctx *ctx, int enable)
|
||||
{
|
||||
struct s2145_button_cmd cmd;
|
||||
struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
cmd.hdr.cmd = cpu_to_le16(S2145_CMD_BUTTON);
|
||||
|
@ -1110,7 +1070,7 @@ done:
|
|||
static int set_tonecurve(struct shinkos2145_ctx *ctx, int target, char *fname)
|
||||
{
|
||||
struct s2145_update_cmd cmd;
|
||||
struct s2145_status_hdr *resp = (struct s2145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
INFO("Set %s Tone Curve from '%s'\n", sinfonia_update_targets(target), fname);
|
||||
|
@ -1289,7 +1249,7 @@ static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
int media_prints = 65536;
|
||||
if (test_mode < TEST_MODE_NOATTACH) {
|
||||
/* Query Media */
|
||||
struct s2145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s2145_mediainfo_resp *resp = (struct s2145_mediainfo_resp *) rdbuf;
|
||||
int num = 0;
|
||||
int i;
|
||||
|
@ -1396,7 +1356,7 @@ static int shinkos2145_main_loop(void *vctx, const void *vjob) {
|
|||
|
||||
int i, last_state = -1, state = S_IDLE;
|
||||
|
||||
struct s2145_cmd_hdr *cmd = (struct s2145_cmd_hdr *) cmdbuf;;
|
||||
struct sinfonia_cmd_hdr *cmd = (struct sinfonia_cmd_hdr *) cmdbuf;;
|
||||
struct s2145_print_cmd *print = (struct s2145_print_cmd *) cmdbuf;
|
||||
struct s2145_status_resp *sts = (struct s2145_status_resp *) rdbuf;
|
||||
|
||||
|
@ -1430,7 +1390,7 @@ top:
|
|||
|
||||
if ((ret = s2145_do_cmd(ctx,
|
||||
cmdbuf, sizeof(*cmd),
|
||||
sizeof(struct s2145_status_hdr),
|
||||
sizeof(struct sinfonia_status_hdr),
|
||||
&num)) < 0) {
|
||||
ERROR("Failed to execute %s command\n", cmd_names(cmd->cmd));
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -1496,7 +1456,7 @@ top:
|
|||
|
||||
if ((ret = s2145_do_cmd(ctx,
|
||||
cmdbuf, sizeof(*print),
|
||||
sizeof(struct s2145_status_hdr),
|
||||
sizeof(struct sinfonia_status_hdr),
|
||||
&num)) < 0) {
|
||||
ERROR("Failed to execute %s command\n", cmd_names(print->hdr.cmd));
|
||||
return ret;
|
||||
|
@ -1566,7 +1526,7 @@ printer_error:
|
|||
|
||||
static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
|
||||
{
|
||||
struct s2145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s2145_getunique_resp *resp = (struct s2145_getunique_resp*) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
|
@ -1601,7 +1561,7 @@ static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t end
|
|||
static int shinkos2145_query_markers(void *vctx, struct marker **markers, int *count)
|
||||
{
|
||||
struct shinkos2145_ctx *ctx = vctx;
|
||||
struct s2145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s2145_status_resp *sts = (struct s2145_status_resp *) rdbuf;
|
||||
int num;
|
||||
|
||||
|
|
|
@ -265,11 +265,6 @@ struct shinkos6145_correctionparam {
|
|||
} __attribute__((packed)); /* 16384 bytes */
|
||||
|
||||
/* Structs for printer */
|
||||
struct s6145_cmd_hdr {
|
||||
uint16_t cmd;
|
||||
uint16_t len; /* Not including this header */
|
||||
} __attribute__((packed));
|
||||
|
||||
#define S6145_CMD_GETSTATUS 0x0001
|
||||
#define S6145_CMD_MEDIAINFO 0x0002
|
||||
#define S6145_CMD_ERRORLOG 0x0004
|
||||
|
@ -337,7 +332,7 @@ static char *cmd_names(uint16_t v) {
|
|||
}
|
||||
|
||||
struct s6145_print_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
uint16_t count;
|
||||
uint16_t columns;
|
||||
|
@ -390,13 +385,8 @@ static char *print_methods (uint8_t v) {
|
|||
}
|
||||
}
|
||||
|
||||
struct s6145_cancel_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_reset_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint8_t curveid;
|
||||
} __attribute__((packed));
|
||||
|
@ -407,7 +397,7 @@ struct s6145_reset_cmd {
|
|||
#define TONE_CURVE_ID 0x01
|
||||
|
||||
struct s6145_readtone_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint8_t curveid;
|
||||
} __attribute__((packed));
|
||||
|
@ -416,7 +406,7 @@ struct s6145_readtone_cmd {
|
|||
#define READ_TONE_CURVE_CURR 0x02
|
||||
|
||||
struct s6145_setparam_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint32_t param;
|
||||
} __attribute__((packed));
|
||||
|
@ -450,30 +440,25 @@ struct s6145_setparam_cmd {
|
|||
#define PARAM_SLEEP_240MIN 0x00000005
|
||||
|
||||
struct s6145_seteeprom_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t data[256]; /* Maxlen */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_errorlog_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint16_t index; /* 0 is latest */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_getparam_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_getprintidstatus_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_fwinfo_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define FWINFO_TARGET_MAIN_BOOT 0x01
|
||||
#define FWINFO_TARGET_MAIN_APP 0x02
|
||||
#define FWINFO_TARGET_PRINT_TABLES 0x03
|
||||
|
@ -495,7 +480,7 @@ static char *fwinfo_targets (uint8_t v) {
|
|||
}
|
||||
|
||||
struct s6145_update_cmd {
|
||||
struct s6145_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint8_t curve_id;
|
||||
uint8_t reset; // ??
|
||||
|
@ -503,19 +488,6 @@ struct s6145_update_cmd {
|
|||
uint32_t size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_status_hdr {
|
||||
uint8_t result;
|
||||
uint8_t error;
|
||||
uint8_t printer_major;
|
||||
uint8_t printer_minor;
|
||||
uint8_t reserved[3];
|
||||
uint8_t status;
|
||||
uint16_t payload_len;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define RESULT_SUCCESS 0x01
|
||||
#define RESULT_FAIL 0x02
|
||||
|
||||
static char *error_codes(uint8_t major, uint8_t minor)
|
||||
{
|
||||
switch(major) {
|
||||
|
@ -781,7 +753,7 @@ static char *status_str(uint8_t v) {
|
|||
}
|
||||
|
||||
struct s6145_status_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint32_t count_lifetime;
|
||||
uint32_t count_maint;
|
||||
uint32_t count_paper;
|
||||
|
@ -808,12 +780,12 @@ struct s6145_status_resp {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct s6145_geteeprom_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t data[256];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_readtone_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint16_t total_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -920,7 +892,7 @@ static const char *print_ribbons (uint8_t v) {
|
|||
}
|
||||
|
||||
struct s6145_mediainfo_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t ribbon;
|
||||
uint8_t reserved;
|
||||
uint8_t count;
|
||||
|
@ -928,23 +900,23 @@ struct s6145_mediainfo_resp {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct s6145_errorlog_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t count;
|
||||
struct sinfonia_error_item items[10]; /* Not all necessarily used */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_getparam_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint32_t param;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_getserial_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t data[8];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_getprintidstatus_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t id;
|
||||
uint16_t remaining;
|
||||
uint16_t finished;
|
||||
|
@ -958,25 +930,15 @@ struct s6145_getprintidstatus_resp {
|
|||
#define STATUS_ERROR 0xFFFF
|
||||
|
||||
struct s6145_getextcounter_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint32_t lifetime_distance; /* Inches */
|
||||
uint32_t maint_distance;
|
||||
uint32_t head_distance;
|
||||
uint8_t reserved[32];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_fwinfo_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
uint8_t name[8];
|
||||
uint8_t type[16];
|
||||
uint8_t date[10];
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
uint16_t checksum;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6145_imagecorr_resp {
|
||||
struct s6145_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint16_t total_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -1026,7 +988,7 @@ static int s6145_do_cmd(struct shinkos6145_ctx *ctx,
|
|||
int minlen, int *num)
|
||||
{
|
||||
int ret;
|
||||
struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
|
||||
libusb_device_handle *dev = ctx->dev;
|
||||
uint8_t endp_up = ctx->endp_up;
|
||||
|
@ -1060,7 +1022,7 @@ static int s6145_do_cmd(struct shinkos6145_ctx *ctx,
|
|||
|
||||
static int get_status(struct shinkos6145_ctx *ctx)
|
||||
{
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6145_status_resp *resp = (struct s6145_status_resp *) rdbuf;
|
||||
struct s6145_getextcounter_resp *resp2 = (struct s6145_getextcounter_resp *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
@ -1088,7 +1050,7 @@ static int get_status(struct shinkos6145_ctx *ctx)
|
|||
resp->hdr.printer_major,
|
||||
resp->hdr.printer_minor, error_codes(resp->hdr.printer_major, resp->hdr.printer_minor));
|
||||
}
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6145_status_resp) - sizeof(struct s6145_status_hdr)))
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6145_status_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return -1;
|
||||
|
||||
INFO(" Print Counts:\n");
|
||||
|
@ -1125,7 +1087,7 @@ static int get_status(struct shinkos6145_ctx *ctx)
|
|||
ERROR("Failed to execute %s command\n", cmd_names(cmd.cmd));
|
||||
return ret;
|
||||
}
|
||||
if (le16_to_cpu(resp2->hdr.payload_len) != (sizeof(struct s6145_getextcounter_resp) - sizeof(struct s6145_status_hdr)))
|
||||
if (le16_to_cpu(resp2->hdr.payload_len) != (sizeof(struct s6145_getextcounter_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return -1;
|
||||
|
||||
INFO("Lifetime Distance: %08u inches\n", le32_to_cpu(resp2->lifetime_distance));
|
||||
|
@ -1185,8 +1147,8 @@ static int get_status(struct shinkos6145_ctx *ctx)
|
|||
|
||||
static int get_fwinfo(struct shinkos6145_ctx *ctx)
|
||||
{
|
||||
struct s6145_fwinfo_cmd cmd;
|
||||
struct s6145_fwinfo_resp *resp = (struct s6145_fwinfo_resp *)rdbuf;
|
||||
struct sinfonia_fwinfo_cmd cmd;
|
||||
struct sinfonia_fwinfo_resp *resp = (struct sinfonia_fwinfo_resp *)rdbuf;
|
||||
int num = 0;
|
||||
int i;
|
||||
|
||||
|
@ -1207,7 +1169,7 @@ static int get_fwinfo(struct shinkos6145_ctx *ctx)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6145_fwinfo_resp) - sizeof(struct s6145_status_hdr)))
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct sinfonia_fwinfo_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
continue;
|
||||
|
||||
INFO(" %s\t ver %02x.%02x\n", fwinfo_targets(i),
|
||||
|
@ -1225,7 +1187,7 @@ static int get_fwinfo(struct shinkos6145_ctx *ctx)
|
|||
|
||||
static int get_errorlog(struct shinkos6145_ctx *ctx)
|
||||
{
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6145_errorlog_resp *resp = (struct s6145_errorlog_resp *) rdbuf;
|
||||
int ret, num = 0;
|
||||
int i;
|
||||
|
@ -1241,7 +1203,7 @@ static int get_errorlog(struct shinkos6145_ctx *ctx)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6145_errorlog_resp) - sizeof(struct s6145_status_hdr)))
|
||||
if (le16_to_cpu(resp->hdr.payload_len) != (sizeof(struct s6145_errorlog_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return -2;
|
||||
|
||||
INFO("Stored Error Events: %u entries:\n", resp->count);
|
||||
|
@ -1271,8 +1233,8 @@ static void dump_mediainfo(struct s6145_mediainfo_resp *resp)
|
|||
|
||||
static int cancel_job(struct shinkos6145_ctx *ctx, char *str)
|
||||
{
|
||||
struct s6145_cancel_cmd cmd;
|
||||
struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf;
|
||||
struct sinfonia_cancel_cmd cmd;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
if (!str)
|
||||
|
@ -1296,8 +1258,8 @@ static int cancel_job(struct shinkos6145_ctx *ctx, char *str)
|
|||
|
||||
static int flash_led(struct shinkos6145_ctx *ctx)
|
||||
{
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
cmd.cmd = cpu_to_le16(S6145_CMD_FLASHLED);
|
||||
|
@ -1318,7 +1280,7 @@ static int flash_led(struct shinkos6145_ctx *ctx)
|
|||
static int set_param(struct shinkos6145_ctx *ctx, int target, uint32_t param)
|
||||
{
|
||||
struct s6145_setparam_cmd cmd;
|
||||
struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
/* Set up command */
|
||||
|
@ -1365,7 +1327,7 @@ static int get_param(struct shinkos6145_ctx *ctx, int target, uint32_t *param)
|
|||
static int reset_curve(struct shinkos6145_ctx *ctx, int target)
|
||||
{
|
||||
struct s6145_reset_cmd cmd;
|
||||
struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
cmd.target = target;
|
||||
|
@ -1521,7 +1483,7 @@ done:
|
|||
static int set_tonecurve(struct shinkos6145_ctx *ctx, int target, char *fname)
|
||||
{
|
||||
struct s6145_update_cmd cmd;
|
||||
struct s6145_status_hdr *resp = (struct s6145_status_hdr *) rdbuf;
|
||||
struct sinfonia_status_hdr *resp = (struct sinfonia_status_hdr *) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
INFO("Set %s Tone Curve from '%s'\n", sinfonia_update_targets(target), fname);
|
||||
|
@ -1579,7 +1541,7 @@ done:
|
|||
|
||||
static int shinkos6145_get_imagecorr(struct shinkos6145_ctx *ctx)
|
||||
{
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6145_imagecorr_resp *resp = (struct s6145_imagecorr_resp *) rdbuf;
|
||||
|
||||
size_t total = 0;
|
||||
|
@ -1636,7 +1598,7 @@ done:
|
|||
|
||||
static int shinkos6145_get_eeprom(struct shinkos6145_ctx *ctx)
|
||||
{
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6145_geteeprom_resp *resp = (struct s6145_geteeprom_resp *) rdbuf;
|
||||
|
||||
int ret, num;
|
||||
|
@ -1824,7 +1786,7 @@ static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
if (test_mode < TEST_MODE_NOATTACH) {
|
||||
/* Query Media */
|
||||
struct s6145_mediainfo_resp *resp = (struct s6145_mediainfo_resp *) rdbuf;
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
int num;
|
||||
|
||||
if (s6145_do_cmd(ctx,
|
||||
|
@ -2055,7 +2017,7 @@ static int shinkos6145_main_loop(void *vctx, const void *vjob) {
|
|||
|
||||
int i, last_state = -1, state = S_IDLE;
|
||||
|
||||
struct s6145_cmd_hdr *cmd = (struct s6145_cmd_hdr *) cmdbuf;
|
||||
struct sinfonia_cmd_hdr *cmd = (struct sinfonia_cmd_hdr *) cmdbuf;
|
||||
struct s6145_print_cmd *print = (struct s6145_print_cmd *) cmdbuf;
|
||||
struct s6145_status_resp *sts = (struct s6145_status_resp *) rdbuf;
|
||||
struct s6145_mediainfo_resp *media = (struct s6145_mediainfo_resp *) rdbuf;
|
||||
|
@ -2080,7 +2042,7 @@ static int shinkos6145_main_loop(void *vctx, const void *vjob) {
|
|||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
|
||||
if (le16_to_cpu(media->hdr.payload_len) != (sizeof(struct s6145_mediainfo_resp) - sizeof(struct s6145_status_hdr)))
|
||||
if (le16_to_cpu(media->hdr.payload_len) != (sizeof(struct s6145_mediainfo_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
/* Validate print sizes */
|
||||
|
@ -2119,7 +2081,7 @@ top:
|
|||
|
||||
if ((ret = s6145_do_cmd(ctx,
|
||||
cmdbuf, sizeof(*cmd),
|
||||
sizeof(struct s6145_status_hdr),
|
||||
sizeof(struct sinfonia_status_hdr),
|
||||
&num)) < 0) {
|
||||
ERROR("Failed to execute %s command\n", cmd_names(cmd->cmd));
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -2253,7 +2215,7 @@ top:
|
|||
|
||||
if ((ret = s6145_do_cmd(ctx,
|
||||
cmdbuf, sizeof(*print),
|
||||
sizeof(struct s6145_status_hdr),
|
||||
sizeof(struct sinfonia_status_hdr),
|
||||
&num)) < 0) {
|
||||
ERROR("Failed to execute %s command\n", cmd_names(print->hdr.cmd));
|
||||
return ret;
|
||||
|
@ -2314,7 +2276,7 @@ printer_error:
|
|||
|
||||
static int shinkos6145_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
|
||||
{
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6145_getserial_resp *resp = (struct s6145_getserial_resp*) rdbuf;
|
||||
int ret, num = 0;
|
||||
|
||||
|
@ -2349,7 +2311,7 @@ static int shinkos6145_query_serno(struct libusb_device_handle *dev, uint8_t end
|
|||
static int shinkos6145_query_markers(void *vctx, struct marker **markers, int *count)
|
||||
{
|
||||
struct shinkos6145_ctx *ctx = vctx;
|
||||
struct s6145_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6145_status_resp *sts = (struct s6145_status_resp *) rdbuf;
|
||||
int num;
|
||||
|
||||
|
|
|
@ -95,11 +95,6 @@ struct s6245_printjob_hdr {
|
|||
#endif
|
||||
|
||||
/* Structs for printer */
|
||||
struct s6245_cmd_hdr {
|
||||
uint16_t cmd;
|
||||
uint16_t len; /* Not including this header */
|
||||
} __attribute__((packed));
|
||||
|
||||
#define S6245_CMD_GETSTATUS 0x0001
|
||||
#define S6245_CMD_MEDIAINFO 0x0002
|
||||
#define S6245_CMD_ERRORLOG 0x0004
|
||||
|
@ -166,7 +161,7 @@ static char *cmd_names(uint16_t v) {
|
|||
}
|
||||
|
||||
struct s6245_print_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
uint16_t count;
|
||||
uint16_t columns;
|
||||
|
@ -215,13 +210,8 @@ static char *print_methods (uint8_t v) {
|
|||
}
|
||||
}
|
||||
|
||||
struct s6245_cancel_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_reset_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint8_t curveid;
|
||||
} __attribute__((packed));
|
||||
|
@ -232,7 +222,7 @@ struct s6245_reset_cmd {
|
|||
#define TONE_CURVE_ID 0x01
|
||||
|
||||
struct s6245_readtone_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint8_t curveid;
|
||||
} __attribute__((packed));
|
||||
|
@ -241,7 +231,7 @@ struct s6245_readtone_cmd {
|
|||
#define READ_TONE_CURVE_CURR 0x02
|
||||
|
||||
struct s6245_setparam_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint32_t param;
|
||||
} __attribute__((packed));
|
||||
|
@ -264,12 +254,12 @@ struct s6245_setparam_cmd {
|
|||
#define PARAM_SLEEP_240MIN 0x00000005
|
||||
|
||||
struct s6245_seteeprom_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t data[256]; /* Maxlen */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_settime_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t enable; /* 0 or 1 */
|
||||
uint8_t second;
|
||||
uint8_t minute;
|
||||
|
@ -280,25 +270,20 @@ struct s6245_settime_cmd {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct s6245_errorlog_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint16_t index; /* 0 is latest */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_getparam_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_getprintidstatus_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t id;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_fwinfo_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define FWINFO_TARGET_MAIN_BOOT 0x01
|
||||
#define FWINFO_TARGET_MAIN_APP 0x02
|
||||
#define FWINFO_TARGET_PRINT_TABLES 0x03
|
||||
|
@ -320,7 +305,7 @@ static char *fwinfo_targets (uint8_t v) {
|
|||
}
|
||||
|
||||
struct s6245_update_cmd {
|
||||
struct s6245_cmd_hdr hdr;
|
||||
struct sinfonia_cmd_hdr hdr;
|
||||
uint8_t target;
|
||||
uint8_t curve_id;
|
||||
uint8_t reset; // ??
|
||||
|
@ -328,20 +313,6 @@ struct s6245_update_cmd {
|
|||
uint32_t size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_status_hdr {
|
||||
uint8_t result;
|
||||
uint8_t error;
|
||||
uint8_t printer_major;
|
||||
uint8_t printer_minor;
|
||||
uint8_t reserved[2];
|
||||
uint8_t mode;
|
||||
uint8_t status;
|
||||
uint16_t payload_len;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define RESULT_SUCCESS 0x01
|
||||
#define RESULT_FAIL 0x02
|
||||
|
||||
static char *error_codes(uint8_t major, uint8_t minor)
|
||||
{
|
||||
switch(major) {
|
||||
|
@ -629,7 +600,7 @@ static char *status_str(uint8_t v) {
|
|||
}
|
||||
|
||||
struct s6245_status_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint32_t count_lifetime;
|
||||
uint32_t count_maint;
|
||||
uint32_t count_paper;
|
||||
|
@ -656,12 +627,12 @@ struct s6245_status_resp {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct s6245_geteeprom_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t data[256];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_readtone_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint16_t total_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -713,7 +684,7 @@ static const char *print_sizes (uint8_t v) {
|
|||
}
|
||||
|
||||
struct s6245_mediainfo_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t ribbon_code;
|
||||
uint8_t reserved;
|
||||
uint8_t count;
|
||||
|
@ -745,7 +716,7 @@ static int ribbon_counts (uint8_t v) {
|
|||
}
|
||||
|
||||
struct s6245_errorlog_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint16_t error_count;
|
||||
uint8_t error_major;
|
||||
uint8_t error_minor;
|
||||
|
@ -777,17 +748,17 @@ struct s6245_errorlog_resp {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct s6245_getparam_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint32_t param;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_getserial_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t data[8];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_getprintidstatus_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint8_t id;
|
||||
uint16_t remaining;
|
||||
uint16_t finished;
|
||||
|
@ -801,23 +772,13 @@ struct s6245_getprintidstatus_resp {
|
|||
#define STATUS_ERROR 0xFFFF
|
||||
|
||||
struct s6245_getextcounter_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
struct sinfonia_status_hdr hdr;
|
||||
uint32_t lifetime_distance; /* Inches */
|
||||
uint32_t maint_distance;
|
||||
uint32_t head_distance;
|
||||
uint8_t reserved[32];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct s6245_fwinfo_resp {
|
||||
struct s6245_status_hdr hdr;
|
||||
uint8_t name[8];
|
||||
uint8_t type[16];
|
||||
uint8_t date[10];
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
uint16_t checksum;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* Private data structure */
|
||||
struct shinkos6245_ctx {
|
||||
struct libusb_device_handle *dev;
|
||||
|
@ -838,7 +799,7 @@ struct shinkos6245_ctx {
|
|||
static int s6245_do_cmd(struct shinkos6245_ctx *ctx,
|
||||
uint8_t *cmd, int cmdlen,
|
||||
int buflen,
|
||||
int *num, struct s6245_status_hdr *resp)
|
||||
int *num, struct sinfonia_status_hdr *resp)
|
||||
{
|
||||
libusb_device_handle *dev = ctx->dev;
|
||||
uint8_t endp_up = ctx->endp_up;
|
||||
|
@ -869,7 +830,7 @@ static int s6245_do_cmd(struct shinkos6245_ctx *ctx,
|
|||
|
||||
static int get_status(struct shinkos6245_ctx *ctx)
|
||||
{
|
||||
struct s6245_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6245_status_resp resp;
|
||||
struct s6245_getextcounter_resp resp2;
|
||||
int ret, num = 0;
|
||||
|
@ -896,7 +857,7 @@ static int get_status(struct shinkos6245_ctx *ctx)
|
|||
resp.hdr.printer_major,
|
||||
resp.hdr.printer_minor, error_codes(resp.hdr.printer_major, resp.hdr.printer_minor));
|
||||
}
|
||||
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct s6245_status_resp) - sizeof(struct s6245_status_hdr)))
|
||||
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct s6245_status_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return 0;
|
||||
|
||||
INFO(" Print Counts:\n");
|
||||
|
@ -933,7 +894,7 @@ static int get_status(struct shinkos6245_ctx *ctx)
|
|||
ERROR("Failed to execute %s command\n", cmd_names(cmd.cmd));
|
||||
return ret;
|
||||
}
|
||||
if (le16_to_cpu(resp2.hdr.payload_len) != (sizeof(struct s6245_getextcounter_resp) - sizeof(struct s6245_status_hdr)))
|
||||
if (le16_to_cpu(resp2.hdr.payload_len) != (sizeof(struct s6245_getextcounter_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return 0;
|
||||
|
||||
INFO("Lifetime Distance: %08u inches\n", le32_to_cpu(resp2.lifetime_distance));
|
||||
|
@ -945,8 +906,8 @@ static int get_status(struct shinkos6245_ctx *ctx)
|
|||
|
||||
static int get_fwinfo(struct shinkos6245_ctx *ctx)
|
||||
{
|
||||
struct s6245_fwinfo_cmd cmd;
|
||||
struct s6245_fwinfo_resp resp;
|
||||
struct sinfonia_fwinfo_cmd cmd;
|
||||
struct sinfonia_fwinfo_resp resp;
|
||||
int num = 0;
|
||||
int i;
|
||||
|
||||
|
@ -967,7 +928,7 @@ static int get_fwinfo(struct shinkos6245_ctx *ctx)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct s6245_fwinfo_resp) - sizeof(struct s6245_status_hdr)))
|
||||
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct sinfonia_fwinfo_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
continue;
|
||||
|
||||
INFO(" %s\t ver %02x.%02x\n", fwinfo_targets(i),
|
||||
|
@ -1005,7 +966,7 @@ static int get_errorlog(struct shinkos6245_ctx *ctx)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct s6245_errorlog_resp) - sizeof(struct s6245_status_hdr)))
|
||||
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct s6245_errorlog_resp) - sizeof(struct sinfonia_status_hdr)))
|
||||
return -2;
|
||||
|
||||
INFO("Stored Error ID %d:\n", i);
|
||||
|
@ -1039,8 +1000,8 @@ static void dump_mediainfo(struct s6245_mediainfo_resp *resp)
|
|||
|
||||
static int cancel_job(struct shinkos6245_ctx *ctx, char *str)
|
||||
{
|
||||
struct s6245_cancel_cmd cmd;
|
||||
struct s6245_status_hdr resp;
|
||||
struct sinfonia_cancel_cmd cmd;
|
||||
struct sinfonia_status_hdr resp;
|
||||
int ret, num = 0;
|
||||
|
||||
if (!str)
|
||||
|
@ -1064,8 +1025,8 @@ static int cancel_job(struct shinkos6245_ctx *ctx, char *str)
|
|||
|
||||
static int flash_led(struct shinkos6245_ctx *ctx)
|
||||
{
|
||||
struct s6245_cmd_hdr cmd;
|
||||
struct s6245_status_hdr resp;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct sinfonia_status_hdr resp;
|
||||
int ret, num = 0;
|
||||
|
||||
cmd.cmd = cpu_to_le16(S6245_CMD_FLASHLED);
|
||||
|
@ -1086,7 +1047,7 @@ static int flash_led(struct shinkos6245_ctx *ctx)
|
|||
static int set_param(struct shinkos6245_ctx *ctx, int target, uint32_t param)
|
||||
{
|
||||
struct s6245_setparam_cmd cmd;
|
||||
struct s6245_status_hdr resp;
|
||||
struct sinfonia_status_hdr resp;
|
||||
int ret, num = 0;
|
||||
|
||||
/* Set up command */
|
||||
|
@ -1109,7 +1070,7 @@ static int set_param(struct shinkos6245_ctx *ctx, int target, uint32_t param)
|
|||
static int reset_curve(struct shinkos6245_ctx *ctx, int target)
|
||||
{
|
||||
struct s6245_reset_cmd cmd;
|
||||
struct s6245_status_hdr resp;
|
||||
struct sinfonia_status_hdr resp;
|
||||
int ret, num = 0;
|
||||
|
||||
cmd.target = target;
|
||||
|
@ -1205,7 +1166,7 @@ done:
|
|||
static int set_tonecurve(struct shinkos6245_ctx *ctx, int target, char *fname)
|
||||
{
|
||||
struct s6245_update_cmd cmd;
|
||||
struct s6245_status_hdr resp;
|
||||
struct sinfonia_status_hdr resp;
|
||||
int ret, num = 0;
|
||||
|
||||
INFO("Set %s Tone Curve from '%s'\n", sinfonia_update_targets(target), fname);
|
||||
|
@ -1386,7 +1347,7 @@ static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
|
||||
/* Query Media */
|
||||
if (test_mode < TEST_MODE_NOATTACH) {
|
||||
struct s6245_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
cmd.cmd = cpu_to_le16(S6245_CMD_MEDIAINFO);
|
||||
cmd.len = cpu_to_le16(0);
|
||||
|
||||
|
@ -1483,10 +1444,10 @@ static int shinkos6245_main_loop(void *vctx, const void *vjob) {
|
|||
uint8_t mcut;
|
||||
int copies;
|
||||
|
||||
struct s6245_cmd_hdr *cmd = (struct s6245_cmd_hdr *) cmdbuf;;
|
||||
struct sinfonia_cmd_hdr *cmd = (struct sinfonia_cmd_hdr *) cmdbuf;;
|
||||
struct s6245_print_cmd *print = (struct s6245_print_cmd *) cmdbuf;
|
||||
struct s6245_status_resp sts, sts2;
|
||||
struct s6245_status_hdr resp;
|
||||
struct sinfonia_status_hdr resp;
|
||||
|
||||
struct sinfonia_printjob *job = (struct sinfonia_printjob*) vjob;
|
||||
|
||||
|
@ -1544,7 +1505,7 @@ static int shinkos6245_main_loop(void *vctx, const void *vjob) {
|
|||
|
||||
if ((ret = s6245_do_cmd(ctx,
|
||||
cmdbuf, sizeof(*settime),
|
||||
sizeof(struct s6245_status_hdr),
|
||||
sizeof(struct sinfonia_status_hdr),
|
||||
&num, (void*)&resp)) < 0) {
|
||||
ERROR("Failed to execute %s command\n", cmd_names(settime->hdr.cmd));
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -1696,7 +1657,7 @@ fail:
|
|||
|
||||
static int shinkos6245_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
|
||||
{
|
||||
struct s6245_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6245_getserial_resp resp;
|
||||
int ret, num = 0;
|
||||
|
||||
|
@ -1730,7 +1691,7 @@ static int shinkos6245_query_serno(struct libusb_device_handle *dev, uint8_t end
|
|||
static int shinkos6245_query_markers(void *vctx, struct marker **markers, int *count)
|
||||
{
|
||||
struct shinkos6245_ctx *ctx = vctx;
|
||||
struct s6245_cmd_hdr cmd;
|
||||
struct sinfonia_cmd_hdr cmd;
|
||||
struct s6245_status_resp status;
|
||||
int num;
|
||||
|
||||
|
|
Loading…
Reference in New Issue