all: Report up the low-level media ID as a PPD attribute.
(Needs changes to Gutenprint in order to be useful...)master
parent
3d59ad96bb
commit
9b3ae0ed5b
|
@ -95,10 +95,10 @@ struct printer_data {
|
|||
int8_t paper_code_offset; /* Offset in readback for paper type */
|
||||
int8_t paper_code_offset2; /* Offset in readback for paper type (2nd) */
|
||||
uint8_t (*error_detect)(uint8_t *rdbuf);
|
||||
char *(*pgcode_names)(uint8_t *rdbuf, struct printer_data *printer);
|
||||
char *(*pgcode_names)(uint8_t *rdbuf, struct printer_data *printer, int *numtype);
|
||||
};
|
||||
|
||||
static char *generic_pgcode_names(uint8_t *rdbuf, struct printer_data *printer)
|
||||
static char *generic_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype)
|
||||
{
|
||||
uint8_t pgcode = 0, pgcode2 = 0;
|
||||
|
||||
|
@ -107,6 +107,8 @@ static char *generic_pgcode_names(uint8_t *rdbuf, struct printer_data *printer)
|
|||
if (printer->paper_code_offset2 != -1)
|
||||
pgcode2 = rdbuf[printer->paper_code_offset2];
|
||||
|
||||
*numtype = pgcode & 0xf;
|
||||
|
||||
switch(pgcode & 0xf) {
|
||||
case 0x01: return "P";
|
||||
case 0x02: return "L";
|
||||
|
@ -237,11 +239,12 @@ static uint8_t cp790_error_detect(uint8_t *rdbuf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static char *cp10_pgcode_names(uint8_t *rdbuf, struct printer_data *printer)
|
||||
static char *cp10_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype)
|
||||
{
|
||||
UNUSED(rdbuf);
|
||||
UNUSED(printer);
|
||||
|
||||
*numtype = 3;
|
||||
return "C"; /* Printer only supports one media type */
|
||||
}
|
||||
|
||||
|
@ -580,7 +583,7 @@ static int canonselphy_get_status(struct canonselphy_ctx *ctx)
|
|||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
INFO("Media type: %s\n", ctx->printer->pgcode_names? ctx->printer->pgcode_names(rdbuf, ctx->printer) : "Unknown");
|
||||
INFO("Media type: %s\n", ctx->printer->pgcode_names? ctx->printer->pgcode_names(rdbuf, ctx->printer, &ret) : "Unknown");
|
||||
ctx->printer->error_detect(rdbuf);
|
||||
|
||||
return CUPS_BACKEND_OK;
|
||||
|
@ -665,11 +668,13 @@ static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
ctx->marker.levelnow = 0; /* Out of media */
|
||||
else
|
||||
ctx->marker.levelnow = -3; /* Unknown but OK */
|
||||
ctx->marker.name = ctx->printer->pgcode_names? ctx->printer->pgcode_names(rdbuf, ctx->printer) : "Unknown";
|
||||
|
||||
ctx->marker.name = ctx->printer->pgcode_names? ctx->printer->pgcode_names(rdbuf, ctx->printer, &ctx->marker.numtype) : "Unknown";
|
||||
} else {
|
||||
// XXX handle MEDIA_CODE at some point.
|
||||
// we don't do any error checking here.
|
||||
ctx->marker.name = "Unknown";
|
||||
ctx->marker.numtype = -1;
|
||||
}
|
||||
|
||||
return CUPS_BACKEND_OK;
|
||||
|
|
|
@ -233,6 +233,7 @@ static int selphyneo_attach(void *vctx, struct libusb_device_handle *dev, int ty
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = selphynew_pgcodes(rdback.data[6]);
|
||||
ctx->marker.numtype = rdback.data[6];
|
||||
ctx->marker.levelmax = -1;
|
||||
if (rdback.data[2]) {
|
||||
ctx->marker.levelnow = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "backend_common.h"
|
||||
#include <errno.h>
|
||||
|
||||
#define BACKEND_VERSION "0.95"
|
||||
#define BACKEND_VERSION "0.96"
|
||||
#ifndef URI_PREFIX
|
||||
#error "Must Define URI_PREFIX"
|
||||
#endif
|
||||
|
@ -1468,6 +1468,12 @@ minimal:
|
|||
}
|
||||
DEBUG2("\n");
|
||||
}
|
||||
|
||||
if (full) {
|
||||
for (i = 0 ; i < marker_count ; i++) {
|
||||
PPD("stpMediaID=%d\n", markers[i].numtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int dyesub_read_file(const char *filename, void *databuf, int datalen,
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#define INFO( ... ) do { if (!quiet) fprintf(stderr, "INFO: " __VA_ARGS__ ); } while(0)
|
||||
#define WARNING( ... ) do { fprintf(stderr, "WARNING: " __VA_ARGS__ ); } while(0)
|
||||
#define ERROR( ... ) do { fprintf(stderr, "ERROR: " __VA_ARGS__ ); sleep(1); } while (0)
|
||||
#define PPD( ... ) do { fprintf(stderr, "PPD: " __VA_ARGS__ ); sleep(1); } while (0)
|
||||
|
||||
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
#define le64_to_cpu(__x) __x
|
||||
|
@ -184,6 +185,7 @@ struct marker {
|
|||
const char *name; /* Eg "CK9015 (4x6)" */
|
||||
int levelmax; /* Max media count, eg '600', or '-1' */
|
||||
int levelnow; /* Remaining media, -3, -2, -1, 0..N. See CUPS. */
|
||||
int numtype; /* Numerical type, (-1 for unknown) */
|
||||
};
|
||||
|
||||
#define BACKEND_FLAG_JOBLIST 0x00000001
|
||||
|
|
|
@ -1230,6 +1230,7 @@ static int dnpds40_attach(void *vctx, struct libusb_device_handle *dev, int type
|
|||
/* Fill out marker structure */
|
||||
ctx->marker[0].color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker[0].name = dnpds40_media_types(ctx->media);
|
||||
ctx->marker[0].numtype = ctx->media;
|
||||
ctx->marker[0].levelmax = ctx->media_count_new;
|
||||
ctx->marker[0].levelnow = -2;
|
||||
ctx->marker_count = 1;
|
||||
|
@ -1237,6 +1238,7 @@ static int dnpds40_attach(void *vctx, struct libusb_device_handle *dev, int type
|
|||
if (ctx->type == P_DNP_DS80D) {
|
||||
ctx->marker[1].color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker[1].name = dnpds80_duplex_media_types(ctx->duplex_media);
|
||||
ctx->marker[1].numtype = ctx->duplex_media;
|
||||
ctx->marker[1].levelmax = ctx->marker[0].levelmax/2;
|
||||
ctx->marker[1].levelnow = -2;
|
||||
ctx->marker_count++;
|
||||
|
|
|
@ -683,6 +683,7 @@ static int hiti_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = hiti_ribbontypes(ctx->supplies[2]);
|
||||
ctx->marker.numtype = ctx->supplies[2];
|
||||
ctx->marker.levelmax = hiti_ribboncounts(ctx->supplies[2]);
|
||||
ctx->marker.levelnow = 0;
|
||||
|
||||
|
|
|
@ -309,6 +309,7 @@ static int kodak1400_attach(void *vctx, struct libusb_device_handle *dev, int ty
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = "Unknown";
|
||||
ctx->marker.numtype = -1;
|
||||
ctx->marker.levelmax = -1;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -404,6 +404,7 @@ static int kodak605_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = kodak6_mediatypes(ctx->media->type);
|
||||
ctx->marker.numtype = ctx->media->type;
|
||||
ctx->marker.levelmax = 100; /* Ie percentage */
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -749,6 +749,7 @@ static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev, int ty
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = kodak6_mediatypes(ctx->media_type);
|
||||
ctx->marker.numtype = ctx->media_type;
|
||||
ctx->marker.levelmax = 100; /* Ie percentage */
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -460,6 +460,7 @@ static int magicard_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00"; // XXX YMCK too!
|
||||
ctx->marker.name = "Unknown"; // LC1/LC3/LC6/LC8
|
||||
ctx->marker.numtype = -1;
|
||||
ctx->marker.levelmax = -1;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -819,6 +819,7 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
/* Set up markers */
|
||||
ctx->marker[0].color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker[0].name = mitsu70x_media_types(resp.lower.media_brand, resp.lower.media_type);
|
||||
ctx->marker[0].numtype = resp.lower.media_type;
|
||||
ctx->marker[0].levelmax = be16_to_cpu(resp.lower.capacity);
|
||||
ctx->marker[0].levelnow = be16_to_cpu(resp.lower.remain);
|
||||
ctx->medias[0] = resp.lower.media_type & 0xf;
|
||||
|
@ -826,6 +827,7 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
if (ctx->num_decks == 2) {
|
||||
ctx->marker[1].color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker[1].name = mitsu70x_media_types(resp.upper.media_brand, resp.upper.media_type);
|
||||
ctx->marker[1].numtype = resp.upper.media_type;
|
||||
ctx->marker[1].levelmax = be16_to_cpu(resp.upper.capacity);
|
||||
ctx->marker[1].levelnow = be16_to_cpu(resp.upper.remain);
|
||||
ctx->medias[1] = resp.upper.media_type & 0xf;
|
||||
|
|
|
@ -509,6 +509,7 @@ skip:
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = mitsu9550_media_types(media.type, ctx->is_s);
|
||||
ctx->marker.numtype = media.type;
|
||||
ctx->marker.levelmax = be16_to_cpu(media.max);
|
||||
ctx->marker.levelnow = be16_to_cpu(media.remain);
|
||||
|
||||
|
|
|
@ -543,6 +543,7 @@ static int mitsud90_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
}
|
||||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.numtype = resp.media.type;
|
||||
ctx->marker.name = mitsu70x_media_types(resp.media.brand, resp.media.type);
|
||||
ctx->marker.levelmax = be16_to_cpu(resp.media.capacity);
|
||||
ctx->marker.levelnow = be16_to_cpu(resp.media.remain);
|
||||
|
|
|
@ -154,6 +154,7 @@ static int mitsup95d_attach(void *vctx, struct libusb_device_handle *dev, int ty
|
|||
|
||||
ctx->marker.color = "#000000"; /* Ie black! */
|
||||
ctx->marker.name = "Unknown";
|
||||
ctx->marker.numtype = -1;
|
||||
ctx->marker.levelmax = -1;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -983,6 +983,7 @@ static int shinkos1245_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
}
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = ctx->media_8x12 ? "8x12" : "8x10";
|
||||
ctx->marker.numtype = ctx->media_8x12;
|
||||
ctx->marker.levelmax = ctx->media_8x12 ? 230 : 280;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -897,6 +897,7 @@ static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = sinfonia_print_codes(ctx->media_code, 0);
|
||||
ctx->marker.numtype = ctx->media_code;
|
||||
ctx->marker.levelmax = media_prints;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -1055,6 +1055,7 @@ static int shinkos6145_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = print_ribbons(ctx->media.ribbon_code);
|
||||
ctx->marker.numtype = ctx->media.ribbon_code;
|
||||
ctx->marker.levelmax = ribbon_sizes(ctx->media.ribbon_code);
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -1021,6 +1021,7 @@ static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, int
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.name = ribbon_sizes(ctx->media.ribbon_code);
|
||||
ctx->marker.numtype = ctx->media.ribbon_code;
|
||||
ctx->marker.levelmax = 100;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ static int upd_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
|||
}
|
||||
|
||||
ctx->marker.name = "Unknown";
|
||||
ctx->marker.numtype = -1;
|
||||
ctx->marker.levelmax = -1;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ struct updneo_printjob {
|
|||
uint8_t *databuf;
|
||||
int datalen;
|
||||
|
||||
int copies_offset;
|
||||
// int copies_offset; // XXX eventually implement
|
||||
int payload_offset;
|
||||
|
||||
int copies;
|
||||
|
@ -99,6 +99,7 @@ static int updneo_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
|||
}
|
||||
|
||||
ctx->marker.name = "Unknown";
|
||||
ctx->marker.numtype = -1;
|
||||
ctx->marker.levelmax = -1;
|
||||
ctx->marker.levelnow = -2;
|
||||
|
||||
|
|
Loading…
Reference in New Issue