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
*.so
sonyupdr150
sonyupd
kodak6800
kodak605
kodak1400

View File

@ -52,7 +52,7 @@ CPPFLAGS += -DURI_PREFIX=\"$(BACKEND_NAME)\" $(OLD_URI)
CFLAGS += -funit-at-a-time
# 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
CPPFLAGS += -DUSE_DLOPEN

10
README
View File

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

View File

@ -666,7 +666,7 @@ abort:
return found;
}
extern struct dyesub_backend updr150_backend;
extern struct dyesub_backend sonyupd_backend;
extern struct dyesub_backend kodak6800_backend;
extern struct dyesub_backend kodak605_backend;
extern struct dyesub_backend kodak1400_backend;
@ -693,7 +693,7 @@ static struct dyesub_backend *backends[] = {
&shinkos2145_backend,
&shinkos6145_backend,
&shinkos6245_backend,
&updr150_backend,
&sonyupd_backend,
&mitsu70x_backend,
&mitsud90_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:
*
@ -37,7 +37,7 @@
#include <fcntl.h>
#include <signal.h>
#define BACKEND updr150_backend
#define BACKEND sonyupd_backend
#include "backend_common.h"
@ -60,7 +60,7 @@ struct sony_updsts {
} __attribute__((packed));
/* Private data structures */
struct updr150_printjob {
struct upd_printjob {
uint8_t *databuf;
int datalen;
@ -70,7 +70,7 @@ struct updr150_printjob {
uint32_t imglen;
};
struct updr150_ctx {
struct upd_ctx {
struct libusb_device_handle *dev;
uint8_t endp_up;
uint8_t endp_down;
@ -84,21 +84,21 @@ struct updr150_ctx {
};
/* 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) {
ERROR("Memory Allocation Failure!");
return NULL;
}
memset(ctx, 0, sizeof(struct updr150_ctx));
memset(ctx, 0, sizeof(struct upd_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)
{
struct updr150_ctx *ctx = vctx;
struct upd_ctx *ctx = vctx;
UNUSED(jobid);
@ -122,9 +122,9 @@ static int updr150_attach(void *vctx, struct libusb_device_handle *dev, int type
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)
free(job->databuf);
@ -132,8 +132,8 @@ static void updr150_cleanup_job(const void *vjob)
free((void*)job);
}
static void updr150_teardown(void *vctx) {
struct updr150_ctx *ctx = vctx;
static void upd_teardown(void *vctx) {
struct upd_ctx *ctx = vctx;
if (!ctx)
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;
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)
static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct updr150_ctx *ctx = vctx;
static int upd_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct upd_ctx *ctx = vctx;
int len, run = 1;
uint32_t copies_offset = 0;
uint32_t param_offset = 0;
uint32_t data_offset = 0;
struct updr150_printjob *job = NULL;
struct upd_printjob *job = NULL;
if (!ctx)
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);
if (!job->databuf) {
ERROR("Memory allocation failure!\n");
updr150_cleanup_job(job);
upd_cleanup_job(job);
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;
i = read(data_fd, job->databuf + job->datalen, 4);
if (i < 0) {
updr150_cleanup_job(job);
upd_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}
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) {
i = read(data_fd, job->databuf + job->datalen, len);
if (i < 0) {
updr150_cleanup_job(job);
upd_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}
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) {
updr150_cleanup_job(job);
upd_cleanup_job(job);
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;
}
static int updr150_main_loop(void *vctx, const void *vjob) {
struct updr150_ctx *ctx = vctx;
static int upd_main_loop(void *vctx, const void *vjob) {
struct upd_ctx *ctx = vctx;
int i, ret;
int copies;
const struct updr150_printjob *job = vjob;
const struct upd_printjob *job = vjob;
if (!ctx)
return CUPS_BACKEND_FAILED;
@ -501,7 +501,7 @@ done:
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);
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;
if (!ctx)
@ -542,9 +542,9 @@ static int updr150_cmdline_arg(void *vctx, int argc, char **argv)
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);
*markers = &ctx->marker;
@ -565,12 +565,13 @@ static int updr150_query_markers(void *vctx, struct marker **markers, int *count
return CUPS_BACKEND_OK;
}
static const char *sonyupdr150_prefixes[] = {
"sonyupdr150", // Family name.
static const char *sonyupd_prefixes[] = {
"sonyupd",
"sony-updr150", "sony-updr200", "sony-upcr10l",
// Backwards compatibility
"sonyupdr200", "sonyupcr10",
"sony-upd895", "sony-upd897",
// Backwards compatibility
"sonyupdr150",
"sonyupdr200", "sonyupcr10",
// "sony-upd898",
NULL
};
@ -584,19 +585,19 @@ static const char *sonyupdr150_prefixes[] = {
#define USB_PID_SONY_UPD897 0x01E7
//#define USB_PID_SONY_UPD898 XXXXX // 0x589a?
struct dyesub_backend updr150_backend = {
.name = "Sony UP-DR150/UP-DR200/UP-CR10/UP-D895/UP-D897",
struct dyesub_backend sonyupd_backend = {
.name = "Sony UP-D",
.version = "0.35",
.uri_prefixes = sonyupdr150_prefixes,
.cmdline_arg = updr150_cmdline_arg,
.cmdline_usage = updr150_cmdline,
.init = updr150_init,
.attach = updr150_attach,
.teardown = updr150_teardown,
.cleanup_job = updr150_cleanup_job,
.read_parse = updr150_read_parse,
.main_loop = updr150_main_loop,
.query_markers = updr150_query_markers,
.uri_prefixes = sonyupd_prefixes,
.cmdline_arg = upd_cmdline_arg,
.cmdline_usage = upd_cmdline,
.init = upd_init,
.attach = upd_attach,
.teardown = upd_teardown,
.cleanup_job = upd_cleanup_job,
.read_parse = upd_read_parse,
.main_loop = upd_main_loop,
.query_markers = upd_query_markers,
.devices = {
{ 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"},