sinfonia: Several updates:

* Identify (and log) some additonal command types
 * Figured out backprinting command on EK701x
 * EK70xx supports panel button disabling
This commit is contained in:
Solomon Peachy 2019-09-18 19:54:56 -04:00
parent ed6267b893
commit 2960be2b02
6 changed files with 109 additions and 48 deletions

3
README
View File

@ -470,6 +470,7 @@
Valid commands:
-b [ 0 | 1 ] Disable or Enable the printer control panel
-c filename Query User tone curve from flash [1]
-C filename Store User tone curve in flash [1]
-e Query error log
@ -521,7 +522,7 @@
Valid commands:
-b [ 0 | 1 ] Disable or Enable the printer control panel.
-b [ 0 | 1 ] Disable or Enable the printer control panel
-c filename Query User tone curve from flash [1]
-C filename Store User tone curve in flash [1]
-e Query Error log

View File

@ -626,6 +626,7 @@ static void kodak605_dump_mediainfo(struct kodak605_media_list *media)
static void kodak605_cmdline(void)
{
DEBUG("\t\t[ -b 0|1 ] # Disable/Enable control panel\n");
DEBUG("\t\t[ -c filename ] # Get user/NV tone curve\n");
DEBUG("\t\t[ -C filename ] # Set tone curve\n");
DEBUG("\t\t[ -e ] # Query error log\n");
@ -648,9 +649,17 @@ static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
if (!ctx)
return -1;
while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "c:C:eFil:L:mrRsX:")) >= 0) {
while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "b:c:C:eFil:L:mrRsX:")) >= 0) {
switch(i) {
GETOPT_PROCESS_GLOBAL
case 'b':
if (optarg[0] == '1')
j = sinfonia_button_set(&ctx->dev, BUTTON_ENABLED);
else if (optarg[0] == '0')
j = sinfonia_button_set(&ctx->dev, BUTTON_DISABLED);
else
return -1;
break;
case 'c':
j = sinfonia_gettonecurve(&ctx->dev, TONECURVE_USER, optarg);
break;
@ -728,7 +737,7 @@ static const char *kodak605_prefixes[] = {
/* Exported */
struct dyesub_backend kodak605_backend = {
.name = "Kodak 605/70xx",
.version = "0.47" " (lib " LIBSINFONIA_VER ")",
.version = "0.48" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = kodak605_prefixes,
.cmdline_usage = kodak605_cmdline,
.cmdline_arg = kodak605_cmdline_arg,

View File

@ -115,14 +115,6 @@ struct s2145_readtone_cmd {
uint8_t curveid;
} __attribute__((packed));
struct s2145_button_cmd {
struct sinfonia_cmd_hdr hdr;
uint8_t enabled;
} __attribute__((packed));
#define BUTTON_ENABLED 0x01
#define BUTTON_DISABLED 0x00
#define FWINFO_TARGET_MAIN_BOOT 0x01
#define FWINFO_TARGET_MAIN_APP 0x02
#define FWINFO_TARGET_DSP_BOOT 0x03
@ -605,26 +597,6 @@ static int reset_curve(struct shinkos2145_ctx *ctx, int target)
return 0;
}
static int button_set(struct shinkos2145_ctx *ctx, int enable)
{
struct s2145_button_cmd cmd;
struct sinfonia_status_hdr resp;
int ret, num = 0;
cmd.hdr.cmd = cpu_to_le16(SINFONIA_CMD_BUTTON);
cmd.hdr.len = cpu_to_le16(1);
cmd.enabled = enable;
if ((ret = sinfonia_docmd(&ctx->dev,
(uint8_t*)&cmd, sizeof(cmd),
(uint8_t*)&cmd, sizeof(resp),
&num)) < 0) {
return ret;
}
return 0;
}
static int get_tonecurve(struct shinkos2145_ctx *ctx, int type, char *fname)
{
@ -796,9 +768,9 @@ int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv)
GETOPT_PROCESS_GLOBAL
case 'b':
if (optarg[0] == '1')
j = button_set(ctx, BUTTON_ENABLED);
j = sinfonia_button_set(&ctx->dev, BUTTON_ENABLED);
else if (optarg[0] == '0')
j = button_set(ctx, BUTTON_DISABLED);
j = sinfonia_button_set(&ctx->dev, BUTTON_DISABLED);
else
return -1;
break;
@ -1207,7 +1179,7 @@ static const char *shinkos2145_prefixes[] = {
struct dyesub_backend shinkos2145_backend = {
.name = "Shinko/Sinfonia CHC-S2145/S2",
.version = "0.61" " (lib " LIBSINFONIA_VER ")",
.version = "0.62" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = shinkos2145_prefixes,
.cmdline_usage = shinkos2145_cmdline,
.cmdline_arg = shinkos2145_cmdline_arg,

View File

@ -1192,7 +1192,7 @@ static int shinkos6145_read_parse(void *vctx, const void **vjob, int data_fd, in
When bit 0 is set, this tells the backend that the data is
already in planar YMC format (vs packed RGB) so we don't need
to do the conversion ourselves. Saves some processing overhead */
input_ymc = job->jp.ext_flags & 0x01;
input_ymc = job->jp.ext_flags & EXT_FLAG_PLANARYMC;
/* Convert packed RGB to planar YMC if necessary */
if (!input_ymc) {

View File

@ -625,6 +625,27 @@ done:
return ret;
}
int sinfonia_button_set(struct sinfonia_usbdev *dev, int enable)
{
struct sinfonia_button_cmd cmd;
struct sinfonia_status_hdr resp;
int ret, num = 0;
cmd.hdr.cmd = cpu_to_le16(SINFONIA_CMD_BUTTON);
cmd.hdr.len = cpu_to_le16(1);
cmd.enabled = enable;
if ((ret = sinfonia_docmd(dev,
(uint8_t*)&cmd, sizeof(cmd),
(uint8_t*)&cmd, sizeof(resp),
&num)) < 0) {
return ret;
}
return 0;
}
int sinfonia_settonecurve(struct sinfonia_usbdev *usbh, int target, char *fname)
{
struct sinfonia_update_cmd cmd;
@ -997,11 +1018,13 @@ const char *sinfonia_cmd_names(uint16_t v) {
case SINFONIA_CMD_GETPARAM:
return "Get Parameter";
case SINFONIA_CMD_GETSERIAL:
case SINFONIA_CMD_GETSERIAL2:
return "Get Serial Number";
case SINFONIA_CMD_PRINTSTAT:
return "Get Print ID Status";
case SINFONIA_CMD_EXTCOUNTER:
return "Get Extended Counters";
case SINFONIA_CMD_MEMORYBANK:
return "Get Memory Bank Info";
case SINFONIA_CMD_PRINTJOB:
return "Print";
case SINFONIA_CMD_CANCELJOB:
@ -1016,24 +1039,48 @@ const char *sinfonia_cmd_names(uint16_t v) {
return "Button Enable";
case SINFONIA_CMD_SETPARAM:
return "Set Parameter";
case SINFONIA_CMD_GETUNIQUE:
return "Get Unique String";
// case SINFONIA_CMD_UNKNOWN48:
// return "UKNOWN 4008"; // XXX
case SINFONIA_CMD_SETLAMSTR:
return "Set Lamination String";
case SINFONIA_CMD_COMMPPA:
return "Communication PPA";
case SINFONIA_CMD_SETPPAPARM:
return "Set PPA Parameter";
case SINFONIA_CMD_BACKPRINT:
return "Set Backprint String";
case SINFONIA_CMD_UNKNOWN4C:
return "UKNOWN 400C"; // XXX
case SINFONIA_CMD_GETCORR:
return "Get Image Correction Parameter";
case SINFONIA_CMD_GETEEPROM:
case SINFONIA_CMD_GETEEPROM2:
return "Get EEPROM Backup Parameter";
case SINFONIA_CMD_SETEEPROM:
case SINFONIA_CMD_SETEEPROM2:
return "Set EEPROM Backup Parameter";
case SINFONIA_CMD_SETTIME:
return "Time Setting";
case SINFONIA_CMD_DIAGNOSTIC:
return "Diagnostic";
case SINFONIA_CMD_UNIVERSAL:
return "Unicersal Command";
case SINFONIA_CMD_USBFWDL:
return "USB Firmware Download";
case SINFONIA_CMD_MAINTPERM:
return "Maintenance Permission";
case SINFONIA_CMD_GETUNIQUE:
return "Get Unique String";
case SINFONIA_CMD_SELFDIAG:
return "Execute Self-Diagnostic";
case SINFONIA_CMD_FWINFO:
return "Get Firmware Info";
case SINFONIA_CMD_UPDATE:
return "Update";
case SINFONIA_CMD_SETUNIQUE:
return "Set Unique String";
case SINFONIA_CMD_RESETERR:
return "Reset Error Log";
default:
return "Unknown Command";
}

View File

@ -27,7 +27,7 @@
*
*/
#define LIBSINFONIA_VER "0.09"
#define LIBSINFONIA_VER "0.10"
#define SINFONIA_HDR1_LEN 0x10
#define SINFONIA_HDR2_LEN 0x64
@ -50,6 +50,8 @@ struct sinfonia_job_param {
uint32_t ext_flags;
};
#define EXT_FLAG_PLANARYMC 0x01
#define EXT_FLAG_BACKPRINT 0x02
struct sinfonia_printjob {
struct sinfonia_job_param jp;
@ -89,6 +91,7 @@ int sinfonia_geterrorlog(struct sinfonia_usbdev *usbh);
int sinfonia_resetcurve(struct sinfonia_usbdev *usbh, int target, int id);
int sinfonia_gettonecurve(struct sinfonia_usbdev *usbh, int type, char *fname);
int sinfonia_settonecurve(struct sinfonia_usbdev *usbh, int target, char *fname);
int sinfonia_button_set(struct sinfonia_usbdev *dev, int enable);
int sinfonia_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len);
@ -101,6 +104,7 @@ const char *sinfonia_bank_statuses(uint8_t v);
#define UPDATE_TARGET_USER 0x03
#define UPDATE_TARGET_CURRENT 0x04
// XXX 0x10, 0x11 , lens 0x22e3e0 and 0x447c68/. LAMINATE patterns?
/* Update is three channels, Y, M, C;
each is 256 entries of 11-bit data padded to 16-bits.
@ -271,6 +275,14 @@ struct sinfonia_getprintidstatus_resp {
#define IDSTATUS_COMPLETED 0x0200
#define IDSTATUS_ERROR 0xFFFF
struct sinfonia_button_cmd {
struct sinfonia_cmd_hdr hdr;
uint8_t enabled;
} __attribute__((packed));
#define BUTTON_ENABLED 0x01
#define BUTTON_DISABLED 0x00
struct sinfonia_reset_cmd {
struct sinfonia_cmd_hdr hdr;
uint8_t target;
@ -361,6 +373,14 @@ struct sinfonia_printcmd28_hdr {
uint8_t reserved2[11];
} __attribute__((packed));
struct kodak701x_backprint {
struct sinfonia_cmd_hdr hdr;
uint8_t unk_0; // unknown. maybe the line number?
uint8_t null[6]; // always zero.
uint8_t unk_1; // length of text? (max 40)
uint8_t text[42]; //
} __attribute__((packed));
#define CODE_4x6 0x00
#define CODE_3_5x5 0x01
#define CODE_5x7 0x03
@ -433,25 +453,37 @@ const char *sinfonia_status_str(uint8_t v);
#define SINFONIA_CMD_FLASHLED 0x4003
#define SINFONIA_CMD_RESET 0x4004
#define SINFONIA_CMD_READTONE 0x4005
#define SINFONIA_CMD_BUTTON 0x4006 // 2145
#define SINFONIA_CMD_BUTTON 0x4006 // 2145?
#define SINFONIA_CMD_SETPARAM 0x4007 // !2145
#define SINFONIA_CMD_UNKNOWN 0x4008 // EK8810, panorama status?
#define SINFONIA_CMD_UNKNOWN2 0x400C // EK8810, panorama setup?
#define SINFONIA_CMD_UNKNOWN48 0x4008 // EK8810, panorama status? (len 28)
#define SINFONIA_CMD_SETLAMSTR 0x4008 // EK70xx
#define SINFONIA_CMD_COMMPPA 0x4009 // EK70xx
#define SINFONIA_CMD_SETPPAPARM 0x400A // EK70xx
#define SINFONIA_CMD_BACKPRINT 0x400B // EK701x only! (len 50)
#define SINFONIA_CMD_UNKNOWN4C 0x400C // EK8810, panorama setup?
#define SINFONIA_CMD_GETCORR 0x400D // 6145/2245
#define SINFONIA_CMD_GETEEPROM 0x400E // 6x45
#define SINFONIA_CMD_SETEEPROM 0x400F // 6x45
#define SINFONIA_CMD_SETTIME 0x4011 // 6245
#define SINFONIA_CMD_UNIVERSAL 0x4080 // EK70xx
#define SINFONIA_CMD_USBFWDL 0x8001 // EK70xx (len 5)
#define SINFONIA_CMD_MAINTPERM 0x8002 // EK70xx
#define SINFONIA_CMD_GETUNIQUE 0x8003 // 2145
#define SINFONIA_CMD_DIAGNOSTIC 0xC001 // ??
#define SINFONIA_CMD_SELFDIAG 0xC001
#define SINFONIA_CMD_DIAGRES 0xC002
#define SINFONIA_CMD_FWINFO 0xC003
#define SINFONIA_CMD_UPDATE 0xC004
#define SINFONIA_CMD_GETEEPROM2 0xC005 // EK70xx
#define SINFONIA_CMD_SETEEPROM2 0xC006 // EK70xx
#define SINFONIA_CMD_SETUNIQUE 0xC007 // 2145
#define SINFONIA_CMD_RESETERR 0xC008
#define SINFONIA_CMD_GETSERIAL2 0xC009 // EK70xx (len 8)
const char *sinfonia_cmd_names(uint16_t v);