sony: rename backend from 'sonyupr150' to 'sonyupd'

No functional change, as all old aliases remain!
This commit is contained in:
Solomon Peachy 2019-03-23 15:08:58 -04:00
parent f7ed113b86
commit 8ab1bcf2d3
5 changed files with 57 additions and 58 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
*.o *.o
*.so *.so
sonyupdr150 sonyupd
kodak6800 kodak6800
kodak605 kodak605
kodak1400 kodak1400

View File

@ -52,7 +52,7 @@ CPPFLAGS += -DURI_PREFIX=\"$(BACKEND_NAME)\" $(OLD_URI)
CFLAGS += -funit-at-a-time CFLAGS += -funit-at-a-time
# List of backends # List of backends
BACKENDS = sonyupdr150 kodak6800 kodak1400 shinkos2145 shinkos1245 canonselphy mitsu70x kodak605 dnpds40 mitsu9550 shinkos6245 shinkos6145 canonselphyneo mitsup95d magicard mitsud90 BACKENDS = sonyupd kodak6800 kodak1400 shinkos2145 shinkos1245 canonselphy mitsu70x kodak605 dnpds40 mitsu9550 shinkos6245 shinkos6145 canonselphyneo mitsup95d magicard mitsud90
# For the s6145 and mitsu70x backends # For the s6145 and mitsu70x backends
CPPFLAGS += -DUSE_DLOPEN CPPFLAGS += -DUSE_DLOPEN

10
README
View File

@ -685,12 +685,12 @@
[3] Default printer tone curve is a linear 'val << 3' [3] Default printer tone curve is a linear 'val << 3'
*************************************************************************** ***************************************************************************
BACKEND=sonyupdr150 BACKEND=sonyupd
Additional model IDs recognized: Additional model IDs recognized:
sony-updr150 sony-updr200 sony-upcr10l
sony-updr150 sony-updr200 sony-upcr10l sonyupdr200 sonyupcr10
sony-upd895 sony-upd897 sony-upd895 sony-upd897
sonyupdr150 sonyupdr200 sonyupcr10
Verified supported printers: Verified supported printers:
@ -710,9 +710,7 @@
Valid commands: Valid commands:
-s Query printer status [1] -s Query printer status
[1] Only works on the UP-D895 family
This backend does not support reporting marker levels. This backend does not support reporting marker levels.

View File

