summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend_common.h1
-rw-r--r--backend_sonyupdr150.c55
2 files changed, 48 insertions, 8 deletions
diff --git a/backend_common.h b/backend_common.h
index 0c1833a..35f3cad 100644
--- a/backend_common.h
+++ b/backend_common.h
@@ -99,6 +99,7 @@ enum {
P_KODAK_605,
P_SHINKO_S2145,
P_SONY_UPDR150,
+ P_SONY_UPCR10,
P_MITSU_D70X,
P_DNP_DS40,
P_DNP_DS80,
diff --git a/backend_sonyupdr150.c b/backend_sonyupdr150.c
index f309263..c24ce7d 100644
--- a/backend_sonyupdr150.c
+++ b/backend_sonyupdr150.c
@@ -37,6 +37,12 @@
#include "backend_common.h"
+/* Exported */
+#define USB_VID_SONY 0x054C
+#define USB_PID_SONY_UPDR150 0x01E8
+#define USB_PID_SONY_UPDR200 0x035F
+#define USB_PID_SONY_UPCR10 1234
+
/* Private data stucture */
struct updr150_ctx {
struct libusb_device_handle *dev;
@@ -45,6 +51,9 @@ struct updr150_ctx {
uint8_t *databuf;
int datalen;
+
+ uint32_t copies_offset;
+ uint8_t type;
};
static void* updr150_init(void)
@@ -60,12 +69,24 @@ static void updr150_attach(void *vctx, struct libusb_device_handle *dev,
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);
+ if (desc.idProduct == USB_PID_SONY_UPDR150 ||
+ desc.idProduct == USB_PID_SONY_UPDR200)
+ ctx->type = P_SONY_UPDR150;
+ else
+ ctx->type = P_SONY_UPCR10; // XXX
+
+ ctx->copies_offset = 0;
}
static void updr150_teardown(void *vctx) {
@@ -123,6 +144,8 @@ static int updr150_read_parse(void *vctx, int data_fd) {
case 0xffffffec:
case 0xffffffeb:
case 0xfffffffa:
+ case 0xffffff60:
+ case 0xffffffff:
if(dyesub_debug)
DEBUG("Block ID '%08x' (len %d)\n", len, 0);
len = 0;
@@ -131,7 +154,15 @@ static int updr150_read_parse(void *vctx, int data_fd) {
if(dyesub_debug)
DEBUG("Block ID '%08x' (len %d)\n", len, 0);
len = 0;
- run = 0;
+ if (ctx->type == P_SONY_UPCR10)
+ run = 0;
+ break;
+ case 0xfffffff7:
+ if(dyesub_debug)
+ DEBUG("Block ID '%08x' (len %d)\n", len, 0);
+ len = 0;
+ if (ctx->type == P_SONY_UPDR150)
+ run = 0;
break;
case 0xffffffef:
case 0xfffffff5:
@@ -161,6 +192,12 @@ static int updr150_read_parse(void *vctx, int data_fd) {
return i;
if (i == 0)
break;
+
+ if (ctx->type == P_SONY_UPCR10 &&
+ ctx->databuf[ctx->datalen + 1] == 0xee) {
+ ctx->copies_offset = ctx->datalen + 8;
+ }
+
if (keep)
ctx->datalen += i;
len -= i;
@@ -179,6 +216,12 @@ static int updr150_main_loop(void *vctx, int copies) {
if (!ctx)
return 1;
+ /* Some models specify copies in the print job */
+ if (ctx->copies_offset) {
+ ctx->databuf[ctx->copies_offset] = copies;
+ copies = 1;
+ }
+
top:
while (i < ctx->datalen) {
uint32_t len;
@@ -209,14 +252,9 @@ top:
return 0;
}
-/* Exported */
-#define USB_VID_SONY 0x054C
-#define USB_PID_SONY_UPDR150 0x01E8
-#define USB_PID_SONY_UPDR200 0x035F
-
struct dyesub_backend updr150_backend = {
- .name = "Sony UP-DR150/UP-DR200",
- .version = "0.13",
+ .name = "Sony UP-DR150/UP-DR200/UP-CR10",
+ .version = "0.14",
.uri_prefix = "sonyupdr150",
.init = updr150_init,
.attach = updr150_attach,
@@ -226,6 +264,7 @@ struct dyesub_backend updr150_backend = {
.devices = {
{ USB_VID_SONY, USB_PID_SONY_UPDR150, P_SONY_UPDR150, ""},
{ USB_VID_SONY, USB_PID_SONY_UPDR200, P_SONY_UPDR150, ""},
+ { USB_VID_SONY, USB_PID_SONY_UPCR10, P_SONY_UPCR10, ""},
{ 0, 0, 0, ""}
}
};