all: Pass the USB bInterfaceNum into the backend attach() function.
parent
475749a881
commit
1fe3a6066b
|
@ -611,13 +611,14 @@ static void *canonselphy_init(void)
|
|||
extern struct dyesub_backend canonselphy_backend;
|
||||
|
||||
static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct canonselphy_ctx *ctx = vctx;
|
||||
int i, num;
|
||||
uint8_t rdbuf[READBACK_LEN];
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -187,13 +187,14 @@ static void *selphyneo_init(void)
|
|||
extern struct dyesub_backend selphyneo_backend;
|
||||
|
||||
static int selphyneo_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct selphyneo_ctx *ctx = vctx;
|
||||
struct selphyneo_readback rdback;
|
||||
int ret, num;
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -1239,7 +1239,7 @@ bypass:
|
|||
}
|
||||
|
||||
/* Attach backend to device */
|
||||
if (backend->attach(backend_ctx, dev, printer_type, endp_up, endp_down, jobid)) {
|
||||
if (backend->attach(backend_ctx, dev, printer_type, endp_up, endp_down, iface, jobid)) {
|
||||
ERROR("Unable to attach to printer!\n");
|
||||
ret = CUPS_BACKEND_FAILED;
|
||||
goto done_close;
|
||||
|
|
|
@ -209,7 +209,7 @@ struct dyesub_backend {
|
|||
void (*cmdline_usage)(void); /* Optional */
|
||||
void *(*init)(void);
|
||||
int (*attach)(void *ctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid);
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid);
|
||||
void (*teardown)(void *ctx);
|
||||
int (*cmdline_arg)(void *ctx, int argc, char **argv);
|
||||
int (*read_parse)(void *ctx, const void **job, int data_fd, int copies);
|
||||
|
|
|
@ -66,6 +66,7 @@ struct dnpds40_ctx {
|
|||
struct libusb_device_handle *dev;
|
||||
uint8_t endp_up;
|
||||
uint8_t endp_down;
|
||||
int iface;
|
||||
|
||||
int type;
|
||||
|
||||
|
@ -776,7 +777,7 @@ static int dnpds80dx_query_paper(struct dnpds40_ctx *ctx)
|
|||
}
|
||||
|
||||
static int dnpds40_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct dnpds40_ctx *ctx = vctx;
|
||||
|
||||
|
@ -786,6 +787,7 @@ static int dnpds40_attach(void *vctx, struct libusb_device_handle *dev, int type
|
|||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
ctx->type = type;
|
||||
ctx->iface = iface;
|
||||
|
||||
if (test_mode < TEST_MODE_NOATTACH) {
|
||||
struct dnpds40_cmd cmd;
|
||||
|
|
|
@ -859,11 +859,13 @@ static void *hiti_init(void)
|
|||
extern struct dyesub_backend hiti_backend;
|
||||
|
||||
static int hiti_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct hiti_ctx *ctx = vctx;
|
||||
int ret;
|
||||
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
|
|
@ -286,11 +286,12 @@ static void *kodak1400_init(void)
|
|||
}
|
||||
|
||||
static int kodak1400_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct kodak1400_ctx *ctx = vctx;
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -358,7 +358,7 @@ static void *kodak605_init(void)
|
|||
}
|
||||
|
||||
static int kodak605_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct kodak605_ctx *ctx = vctx;
|
||||
|
||||
|
@ -366,6 +366,7 @@ static int kodak605_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
ctx->dev.endp_up = endp_up;
|
||||
ctx->dev.endp_down = endp_down;
|
||||
ctx->dev.type = type;
|
||||
ctx->dev.iface = iface;
|
||||
ctx->dev.error_codes = &error_codes;
|
||||
|
||||
if (ctx->dev.type != P_KODAK_605) {
|
||||
|
|
|
@ -678,10 +678,12 @@ static void *kodak6800_init(void)
|
|||
}
|
||||
|
||||
static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct kodak6800_ctx *ctx = vctx;
|
||||
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
|
|
@ -437,11 +437,12 @@ static void* magicard_init(void)
|
|||
}
|
||||
|
||||
static int magicard_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct magicard_ctx *ctx = vctx;
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -695,10 +695,12 @@ static void *mitsu70x_init(void)
|
|||
}
|
||||
|
||||
static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct mitsu70x_ctx *ctx = vctx;
|
||||
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->jobid = jobid;
|
||||
if (!ctx->jobid)
|
||||
jobid++;
|
||||
|
|
|
@ -424,12 +424,13 @@ static void *mitsu9550_init(void)
|
|||
}
|
||||
|
||||
static int mitsu9550_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct mitsu9550_ctx *ctx = vctx;
|
||||
struct mitsu9550_media media;
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -513,12 +513,13 @@ static void *mitsud90_init(void)
|
|||
}
|
||||
|
||||
static int mitsud90_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct mitsud90_ctx *ctx = vctx;
|
||||
struct mitsud90_media_resp resp;
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -131,11 +131,12 @@ static int mitsup95d_get_status(struct mitsup95d_ctx *ctx, uint8_t *resp)
|
|||
}
|
||||
|
||||
static int mitsup95d_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct mitsup95d_ctx *ctx = vctx;
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -941,10 +941,12 @@ static void *shinkos1245_init(void)
|
|||
}
|
||||
|
||||
static int shinkos1245_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct shinkos1245_ctx *ctx = vctx;
|
||||
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
|
|
|
@ -831,7 +831,7 @@ static void *shinkos2145_init(void)
|
|||
}
|
||||
|
||||
static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct shinkos2145_ctx *ctx = vctx;
|
||||
|
||||
|
@ -839,6 +839,7 @@ static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
ctx->dev.endp_up = endp_up;
|
||||
ctx->dev.endp_down = endp_down;
|
||||
ctx->dev.type = type;
|
||||
ctx->dev.iface = iface;
|
||||
ctx->dev.error_codes = &error_codes;
|
||||
|
||||
/* Ensure jobid is sane */
|
||||
|
|
|
@ -986,7 +986,7 @@ static void *shinkos6145_init(void)
|
|||
}
|
||||
|
||||
static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct shinkos6145_ctx *ctx = vctx;
|
||||
|
||||
|
@ -994,6 +994,7 @@ static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
ctx->dev.endp_up = endp_up;
|
||||
ctx->dev.endp_down = endp_down;
|
||||
ctx->dev.type = type;
|
||||
ctx->dev.iface = iface;
|
||||
ctx->dev.error_codes = &error_codes;
|
||||
|
||||
if (type == P_SHINKO_S6145 ||
|
||||
|
|
|
@ -972,7 +972,7 @@ static void *shinkos6245_init(void)
|
|||
}
|
||||
|
||||
static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct shinkos6245_ctx *ctx = vctx;
|
||||
|
||||
|
@ -980,6 +980,7 @@ static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
ctx->dev.endp_up = endp_up;
|
||||
ctx->dev.endp_down = endp_down;
|
||||
ctx->dev.type = type;
|
||||
ctx->dev.iface = iface;
|
||||
|
||||
if (type == P_KODAK_8810) {
|
||||
ctx->dev.error_codes = &ek8810_error_codes;
|
||||
|
|
|
@ -83,6 +83,7 @@ struct sinfonia_usbdev {
|
|||
uint8_t endp_up;
|
||||
uint8_t endp_down;
|
||||
int type;
|
||||
int iface;
|
||||
|
||||
const struct sinfonia_param *params;
|
||||
int params_count;
|
||||
|
|
|
@ -99,11 +99,12 @@ static void* upd_init(void)
|
|||
}
|
||||
|
||||
static int upd_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct upd_ctx *ctx = vctx;
|
||||
|
||||
UNUSED(jobid);
|
||||
UNUSED(iface);
|
||||
|
||||
ctx->dev = dev;
|
||||
ctx->endp_up = endp_up;
|
||||
|
|
|
@ -52,6 +52,7 @@ struct updneo_ctx {
|
|||
struct libusb_device_handle *dev;
|
||||
uint8_t endp_up;
|
||||
uint8_t endp_down;
|
||||
int iface;
|
||||
int type;
|
||||
|
||||
int native_bpp;
|
||||
|
@ -72,7 +73,7 @@ static void* updneo_init(void)
|
|||
}
|
||||
|
||||
static int updneo_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
|
||||
{
|
||||
struct updneo_ctx *ctx = vctx;
|
||||
|
||||
|
@ -82,6 +83,7 @@ static int updneo_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
|||
ctx->endp_up = endp_up;
|
||||
ctx->endp_down = endp_down;
|
||||
ctx->type = type;
|
||||
ctx->iface = iface;
|
||||
|
||||
if (ctx->type == P_SONY_UPD898) {
|
||||
ctx->marker.color = "#000000"; /* Ie black! */
|
||||
|
@ -268,8 +270,7 @@ static struct deviceid_dict dict[MAX_DICT];
|
|||
|
||||
static int updneo_get_status(struct updneo_ctx *ctx)
|
||||
{
|
||||
uint8_t iface = 0; // XXX need to extract this. FML.
|
||||
char *ieee_id = get_device_id(ctx->dev, iface);
|
||||
char *ieee_id = get_device_id(ctx->dev, ctx->iface);
|
||||
|
||||
if (!ieee_id)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
|
Loading…
Reference in New Issue