all: push printer type lookup into common code.
This commit is contained in:
parent
189b1099d3
commit
390c5e2bf6
|
@ -623,12 +623,10 @@ static void *canonselphy_init(void)
|
|||
|
||||
extern struct dyesub_backend canonselphy_backend;
|
||||
|
||||
static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct canonselphy_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
int i, num;
|
||||
uint8_t rdbuf[READBACK_LEN];
|
||||
|
||||
|
@ -637,16 +635,12 @@ static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
ctx->type = type;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
if (desc.idProduct == USB_PID_CANON_CP900)
|
||||
if (ctx->type == P_CP900) {
|
||||
ctx->type = P_CP_XXX;
|
||||
ctx->cp900 = 1;
|
||||
|
||||
ctx->type = lookup_printer_type(&canonselphy_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
|
||||
}
|
||||
for (i = 0 ; selphy_printers[i].type != -1; i++) {
|
||||
if (selphy_printers[i].type == ctx->type) {
|
||||
ctx->printer = &selphy_printers[i];
|
||||
|
@ -1143,7 +1137,7 @@ static const char *canonselphy_prefixes[] = {
|
|||
|
||||
struct dyesub_backend canonselphy_backend = {
|
||||
.name = "Canon SELPHY CP/ES (legacy)",
|
||||
.version = "0.100",
|
||||
.version = "0.101",
|
||||
.uri_prefixes = canonselphy_prefixes,
|
||||
.cmdline_usage = canonselphy_cmdline,
|
||||
.cmdline_arg = canonselphy_cmdline_arg,
|
||||
|
|
|
@ -66,6 +66,7 @@ struct selphyneo_ctx {
|
|||
struct libusb_device_handle *dev;
|
||||
uint8_t endp_up;
|
||||
uint8_t endp_down;
|
||||
int type;
|
||||
|
||||
uint8_t *databuf;
|
||||
uint32_t datalen;
|
||||
|
@ -191,7 +192,7 @@ static void *selphyneo_init(void)
|
|||
|
||||
extern struct dyesub_backend selphyneo_backend;
|
||||
|
||||
static int selphyneo_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int selphyneo_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct selphyneo_ctx *ctx = vctx;
|
||||
|
@ -205,6 +206,7 @@ static int selphyneo_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
ctx->type = type;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
@ -494,7 +496,7 @@ static const char *canonselphyneo_prefixes[] = {
|
|||
|
||||
struct dyesub_backend canonselphyneo_backend = {
|
||||
.name = "Canon SELPHY CP (new)",
|
||||
.version = "0.16",
|
||||
.version = "0.17",
|
||||
.uri_prefixes = canonselphyneo_prefixes,
|
||||
.cmdline_usage = selphyneo_cmdline,
|
||||
.cmdline_arg = selphyneo_cmdline_arg,
|
||||
|
|
|
@ -76,6 +76,30 @@ static int backend_claim_interface(struct libusb_device_handle *dev, int iface,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int lookup_printer_type(struct dyesub_backend *backend, uint16_t idVendor, uint16_t idProduct)
|
||||
{
|
||||
int i;
|
||||
int type = P_UNKNOWN;
|
||||
|
||||
for (i = 0 ; backend->devices[i].vid ; i++) {
|
||||
if (extra_pid != -1 &&
|
||||
extra_vid != -1 &&
|
||||
extra_type != -1) {
|
||||
if (backend->devices[i].type == extra_type &&
|
||||
extra_vid == idVendor &&
|
||||
extra_pid == idProduct) {
|
||||
return extra_type;
|
||||
}
|
||||
}
|
||||
if (idVendor == backend->devices[i].vid &&
|
||||
idProduct == backend->devices[i].pid) {
|
||||
return backend->devices[i].type;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/* Interface **MUST** already be claimed! */
|
||||
#define ID_BUF_SIZE 2048
|
||||
static char *get_device_id(struct libusb_device_handle *dev, int iface)
|
||||
|
@ -922,6 +946,7 @@ int main (int argc, char **argv)
|
|||
char *type;
|
||||
char *fname = NULL;
|
||||
char *use_serno = NULL;
|
||||
int printer_type;
|
||||
|
||||
DEBUG("Multi-Call Dye-sublimation CUPS Backend version %s\n",
|
||||
BACKEND_VERSION);
|
||||
|
@ -1102,8 +1127,29 @@ int main (int argc, char **argv)
|
|||
backend->name, backend->version);
|
||||
backend_ctx = backend->init();
|
||||
|
||||
{
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
printer_type = lookup_printer_type(backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
if (printer_type <= P_UNKNOWN) {
|
||||
ERROR("Unable to lookup printer type\n");
|
||||
ret = CUPS_BACKEND_FAILED;
|
||||
goto done_close;
|
||||
}
|
||||
|
||||
}
|
||||
/* Attach backend to device */
|
||||
backend->attach(backend_ctx, dev, endp_up, endp_down, jobid);
|
||||
if (backend->attach(backend_ctx, dev, printer_type, endp_up, endp_down, jobid)) {
|
||||
ERROR("Unable to attach to printer!");
|
||||
ret = CUPS_BACKEND_FAILED;
|
||||
goto done_close;
|
||||
}
|
||||
|
||||
// STATE("+org.gutenprint-attached-to-device\n");
|
||||
|
||||
if (!uri) {
|
||||
|
@ -1222,30 +1268,6 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lookup_printer_type(struct dyesub_backend *backend, uint16_t idVendor, uint16_t idProduct)
|
||||
{
|
||||
int i;
|
||||
int type = -1;
|
||||
|
||||
for (i = 0 ; backend->devices[i].vid ; i++) {
|
||||
if (extra_pid != -1 &&
|
||||
extra_vid != -1 &&
|
||||
extra_type != -1) {
|
||||
if (backend->devices[i].type == extra_type &&
|
||||
extra_vid == idVendor &&
|
||||
extra_pid == idProduct) {
|
||||
return extra_type;
|
||||
}
|
||||
}
|
||||
if (idVendor == backend->devices[i].vid &&
|
||||
idProduct == backend->devices[i].pid) {
|
||||
return backend->devices[i].type;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
void dump_markers(struct marker *markers, int marker_count, int full)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
/* To enumerate supported devices */
|
||||
enum {
|
||||
P_ANY = 0,
|
||||
P_UNKNOWN = 0,
|
||||
P_ES1,
|
||||
P_ES2_20,
|
||||
P_ES3_30,
|
||||
|
@ -97,6 +97,7 @@ enum {
|
|||
P_CP790,
|
||||
P_CP_XXX,
|
||||
P_CP10,
|
||||
P_CP900,
|
||||
P_CP910,
|
||||
P_KODAK_6800,
|
||||
P_KODAK_6850,
|
||||
|
@ -156,7 +157,7 @@ struct dyesub_backend {
|
|||
const char **uri_prefixes;
|
||||
void (*cmdline_usage)(void); /* Optional */
|
||||
void *(*init)(void);
|
||||
int (*attach)(void *ctx, struct libusb_device_handle *dev,
|
||||
int (*attach)(void *ctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid);
|
||||
void (*teardown)(void *ctx);
|
||||
int (*cmdline_arg)(void *ctx, int argc, char **argv);
|
||||
|
@ -172,7 +173,6 @@ int send_data(struct libusb_device_handle *dev, uint8_t endp,
|
|||
uint8_t *buf, int len);
|
||||
int read_data(struct libusb_device_handle *dev, uint8_t endp,
|
||||
uint8_t *buf, int buflen, int *readlen);
|
||||
int lookup_printer_type(struct dyesub_backend *backend, uint16_t idVendor, uint16_t idProduct);
|
||||
|
||||
void dump_markers(struct marker *markers, int marker_count, int full);
|
||||
|
||||
|
|
|
@ -541,8 +541,6 @@ static void *dnpds40_init(void)
|
|||
}
|
||||
memset(ctx, 0, sizeof(struct dnpds40_ctx));
|
||||
|
||||
ctx->type = P_ANY;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
@ -579,24 +577,17 @@ static int dnpds40_query_mqty(struct dnpds40_ctx *ctx)
|
|||
return count;
|
||||
}
|
||||
|
||||
static int dnpds40_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int dnpds40_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct dnpds40_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
UNUSED(jobid);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&dnpds40_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
{
|
||||
struct dnpds40_cmd cmd;
|
||||
|
@ -817,7 +808,7 @@ static int dnpds40_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->supports_gamma = 1;
|
||||
break;
|
||||
default:
|
||||
ERROR("Unknown vid/pid %04x/%04x (%d)\n", desc.idVendor, desc.idProduct, ctx->type);
|
||||
ERROR("Unknown printer type %d\n", ctx->type);
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
|
||||
|
@ -2742,7 +2733,7 @@ static const char *dnpds40_prefixes[] = {
|
|||
/* Exported */
|
||||
struct dyesub_backend dnpds40_backend = {
|
||||
.name = "DNP DS-series / Citizen C-series",
|
||||
.version = "0.101",
|
||||
.version = "0.102",
|
||||
.uri_prefixes = dnpds40_prefixes,
|
||||
.cmdline_usage = dnpds40_cmdline,
|
||||
.cmdline_arg = dnpds40_cmdline_arg,
|
||||
|
|
|
@ -296,24 +296,17 @@ static void *kodak1400_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int kodak1400_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int kodak1400_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct kodak1400_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
UNUSED(jobid);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&kodak1400_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = "Unknown";
|
||||
|
@ -642,7 +635,7 @@ static const char *kodak1400_prefixes[] = {
|
|||
|
||||
struct dyesub_backend kodak1400_backend = {
|
||||
.name = "Kodak 1400/805",
|
||||
.version = "0.36",
|
||||
.version = "0.37",
|
||||
.uri_prefixes = kodak1400_prefixes,
|
||||
.cmdline_usage = kodak1400_cmdline,
|
||||
.cmdline_arg = kodak1400_cmdline_arg,
|
||||
|
|
|
@ -263,27 +263,18 @@ static void *kodak605_init(void)
|
|||
|
||||
ctx->media = malloc(MAX_MEDIA_LEN);
|
||||
|
||||
ctx->type = P_ANY;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static int kodak605_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int kodak605_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct kodak605_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&kodak605_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
/* Make sure jobid is sane */
|
||||
ctx->jobid = jobid & 0x7f;
|
||||
|
@ -695,7 +686,7 @@ static const char *kodak605_prefixes[] = {
|
|||
/* Exported */
|
||||
struct dyesub_backend kodak605_backend = {
|
||||
.name = "Kodak 605",
|
||||
.version = "0.29",
|
||||
.version = "0.30",
|
||||
.uri_prefixes = kodak605_prefixes,
|
||||
.cmdline_usage = kodak605_cmdline,
|
||||
.cmdline_arg = kodak605_cmdline_arg,
|
||||
|
|
|
@ -1005,27 +1005,18 @@ static void *kodak6800_init(void)
|
|||
|
||||
ctx->media = malloc(MAX_MEDIA_LEN);
|
||||
|
||||
ctx->type = P_ANY;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct kodak6800_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&kodak6800_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
/* Ensure jobid is sane */
|
||||
ctx->jobid = jobid & 0x7f;
|
||||
|
@ -1279,7 +1270,7 @@ static const char *kodak6800_prefixes[] = {
|
|||
/* Exported */
|
||||
struct dyesub_backend kodak6800_backend = {
|
||||
.name = "Kodak 6800/6850",
|
||||
.version = "0.61",
|
||||
.version = "0.62",
|
||||
.uri_prefixes = kodak6800_prefixes,
|
||||
.cmdline_usage = kodak6800_cmdline,
|
||||
.cmdline_arg = kodak6800_cmdline_arg,
|
||||
|
|
|
@ -114,7 +114,7 @@ struct magicard_ctx {
|
|||
struct libusb_device_handle *dev;
|
||||
uint8_t endp_up;
|
||||
uint8_t endp_down;
|
||||
uint8_t type;
|
||||
int type;
|
||||
|
||||
uint8_t x_gp_8bpp;
|
||||
uint8_t x_gp_rk;
|
||||
|
@ -453,24 +453,17 @@ static void* magicard_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int magicard_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int magicard_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct magicard_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
UNUSED(jobid);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&magicard_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00"; // XXX YMCK too!
|
||||
ctx->marker.name = "Unknown"; // LC1/LC3/LC6/LC8
|
||||
|
@ -915,7 +908,7 @@ static const char *magicard_prefixes[] = {
|
|||
|
||||
struct dyesub_backend magicard_backend = {
|
||||
.name = "Magicard family",
|
||||
.version = "0.12",
|
||||
.version = "0.13",
|
||||
.uri_prefixes = magicard_prefixes,
|
||||
.cmdline_arg = magicard_cmdline_arg,
|
||||
.cmdline_usage = magicard_cmdline,
|
||||
|
|
|
@ -690,12 +690,10 @@ static void *mitsu70x_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct mitsu70x_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
ctx->jobid = jobid;
|
||||
if (!ctx->jobid)
|
||||
|
@ -704,12 +702,7 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&mitsu70x_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
ctx->last_l = ctx->last_u = 65535;
|
||||
|
||||
|
@ -2024,7 +2017,7 @@ static const char *mitsu70x_prefixes[] = {
|
|||
/* Exported */
|
||||
struct dyesub_backend mitsu70x_backend = {
|
||||
.name = "Mitsubishi CP-D70 family",
|
||||
.version = "0.78",
|
||||
.version = "0.79",
|
||||
.uri_prefixes = mitsu70x_prefixes,
|
||||
.cmdline_usage = mitsu70x_cmdline,
|
||||
.cmdline_arg = mitsu70x_cmdline_arg,
|
||||
|
|
|
@ -526,12 +526,10 @@ static void *mitsu9550_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int mitsu9550_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int mitsu9550_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct mitsu9550_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
struct mitsu9550_media media;
|
||||
|
||||
UNUSED(jobid);
|
||||
|
@ -539,12 +537,7 @@ static int mitsu9550_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&mitsu9550_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
if (ctx->type == P_MITSU_9550S ||
|
||||
ctx->type == P_MITSU_9800S)
|
||||
|
@ -1638,7 +1631,7 @@ static const char *mitsu9550_prefixes[] = {
|
|||
/* Exported */
|
||||
struct dyesub_backend mitsu9550_backend = {
|
||||
.name = "Mitsubishi CP9xxx family",
|
||||
.version = "0.36",
|
||||
.version = "0.37",
|
||||
.uri_prefixes = mitsu9550_prefixes,
|
||||
.cmdline_usage = mitsu9550_cmdline,
|
||||
.cmdline_arg = mitsu9550_cmdline_arg,
|
||||
|
|
|
@ -139,24 +139,17 @@ static int mitsup95d_get_status(struct mitsup95d_ctx *ctx, uint8_t *resp)
|
|||
return CUPS_BACKEND_OK;
|
||||
}
|
||||
|
||||
static int mitsup95d_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int mitsup95d_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct mitsup95d_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
UNUSED(jobid);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&mitsup95d_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
ctx->marker.color = "#000000"; /* Ie black! */
|
||||
ctx->marker.name = "Unknown";
|
||||
|
@ -570,7 +563,7 @@ static const char *mitsup95d_prefixes[] = {
|
|||
/* Exported */
|
||||
struct dyesub_backend mitsup95d_backend = {
|
||||
.name = "Mitsubishi P93D/P95D",
|
||||
.version = "0.08",
|
||||
.version = "0.09",
|
||||
.uri_prefixes = mitsup95d_prefixes,
|
||||
.cmdline_arg = mitsup95d_cmdline_arg,
|
||||
.cmdline_usage = mitsup95d_cmdline,
|
||||
|
|
|
@ -1276,22 +1276,15 @@ static void *shinkos1245_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int shinkos1245_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int shinkos1245_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct shinkos1245_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&shinkos1245_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
/* Ensure jobid is sane */
|
||||
ctx->jobid = jobid & 0x7f;
|
||||
|
@ -1661,7 +1654,7 @@ static const char *shinkos1245_prefixes[] = {
|
|||
|
||||
struct dyesub_backend shinkos1245_backend = {
|
||||
.name = "Shinko/Sinfonia CHC-S1245/E1",
|
||||
.version = "0.21",
|
||||
.version = "0.22",
|
||||
.uri_prefixes = shinkos1245_prefixes,
|
||||
.cmdline_usage = shinkos1245_cmdline,
|
||||
.cmdline_arg = shinkos1245_cmdline_arg,
|
||||
|
|
|
@ -793,6 +793,8 @@ struct shinkos2145_ctx {
|
|||
|
||||
uint8_t jobid;
|
||||
|
||||
int type;
|
||||
|
||||
struct s2145_printjob_hdr hdr;
|
||||
|
||||
uint8_t *databuf;
|
||||
|
@ -1383,7 +1385,7 @@ static void *shinkos2145_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct shinkos2145_ctx *ctx = vctx;
|
||||
|
@ -1392,6 +1394,7 @@ static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
ctx->type = type;
|
||||
|
||||
/* Ensure jobid is sane */
|
||||
ctx->jobid = (jobid & 0x7f);
|
||||
|
@ -1770,7 +1773,7 @@ static const char *shinkos2145_prefixes[] = {
|
|||
|
||||
struct dyesub_backend shinkos2145_backend = {
|
||||
.name = "Shinko/Sinfonia CHC-S2145/S2",
|
||||
.version = "0.51",
|
||||
.version = "0.52",
|
||||
.uri_prefixes = shinkos2145_prefixes,
|
||||
.cmdline_usage = shinkos2145_cmdline,
|
||||
.cmdline_arg = shinkos2145_cmdline_arg,
|
||||
|
|
|
@ -1234,7 +1234,7 @@ static int get_status(struct shinkos6145_ctx *ctx)
|
|||
INFO("Head Distance: %08u inches\n", le32_to_cpu(resp2->head_distance));
|
||||
|
||||
/* Query various params */
|
||||
if(ctx->type == P_SHINKO_S6145D) {
|
||||
if (ctx->type == P_SHINKO_S6145D) {
|
||||
if ((ret = get_param(ctx, PARAM_REGION_CODE, &val))) {
|
||||
ERROR("Failed to execute command\n");
|
||||
return ret;
|
||||
|
@ -1891,22 +1891,15 @@ static void *shinkos6145_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct shinkos6145_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&shinkos6145_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
/* Attempt to open the library */
|
||||
#if defined(WITH_DYNAMIC)
|
||||
|
@ -2507,7 +2500,7 @@ static const char *shinkos6145_prefixes[] = {
|
|||
|
||||
struct dyesub_backend shinkos6145_backend = {
|
||||
.name = "Shinko/Sinfonia CHC-S6145/CS2",
|
||||
.version = "0.25",
|
||||
.version = "0.26",
|
||||
.uri_prefixes = shinkos6145_prefixes,
|
||||
.cmdline_usage = shinkos6145_cmdline,
|
||||
.cmdline_arg = shinkos6145_cmdline_arg,
|
||||
|
|
|
@ -1466,12 +1466,10 @@ static void *shinkos6245_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct shinkos6245_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
struct s6245_cmd_hdr cmd;
|
||||
|
||||
int num;
|
||||
|
@ -1479,12 +1477,7 @@ static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&shinkos6245_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
/* Ensure jobid is sane */
|
||||
ctx->jobid = jobid & 0x7f;
|
||||
|
@ -1889,7 +1882,7 @@ static const char *shinkos6245_prefixes[] = {
|
|||
|
||||
struct dyesub_backend shinkos6245_backend = {
|
||||
.name = "Shinko/Sinfonia CHC-S6245",
|
||||
.version = "0.10WIP",
|
||||
.version = "0.11WIP",
|
||||
.uri_prefixes = shinkos6245_prefixes,
|
||||
.cmdline_usage = shinkos6245_cmdline,
|
||||
.cmdline_arg = shinkos6245_cmdline_arg,
|
||||
|
|
|
@ -73,24 +73,17 @@ static void* updr150_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static int updr150_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static int updr150_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct updr150_ctx *ctx = vctx;
|
||||
struct libusb_device *device;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
UNUSED(jobid);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
ctx->type = lookup_printer_type(&updr150_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
ctx->type = type;
|
||||
|
||||
ctx->copies_offset = 0;
|
||||
|
||||
|
@ -303,7 +296,7 @@ static const char *sonyupdr150_prefixes[] = {
|
|||
|
||||
struct dyesub_backend updr150_backend = {
|
||||
.name = "Sony UP-DR150/UP-DR200/UP-CR10",
|
||||
.version = "0.22",
|
||||
.version = "0.23",
|
||||
.uri_prefixes = sonyupdr150_prefixes,
|
||||
.cmdline_arg = updr150_cmdline_arg,
|
||||
.init = updr150_init,
|
||||
|
|
Loading…
Reference in a new issue