@ -666,7 +666,7 @@ abort:
return found; return found;
} }
extern struct dyesub_backend updr150_backend; extern struct dyesub_backend sonyupd_backend;
extern struct dyesub_backend kodak6800_backend; extern struct dyesub_backend kodak6800_backend;
extern struct dyesub_backend kodak605_backend; extern struct dyesub_backend kodak605_backend;
extern struct dyesub_backend kodak1400_backend; extern struct dyesub_backend kodak1400_backend;
@ -693,7 +693,7 @@ static struct dyesub_backend *backends[] = {
&shinkos2145_backend, &shinkos2145_backend,
&shinkos6145_backend, &shinkos6145_backend,
&shinkos6245_backend, &shinkos6245_backend,
&updr150_backend, &sonyupd_backend,
&mitsu70x_backend, &mitsu70x_backend,
&mitsud90_backend, &mitsud90_backend,
&mitsu9550_backend, &mitsu9550_backend,

View File

@ -1,7 +1,7 @@
/* /*
* Sony UP-DR150 Photo Printer CUPS backend -- libusb-1.0 version * Sony UP-D series Photo Printer CUPS backend -- libusb-1.0 version
* *
* (c) 2013-2018 Solomon Peachy <pizza@shaftnet.org> * (c) 2013-2019 Solomon Peachy <pizza@shaftnet.org>
* *
* The latest version of this program can be found at: * The latest version of this program can be found at:
* *
@ -37,7 +37,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#define BACKEND updr150_backend #define BACKEND sonyupd_backend
#include "backend_common.h" #include "backend_common.h"
@ -60,7 +60,7 @@ struct sony_updsts {
} __attribute__((packed)); } __attribute__((packed));
/* Private data structures */ /* Private data structures */
struct updr150_printjob { struct upd_printjob {
uint8_t *databuf; uint8_t *databuf;
int datalen; int datalen;
@ -70,7 +70,7 @@ struct updr150_printjob {
uint32_t imglen; uint32_t imglen;
}; };
struct updr150_ctx { struct upd_ctx {
struct libusb_device_handle *dev; struct libusb_device_handle *dev;
uint8_t endp_up; uint8_t endp_up;
uint8_t endp_down; uint8_t endp_down;
@ -84,21 +84,21 @@ struct updr150_ctx {
}; };
/* Now for the code */ /* Now for the code */
static void* updr150_init(void) static void* upd_init(void)
{ {
struct updr150_ctx *ctx = malloc(sizeof(struct updr150_ctx)); struct upd_ctx *ctx = malloc(sizeof(struct upd_ctx));
if (!ctx) { if (!ctx) {
ERROR("Memory Allocation Failure!"); ERROR("Memory Allocation Failure!");
return NULL; return NULL;
} }
memset(ctx, 0, sizeof(struct updr150_ctx)); memset(ctx, 0, sizeof(struct upd_ctx));
return ctx; return ctx;
} }
static int updr150_attach(void *vctx, struct libusb_device_handle *dev, int type, 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, uint8_t jobid)
{ {
struct updr150_ctx *ctx = vctx; struct upd_ctx *ctx = vctx;
UNUSED(jobid); UNUSED(jobid);
@ -122,9 +122,9 @@ static int updr150_attach(void *vctx, struct libusb_device_handle *dev, int type
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
static void updr150_cleanup_job(const void *vjob) static void upd_cleanup_job(const void *vjob)
{ {
const struct updr150_printjob *job = vjob; const struct upd_printjob *job = vjob;
if (job->databuf) if (job->databuf)
free(job->databuf); free(job->databuf);
@ -132,8 +132,8 @@ static void updr150_cleanup_job(const void *vjob)
free((void*)job); free((void*)job);
} }
static void updr150_teardown(void *vctx) { static void upd_teardown(void *vctx) {
struct updr150_ctx *ctx = vctx; struct upd_ctx *ctx = vctx;
if (!ctx) if (!ctx)
return; return;
@ -157,7 +157,7 @@ static char* upd895_statuses(uint8_t code)
} }
} }
static int sony_get_status(struct updr150_ctx *ctx, struct sony_updsts *buf) static int sony_get_status(struct upd_ctx *ctx, struct sony_updsts *buf)
{ {
int ret, num = 0; int ret, num = 0;
uint8_t query[7] = { 0x1b, 0xe0, 0, 0, 0, 0x0f, 0 }; uint8_t query[7] = { 0x1b, 0xe0, 0, 0, 0, 0x0f, 0 };
@ -189,14 +189,14 @@ static int sony_get_status(struct updr150_ctx *ctx, struct sony_updsts *buf)
#define MAX_PRINTJOB_LEN (2048*2764*3 + 2048) #define MAX_PRINTJOB_LEN (2048*2764*3 + 2048)
static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int copies) { static int upd_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct updr150_ctx *ctx = vctx; struct upd_ctx *ctx = vctx;
int len, run = 1; int len, run = 1;
uint32_t copies_offset = 0; uint32_t copies_offset = 0;
uint32_t param_offset = 0; uint32_t param_offset = 0;
uint32_t data_offset = 0; uint32_t data_offset = 0;
struct updr150_printjob *job = NULL; struct upd_printjob *job = NULL;
if (!ctx) if (!ctx)
return CUPS_BACKEND_FAILED; return CUPS_BACKEND_FAILED;
@ -213,7 +213,7 @@ static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int co
job->databuf = malloc(MAX_PRINTJOB_LEN); job->databuf = malloc(MAX_PRINTJOB_LEN);
if (!job->databuf) { if (!job->databuf) {
ERROR("Memory allocation failure!\n"); ERROR("Memory allocation failure!\n");
updr150_cleanup_job(job); upd_cleanup_job(job);
return CUPS_BACKEND_RETRY_CURRENT; return CUPS_BACKEND_RETRY_CURRENT;
} }
@ -222,7 +222,7 @@ static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int co
int keep = 0; int keep = 0;
i = read(data_fd, job->databuf + job->datalen, 4); i = read(data_fd, job->databuf + job->datalen, 4);
if (i < 0) { if (i < 0) {
updr150_cleanup_job(job); upd_cleanup_job(job);
return CUPS_BACKEND_CANCEL; return CUPS_BACKEND_CANCEL;
} }
if (i == 0) if (i == 0)
@ -304,7 +304,7 @@ static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int co
while(len > 0) { while(len > 0) {
i = read(data_fd, job->databuf + job->datalen, len); i = read(data_fd, job->databuf + job->datalen, len);
if (i < 0) { if (i < 0) {
updr150_cleanup_job(job); upd_cleanup_job(job);
return CUPS_BACKEND_CANCEL; return CUPS_BACKEND_CANCEL;
} }
if (i == 0) if (i == 0)
@ -340,7 +340,7 @@ static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int co
} }
} }
if (!job->datalen) { if (!job->datalen) {
updr150_cleanup_job(job); upd_cleanup_job(job);
return CUPS_BACKEND_CANCEL; return CUPS_BACKEND_CANCEL;
} }
@ -377,12 +377,12 @@ static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int co
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
static int updr150_main_loop(void *vctx, const void *vjob) { static int upd_main_loop(void *vctx, const void *vjob) {
struct updr150_ctx *ctx = vctx; struct upd_ctx *ctx = vctx;
int i, ret; int i, ret;
int copies; int copies;
const struct updr150_printjob *job = vjob; const struct upd_printjob *job = vjob;
if (!ctx) if (!ctx)
return CUPS_BACKEND_FAILED; return CUPS_BACKEND_FAILED;
@ -501,7 +501,7 @@ done:
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
static int upd895_dump_status(struct updr150_ctx *ctx) static int upd895_dump_status(struct upd_ctx *ctx)
{ {
int ret = sony_get_status(ctx, &ctx->stsbuf); int ret = sony_get_status(ctx, &ctx->stsbuf);
if (ret < 0) if (ret < 0)
@ -515,14 +515,14 @@ static int upd895_dump_status(struct updr150_ctx *ctx)
} }
static void updr150_cmdline(void) static void upd_cmdline(void)
{ {
DEBUG("\t\t[ -s ] # Query printer status (only UP-D895)\n"); DEBUG("\t\t[ -s ] # Query printer status\n");
} }
static int updr150_cmdline_arg(void *vctx, int argc, char **argv) static int upd_cmdline_arg(void *vctx, int argc, char **argv)
{ {
struct updr150_ctx *ctx = vctx; struct upd_ctx *ctx = vctx;
int i, j = 0; int i, j = 0;
if (!ctx) if (!ctx)
@ -542,9 +542,9 @@ static int updr150_cmdline_arg(void *vctx, int argc, char **argv)
return 0; return 0;
} }
static int updr150_query_markers(void *vctx, struct marker **markers, int *count) static int upd_query_markers(void *vctx, struct marker **markers, int *count)
{ {
struct updr150_ctx *ctx = vctx; struct upd_ctx *ctx = vctx;
int ret = sony_get_status(ctx, &ctx->stsbuf); int ret = sony_get_status(ctx, &ctx->stsbuf);
*markers = &ctx->marker; *markers = &ctx->marker;
@ -565,12 +565,13 @@ static int updr150_query_markers(void *vctx, struct marker **markers, int *count
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
static const char *sonyupdr150_prefixes[] = { static const char *sonyupd_prefixes[] = {
"sonyupdr150", // Family name. "sonyupd",
"sony-updr150", "sony-updr200", "sony-upcr10l", "sony-updr150", "sony-updr200", "sony-upcr10l",
// Backwards compatibility
"sonyupdr200", "sonyupcr10",
"sony-upd895", "sony-upd897", "sony-upd895", "sony-upd897",
// Backwards compatibility
"sonyupdr150",
"sonyupdr200", "sonyupcr10",
// "sony-upd898", // "sony-upd898",
NULL NULL
}; };
@ -584,19 +585,19 @@ static const char *sonyupdr150_prefixes[] = {
#define USB_PID_SONY_UPD897 0x01E7 #define USB_PID_SONY_UPD897 0x01E7
//#define USB_PID_SONY_UPD898 XXXXX // 0x589a? //#define USB_PID_SONY_UPD898 XXXXX // 0x589a?
struct dyesub_backend updr150_backend = { struct dyesub_backend sonyupd_backend = {
.name = "Sony UP-DR150/UP-DR200/UP-CR10/UP-D895/UP-D897", .name = "Sony UP-D",
.version = "0.35", .version = "0.35",
.uri_prefixes = sonyupdr150_prefixes, .uri_prefixes = sonyupd_prefixes,
.cmdline_arg = updr150_cmdline_arg, .cmdline_arg = upd_cmdline_arg,
.cmdline_usage = updr150_cmdline, .cmdline_usage = upd_cmdline,
.init = updr150_init, .init = upd_init,
.attach = updr150_attach, .attach = upd_attach,
.teardown = updr150_teardown, .teardown = upd_teardown,
.cleanup_job = updr150_cleanup_job, .cleanup_job = upd_cleanup_job,
.read_parse = updr150_read_parse, .read_parse = upd_read_parse,
.main_loop = updr150_main_loop, .main_loop = upd_main_loop,
.query_markers = updr150_query_markers, .query_markers = upd_query_markers,
.devices = { .devices = {
{ USB_VID_SONY, USB_PID_SONY_UPDR150, P_SONY_UPDR150, NULL, "sony-updr150"}, { USB_VID_SONY, USB_PID_SONY_UPDR150, P_SONY_UPDR150, NULL, "sony-updr150"},
{ USB_VID_SONY, USB_PID_SONY_UPDR200, P_SONY_UPDR150, NULL, "sony-updr200"}, { USB_VID_SONY, USB_PID_SONY_UPDR200, P_SONY_UPDR150, NULL, "sony-updr200"},