2015-07-02 23:32:16 -04:00
|
|
|
/*
|
|
|
|
* Shinko/Sinfonia CHC-S6245 CUPS backend -- libusb-1.0 version
|
|
|
|
*
|
2020-01-22 11:25:06 -05:00
|
|
|
* (c) 2015-2020 Solomon Peachy <pizza@shaftnet.org>
|
2015-07-02 23:32:16 -04:00
|
|
|
*
|
|
|
|
* Low-level documentation was provided by Sinfonia, Inc. Thank you!
|
|
|
|
*
|
|
|
|
* The latest version of this program can be found at:
|
|
|
|
*
|
|
|
|
* http://git.shaftnet.org/cgit/selphy_print.git
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
|
|
* Software Foundation; either version 3 of the License, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-01-17 16:50:56 -05:00
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2015-07-02 23:32:16 -04:00
|
|
|
*
|
2017-11-17 13:34:26 -05:00
|
|
|
* SPDX-License-Identifier: GPL-3.0+
|
|
|
|
*
|
2015-07-02 23:32:16 -04:00
|
|
|
*/
|
|
|
|
|
2015-08-13 21:09:56 -04:00
|
|
|
#define BACKEND shinkos6245_backend
|
|
|
|
|
2015-07-02 23:32:16 -04:00
|
|
|
#include "backend_common.h"
|
2019-05-13 10:29:00 -04:00
|
|
|
#include "backend_sinfonia.h"
|
2015-07-02 23:32:16 -04:00
|
|
|
|
2019-09-28 11:05:42 -04:00
|
|
|
#include <time.h>
|
|
|
|
|
2015-07-02 23:32:16 -04:00
|
|
|
enum {
|
|
|
|
S_IDLE = 0,
|
|
|
|
S_PRINTER_READY_CMD,
|
|
|
|
S_PRINTER_SENT_DATA,
|
|
|
|
S_FINISHED,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Structs for printer */
|
|
|
|
struct s6245_print_cmd {
|
2019-05-12 23:41:04 -04:00
|
|
|
struct sinfonia_cmd_hdr hdr;
|
2015-07-02 23:32:16 -04:00
|
|
|
uint8_t id;
|
|
|
|
uint16_t count;
|
|
|
|
uint16_t columns;
|
|
|
|
uint16_t rows;
|
2019-08-15 15:21:42 -04:00
|
|
|
uint16_t columns2; /* These are necessary for EK8810 */
|
|
|
|
uint16_t rows2; /* */
|
2019-08-13 08:48:07 -04:00
|
|
|
uint8_t reserved[4];
|
2015-07-02 23:32:16 -04:00
|
|
|
uint8_t mode;
|
|
|
|
uint8_t method;
|
2017-07-10 20:15:56 -04:00
|
|
|
uint8_t reserved2;
|
2015-07-02 23:32:16 -04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
2019-09-21 23:03:05 -04:00
|
|
|
static const struct sinfonia_param ek8810_params[] =
|
|
|
|
{
|
|
|
|
{ 0x01, "Unknown_01" }, // 00000001
|
|
|
|
{ 0x11, "Unknown_11" }, // 00000001
|
|
|
|
{ 0x12, "? Matte Gloss" }, // 00000069
|
|
|
|
{ 0x13, "? Matte Degloss Black" }, // 000000c3
|
|
|
|
{ 0x14, "? Matte Degloss White" }, // 000000cd
|
|
|
|
{ 0x21, "Unknown_21" }, // 000003e8
|
|
|
|
{ 0x22, "Unknown_22" }, // 0000041a
|
|
|
|
{ 0x23, "Unknown_23" }, // 00000152
|
|
|
|
{ 0x24, "Unknown_24" }, // 0000044c
|
|
|
|
{ 0x25, "Unknown_25" }, // 0000044c
|
|
|
|
|
|
|
|
{ 0x2f, "Unknown_2f" }, // 00000320
|
|
|
|
{ 0x41, "Unknown_41" }, // 0000005d
|
|
|
|
{ 0x42, "Unknown_42" }, // 00000048
|
|
|
|
{ 0x43, "Unknown_43" }, // 0000007c
|
|
|
|
{ 0x44, "Unknown_44" }, // 00000088
|
|
|
|
{ 0x45, "Unknown_45" }, // 00000000
|
|
|
|
{ 0x46, "Unknown_46" }, // 00000002
|
|
|
|
{ 0x47, "Unknown_47" }, // 00000063
|
|
|
|
{ 0x48, "Unknown_48" }, // 00000008
|
|
|
|
{ 0x61, "Unknown_61" }, // 00000050
|
|
|
|
|
|
|
|
{ 0x62, "Unknown_62" }, // 00000031
|
|
|
|
{ 0x63, "Unknown_63" }, // 00000030
|
|
|
|
{ 0x64, "Unknown_64" }, // 00000030
|
|
|
|
{ 0x81, "Unknown_81" }, // ffffffff
|
|
|
|
{ 0x82, "Unknown_82" }, // fffffff9
|
|
|
|
{ 0x83, "Unknown_83" }, // fffffffc
|
|
|
|
{ 0x84, "Unknown_84" }, // 00000002
|
|
|
|
{ 0x8a, "Unknown_8a" }, // 00000005
|
|
|
|
{ 0x8b, "Unknown_8b" }, // 00000005
|
|
|
|
{ 0x8c, "Unknown_8c" }, // 00000000
|
|
|
|
|
|
|
|
{ 0x8d, "Unknown_8d" }, // 00000000
|
|
|
|
{ 0x91, "Unknown_91" }, // 0000007e
|
|
|
|
{ 0x92, "Unknown_92" }, // 0000007d
|
|
|
|
{ 0x93, "Unknown_93" }, // 00000077
|
|
|
|
{ 0xa0, "Unknown_a0" }, // 00000005
|
|
|
|
{ 0xa1, "Unknown_a1" }, // 00000000
|
|
|
|
{ 0xa2, "Unknown_a2" }, // 00000008
|
|
|
|
{ 0xa3, "Unknown_a3" }, // 00000030
|
|
|
|
{ 0xa4, "Unknown_a4" }, // 00000030
|
|
|
|
{ 0xa5, "? Thermal Protect Lamination" }, // 00000046
|
|
|
|
|
|
|
|
{ 0xa6, "Unknown_a6" }, // 00000001
|
|
|
|
{ 0xa7, "Unknown_a7" }, // 00000014
|
|
|
|
{ 0xa8, "Unknown_a8" }, // 00000001
|
|
|
|
{ 0xa9, "Unknown_a9" }, // ffffffff
|
|
|
|
{ 0xc1, "Unknown_c1" }, // 00000002
|
|
|
|
{ 0xc2, "Unknown_c2" }, // 000000c8
|
|
|
|
{ 0xc3, "Unknown_c3" }, // 000000c8
|
|
|
|
{ 0xc4, "Unknown_c4" }, // 000004d0
|
|
|
|
{ 0xf1, "Unknown_f1" }, // 00000022
|
|
|
|
{ 0xf2, "Unknown_f2" }, // 00000022
|
|
|
|
|
|
|
|
{ 0xf3, "Unknown_f3" }, // 00000047
|
|
|
|
{ 0xf4, "Unknown_f4" }, // 00000022
|
|
|
|
};
|
|
|
|
#define ek8810_params_num (sizeof(ek8810_params) / sizeof(struct sinfonia_param))
|
2019-09-19 18:40:10 -04:00
|
|
|
|
2015-07-02 23:32:16 -04:00
|
|
|
#define PARAM_DRIVER_MODE 0x3e
|
|
|
|
#define PARAM_PAPER_MODE 0x3f
|
|
|
|
#define PARAM_SLEEP_TIME 0x54
|
|
|
|
|
2019-09-21 23:03:05 -04:00
|
|
|
static const struct sinfonia_param s6245_params[] =
|
|
|
|
{
|
|
|
|
{ PARAM_DRIVER_MODE, "Driver Mode/Wizard" },
|
|
|
|
{ PARAM_PAPER_MODE, "Paper Load Mode" },
|
|
|
|
{ PARAM_SLEEP_TIME, "Sleep Time" },
|
|
|
|
};
|
|
|
|
#define s6245_params_num (sizeof(s6245_params) / sizeof(struct sinfonia_param))
|
|
|
|
|
2015-07-02 23:32:16 -04:00
|
|
|
#define PARAM_DRIVER_WIZOFF 0x00000000
|
|
|
|
#define PARAM_DRIVER_WIZON 0x00000001
|
|
|
|
|
|
|
|
#define PARAM_PAPER_NOCUT 0x00000000
|
|
|
|
#define PARAM_PAPER_CUTLOAD 0x00000001
|
|
|
|
|
|
|
|
#define PARAM_SLEEP_5MIN 0x00000000
|
|
|
|
#define PARAM_SLEEP_15MIN 0x00000001
|
|
|
|
#define PARAM_SLEEP_30MIN 0x00000002
|
|
|
|
#define PARAM_SLEEP_60MIN 0x00000003
|
|
|
|
#define PARAM_SLEEP_120MIN 0x00000004
|
|
|
|
#define PARAM_SLEEP_240MIN 0x00000005
|
|
|
|
|
2019-09-03 19:02:13 -04:00
|
|
|
static const char *s6245_error_codes(uint8_t major, uint8_t minor)
|
2015-07-02 23:32:16 -04:00
|
|
|
{
|
|
|
|
switch(major) {
|
|
|
|
case 0x01: /* "Controller Error" */
|
|
|
|
switch(minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Controller: EEPROM Write Timeout";
|
|
|
|
case 0x09:
|
|
|
|
return "Controller: DSP FW Boot";
|
|
|
|
case 0x0A:
|
|
|
|
return "Controller: Invalid Print Parameter Table";
|
|
|
|
case 0x0B:
|
|
|
|
return "Controller: DSP FW Mismatch";
|
|
|
|
case 0x0C:
|
|
|
|
return "Controller: Print Parameter Table Mismatch";
|
|
|
|
case 0x0D:
|
|
|
|
return "Controller: FPGA Configuration Failed";
|
|
|
|
case 0x0F:
|
|
|
|
return "Controller: Main FW Checksum";
|
|
|
|
case 0x10:
|
|
|
|
return "Controller: Flash Write Failed";
|
|
|
|
case 0x11:
|
|
|
|
return "Controller: DSP Checksum";
|
|
|
|
case 0x12:
|
|
|
|
return "Controller: DSP FW Write Failed";
|
|
|
|
case 0x13:
|
|
|
|
return "Controller: Print Parameter Table Checksum";
|
|
|
|
case 0x14:
|
|
|
|
return "Controller: Print Parameter Table Write Failed";
|
|
|
|
case 0x15:
|
|
|
|
return "Controller: User Tone Curve Write Failed";
|
|
|
|
case 0x16:
|
|
|
|
return "Controller: MSP Communication";
|
|
|
|
case 0x17:
|
|
|
|
return "Controller: THV Autotuning";
|
|
|
|
case 0x18:
|
|
|
|
return "Controller: THV Value Out of Range";
|
|
|
|
case 0x19:
|
|
|
|
return "Controller: Thermal Head";
|
|
|
|
case 0x1B:
|
|
|
|
return "Controller: DSP Communication";
|
|
|
|
case 0x1C:
|
|
|
|
return "Controller: DSP DMA Failed";
|
|
|
|
default:
|
|
|
|
return "Controller: Unknown";
|
|
|
|
}
|
|
|
|
case 0x02: /* "Mechanical Error" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Mechanical: Pinch Head Home";
|
|
|
|
case 0x02:
|
|
|
|
return "Mechanical: Pinch Head (position 1)";
|
|
|
|
case 0x03:
|
|
|
|
return "Mechanical: Pinch Head (position 2)";
|
|
|
|
case 0x04:
|
|
|
|
return "Mechanical: Pinch Head (position 3)";
|
|
|
|
case 0x0B:
|
|
|
|
return "Mechanical: Cutter (Right)";
|
|
|
|
case 0x0C:
|
|
|
|
return "Mechanical: Cutter (Left)";
|
|
|
|
default:
|
|
|
|
return "Mechanical: Unknown";
|
|
|
|
}
|
|
|
|
case 0x03: /* "Sensor Error" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Sensor: Head Up";
|
|
|
|
case 0x02:
|
|
|
|
return "Sensor: Head Down";
|
|
|
|
case 0x0B:
|
|
|
|
return "Sensor: Cutter Left";
|
|
|
|
case 0x0C:
|
|
|
|
return "Sensor: Cutter Right";
|
|
|
|
case 0x0D:
|
|
|
|
return "Sensor: Cutter Left+Right";
|
|
|
|
case 0x15:
|
|
|
|
return "Sensor: Head Up Unstable";
|
|
|
|
case 0x16:
|
|
|
|
return "Sensor: Head Down Unstable";
|
|
|
|
case 0x17:
|
|
|
|
return "Sensor: Cutter Left Unstable";
|
|
|
|
case 0x18:
|
|
|
|
return "Sensor: Cutter Right Unstable";
|
|
|
|
case 0x19:
|
|
|
|
return "Sensor: Cover Open Unstable";
|
|
|
|
case 0x1E:
|
|
|
|
return "Sensor: Ribbon Mark (Cyan)";
|
|
|
|
case 0x1F:
|
|
|
|
return "Sensor: Ribbon Mark (OC)";
|
|
|
|
default:
|
|
|
|
return "Sensor: Unknown";
|
|
|
|
}
|
|
|
|
case 0x04: /* "Temperature Sensor Error" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Temp Sensor: Thermal Head Low";
|
|
|
|
case 0x02:
|
|
|
|
return "Temp Sensor: Thermal Head High";
|
|
|
|
case 0x05:
|
|
|
|
return "Temp Sensor: Environment Low";
|
|
|
|
case 0x06:
|
|
|
|
return "Temp Sensor: Environment High";
|
|
|
|
case 0x07:
|
|
|
|
return "Temp Sensor: Preheat";
|
|
|
|
case 0x08:
|
|
|
|
return "Temp Sensor: Thermal Protect";
|
|
|
|
default:
|
|
|
|
return "Temp Sensor: Unknown";
|
|
|
|
}
|
|
|
|
case 0x5: /* "Paper Jam" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Paper Jam: Loading Paper Top On";
|
|
|
|
case 0x02:
|
|
|
|
return "Paper Jam: Loading Print Position On";
|
|
|
|
case 0x03:
|
|
|
|
return "Paper Jam: Loading Print Position Off";
|
|
|
|
case 0x04:
|
|
|
|
return "Paper Jam: Loading Paper Top Off";
|
|
|
|
case 0x05:
|
|
|
|
return "Paper Jam: Loading Cut Print Position Off";
|
|
|
|
case 0x0C:
|
|
|
|
return "Paper Jam: Initializing Print Position Off";
|
|
|
|
case 0x0D:
|
|
|
|
return "Paper Jam: Initializing Print Position On";
|
|
|
|
case 0x15:
|
|
|
|
return "Paper Jam: Printing Print Position Off";
|
|
|
|
case 0x16:
|
|
|
|
return "Paper Jam: Printing Paper Top On";
|
|
|
|
case 0x17:
|
|
|
|
return "Paper Jam: Printing Paper Top Off";
|
|
|
|
case 0x1F:
|
|
|
|
return "Paper Jam: Precut Print Position Off";
|
|
|
|
case 0x20:
|
|
|
|
return "Paper Jam: Precut Print Position On";
|
2016-08-19 17:40:12 -04:00
|
|
|
|
2015-07-02 23:32:16 -04:00
|
|
|
case 0x29:
|
|
|
|
return "Paper Jam: Printing Paper Top On";
|
|
|
|
case 0x2A:
|
|
|
|
return "Paper Jam: Printing Pre-Yellow Print Position Off";
|
|
|
|
case 0x2B:
|
|
|
|
return "Paper Jam: Printing Yellow Print Position Off";
|
|
|
|
case 0x2C:
|
|
|
|
return "Paper Jam: Printing Yellow Print Position On";
|
|
|
|
case 0x2D:
|
|
|
|
return "Paper Jam: Printing Pre-Magenta Print Position Off";
|
|
|
|
case 0x2E:
|
|
|
|
return "Paper Jam: Printing Magenta Print Position On";
|
|
|
|
case 0x2F:
|
|
|
|
return "Paper Jam: Printing Magenta Print Position Off";
|
|
|
|
case 0x30:
|
|
|
|
return "Paper Jam: Printing Pre-Cyan Print Position Off";
|
|
|
|
case 0x31:
|
|
|
|
return "Paper Jam: Printing Cyan Print Position On";
|
|
|
|
case 0x32:
|
|
|
|
return "Paper Jam: Printing Cyan Print Position Off";
|
|
|
|
case 0x33:
|
|
|
|
return "Paper Jam: Printing Pre-OC Print Position Off";
|
|
|
|
case 0x34:
|
|
|
|
return "Paper Jam: Printing OC Print Position On";
|
|
|
|
case 0x35:
|
|
|
|
return "Paper Jam: Printing OC Print Position Off";
|
|
|
|
case 0x36:
|
|
|
|
return "Paper Jam: Cut Print Position Off";
|
|
|
|
case 0x37:
|
|
|
|
return "Paper Jam: Home Position Off";
|
|
|
|
case 0x38:
|
|
|
|
return "Paper Jam: Paper Top Off";
|
|
|
|
case 0x39:
|
|
|
|
return "Paper Jam: Print Position On";
|
|
|
|
|
|
|
|
case 0x51:
|
|
|
|
return "Paper Jam: Paper Empty On, Top On, Position On";
|
|
|
|
case 0x52:
|
|
|
|
return "Paper Jam: Paper Empty On, Top On, Position Off";
|
|
|
|
case 0x53:
|
|
|
|
return "Paper Jam: Paper Empty On, Top Off, Print Position On";
|
|
|
|
case 0x54:
|
|
|
|
return "Paper Jam: Paper Empty On, Top Of, Position Off";
|
|
|
|
case 0x55:
|
|
|
|
return "Paper Jam: Paper Empty Off, Top On, Position On";
|
|
|
|
case 0x56:
|
|
|
|
return "Paper Jam: Paper Empty Off, Top On, Position Off";
|
|
|
|
case 0x57:
|
|
|
|
return "Paper Jam: Paper Empty Off, Top Off, Position On";
|
|
|
|
case 0x60:
|
|
|
|
return "Paper Jam: Cutter Right";
|
|
|
|
case 0x61:
|
|
|
|
return "Paper Jam: Cutter Left";
|
|
|
|
|
|
|
|
default:
|
|
|
|
return "Paper Jam: Unknown";
|
|
|
|
}
|
|
|
|
case 0x06: /* User Error */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Drawer Unit Open";
|
|
|
|
case 0x02:
|
|
|
|
return "Incorrect Ribbon";
|
|
|
|
case 0x03:
|
|
|
|
return "No/Empty Ribbon";
|
|
|
|
case 0x04:
|
|
|
|
return "Mismatched Ribbon";
|
|
|
|
case 0x08:
|
|
|
|
return "No Paper";
|
|
|
|
case 0x0C:
|
|
|
|
return "Paper End";
|
|
|
|
default:
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:02:13 -04:00
|
|
|
/* XXX these are generally assumed to be the same as S6245, but
|
|
|
|
at least the "user error" category is known to be different. */
|
|
|
|
static const char *ek8810_error_codes(uint8_t major, uint8_t minor)
|
|
|
|
{
|
|
|
|
switch(major) {
|
|
|
|
case 0x01: /* "Controller Error" */
|
|
|
|
switch(minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Controller: EEPROM Write Timeout";
|
|
|
|
case 0x09:
|
|
|
|
return "Controller: DSP FW Boot";
|
|
|
|
case 0x0A:
|
|
|
|
return "Controller: Invalid Print Parameter Table";
|
|
|
|
case 0x0B:
|
|
|
|
return "Controller: DSP FW Mismatch";
|
|
|
|
case 0x0C:
|
|
|
|
return "Controller: Print Parameter Table Mismatch";
|
|
|
|
case 0x0D:
|
|
|
|
return "Controller: FPGA Configuration Failed";
|
|
|
|
case 0x0F:
|
|
|
|
return "Controller: Main FW Checksum";
|
|
|
|
case 0x10:
|
|
|
|
return "Controller: Flash Write Failed";
|
|
|
|
case 0x11:
|
|
|
|
return "Controller: DSP Checksum";
|
|
|
|
case 0x12:
|
|
|
|
return "Controller: DSP FW Write Failed";
|
|
|
|
case 0x13:
|
|
|
|
return "Controller: Print Parameter Table Checksum";
|
|
|
|
case 0x14:
|
|
|
|
return "Controller: Print Parameter Table Write Failed";
|
|
|
|
case 0x15:
|
|
|
|
return "Controller: User Tone Curve Write Failed";
|
|
|
|
case 0x16:
|
|
|
|
return "Controller: MSP Communication";
|
|
|
|
case 0x17:
|
|
|
|
return "Controller: THV Autotuning";
|
|
|
|
case 0x18:
|
|
|
|
return "Controller: THV Value Out of Range";
|
|
|
|
case 0x19:
|
|
|
|
return "Controller: Thermal Head";
|
|
|
|
case 0x1B:
|
|
|
|
return "Controller: DSP Communication";
|
|
|
|
case 0x1C:
|
|
|
|
return "Controller: DSP DMA Failed";
|
|
|
|
default:
|
|
|
|
return "Controller: Unknown";
|
|
|
|
}
|
|
|
|
case 0x02: /* "Mechanical Error" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Mechanical: Pinch Head Home";
|
|
|
|
case 0x02:
|
|
|
|
return "Mechanical: Pinch Head (position 1)";
|
|
|
|
case 0x03:
|
|
|
|
return "Mechanical: Pinch Head (position 2)";
|
|
|
|
case 0x04:
|
|
|
|
return "Mechanical: Pinch Head (position 3)";
|
|
|
|
case 0x0B:
|
|
|
|
return "Mechanical: Cutter (Right)";
|
|
|
|
case 0x0C:
|
|
|
|
return "Mechanical: Cutter (Left)";
|
|
|
|
default:
|
|
|
|
return "Mechanical: Unknown";
|
|
|
|
}
|
|
|
|
case 0x03: /* "Sensor Error" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Sensor: Head Up";
|
|
|
|
case 0x02:
|
|
|
|
return "Sensor: Head Down";
|
|
|
|
case 0x0B:
|
|
|
|
return "Sensor: Cutter Left";
|
|
|
|
case 0x0C:
|
|
|
|
return "Sensor: Cutter Right";
|
|
|
|
case 0x0D:
|
|
|
|
return "Sensor: Cutter Left+Right";
|
|
|
|
case 0x15:
|
|
|
|
return "Sensor: Head Up Unstable";
|
|
|
|
case 0x16:
|
|
|
|
return "Sensor: Head Down Unstable";
|
|
|
|
case 0x17:
|
|
|
|
return "Sensor: Cutter Left Unstable";
|
|
|
|
case 0x18:
|
|
|
|
return "Sensor: Cutter Right Unstable";
|
|
|
|
case 0x19:
|
|
|
|
return "Sensor: Cover Open Unstable";
|
|
|
|
case 0x1E:
|
|
|
|
return "Sensor: Ribbon Mark (Cyan)";
|
|
|
|
case 0x1F:
|
|
|
|
return "Sensor: Ribbon Mark (OC)";
|
|
|
|
default:
|
|
|
|
return "Sensor: Unknown";
|
|
|
|
}
|
|
|
|
case 0x04: /* "Temperature Sensor Error" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Temp Sensor: Thermal Head Low";
|
|
|
|
case 0x02:
|
|
|
|
return "Temp Sensor: Thermal Head High";
|
|
|
|
case 0x05:
|
|
|
|
return "Temp Sensor: Environment Low";
|
|
|
|
case 0x06:
|
|
|
|
return "Temp Sensor: Environment High";
|
|
|
|
case 0x07:
|
|
|
|
return "Temp Sensor: Preheat";
|
|
|
|
case 0x08:
|
|
|
|
return "Temp Sensor: Thermal Protect";
|
|
|
|
default:
|
|
|
|
return "Temp Sensor: Unknown";
|
|
|
|
}
|
|
|
|
case 0x5: /* "Paper Jam" */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Paper Jam: Loading Paper Top On";
|
|
|
|
case 0x02:
|
|
|
|
return "Paper Jam: Loading Print Position On";
|
|
|
|
case 0x03:
|
|
|
|
return "Paper Jam: Loading Print Position Off";
|
|
|
|
case 0x04:
|
|
|
|
return "Paper Jam: Loading Paper Top Off";
|
|
|
|
case 0x05:
|
|
|
|
return "Paper Jam: Loading Cut Print Position Off";
|
|
|
|
case 0x0C:
|
|
|
|
return "Paper Jam: Initializing Print Position Off";
|
|
|
|
case 0x0D:
|
|
|
|
return "Paper Jam: Initializing Print Position On";
|
|
|
|
case 0x15:
|
|
|
|
return "Paper Jam: Printing Print Position Off";
|
|
|
|
case 0x16:
|
|
|
|
return "Paper Jam: Printing Paper Top On";
|
|
|
|
case 0x17:
|
|
|
|
return "Paper Jam: Printing Paper Top Off";
|
|
|
|
case 0x1F:
|
|
|
|
return "Paper Jam: Precut Print Position Off";
|
|
|
|
case 0x20:
|
|
|
|
return "Paper Jam: Precut Print Position On";
|
|
|
|
|
|
|
|
case 0x29:
|
|
|
|
return "Paper Jam: Printing Paper Top On";
|
|
|
|
case 0x2A:
|
|
|
|
return "Paper Jam: Printing Pre-Yellow Print Position Off";
|
|
|
|
case 0x2B:
|
|
|
|
return "Paper Jam: Printing Yellow Print Position Off";
|
|
|
|
case 0x2C:
|
|
|
|
return "Paper Jam: Printing Yellow Print Position On";
|
|
|
|
case 0x2D:
|
|
|
|
return "Paper Jam: Printing Pre-Magenta Print Position Off";
|
|
|
|
case 0x2E:
|
|
|
|
return "Paper Jam: Printing Magenta Print Position On";
|
|
|
|
case 0x2F:
|
|
|
|
return "Paper Jam: Printing Magenta Print Position Off";
|
|
|
|
case 0x30:
|
|
|
|
return "Paper Jam: Printing Pre-Cyan Print Position Off";
|
|
|
|
case 0x31:
|
|
|
|
return "Paper Jam: Printing Cyan Print Position On";
|
|
|
|
case 0x32:
|
|
|
|
return "Paper Jam: Printing Cyan Print Position Off";
|
|
|
|
case 0x33:
|
|
|
|
return "Paper Jam: Printing Pre-OC Print Position Off";
|
|
|
|
case 0x34:
|
|
|
|
return "Paper Jam: Printing OC Print Position On";
|
|
|
|
case 0x35:
|
|
|
|
return "Paper Jam: Printing OC Print Position Off";
|
|
|
|
case 0x36:
|
|
|
|
return "Paper Jam: Cut Print Position Off";
|
|
|
|
case 0x37:
|
|
|
|
return "Paper Jam: Home Position Off";
|
|
|
|
case 0x38:
|
|
|
|
return "Paper Jam: Paper Top Off";
|
|
|
|
case 0x39:
|
|
|
|
return "Paper Jam: Print Position On";
|
|
|
|
|
|
|
|
case 0x51:
|
|
|
|
return "Paper Jam: Paper Empty On, Top On, Position On";
|
|
|
|
case 0x52:
|
|
|
|
return "Paper Jam: Paper Empty On, Top On, Position Off";
|
|
|
|
case 0x53:
|
|
|
|
return "Paper Jam: Paper Empty On, Top Off, Print Position On";
|
|
|
|
case 0x54:
|
|
|
|
return "Paper Jam: Paper Empty On, Top Of, Position Off";
|
|
|
|
case 0x55:
|
|
|
|
return "Paper Jam: Paper Empty Off, Top On, Position On";
|
|
|
|
case 0x56:
|
|
|
|
return "Paper Jam: Paper Empty Off, Top On, Position Off";
|
|
|
|
case 0x57:
|
|
|
|
return "Paper Jam: Paper Empty Off, Top Off, Position On";
|
|
|
|
case 0x60:
|
|
|
|
return "Paper Jam: Cutter Right";
|
|
|
|
case 0x61:
|
|
|
|
return "Paper Jam: Cutter Left";
|
|
|
|
|
|
|
|
default:
|
|
|
|
return "Paper Jam: Unknown";
|
|
|
|
}
|
|
|
|
case 0x06: /* User/Error */
|
|
|
|
switch (minor) {
|
|
|
|
case 0x01:
|
|
|
|
return "Front Cover Open";
|
|
|
|
case 0x02:
|
|
|
|
return "Paper Cover Open";
|
|
|
|
case 0x03:
|
|
|
|
return "Incorrect Ribbon";
|
|
|
|
case 0x05:
|
|
|
|
return "No Ribbon";
|
|
|
|
case 0x06:
|
|
|
|
return "Paper Empty";
|
|
|
|
case 0x08: // guess?
|
|
|
|
return "No Paper";
|
|
|
|
case 0x0C: // guess?
|
|
|
|
return "Paper End";
|
|
|
|
default:
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-13 10:41:28 -04:00
|
|
|
#define RIBBON_NONE 0x00
|
|
|
|
#define RIBBON_8x10 0x11
|
|
|
|
#define RIBBON_8x12 0x12
|
|
|
|
|
2019-09-08 21:33:30 -04:00
|
|
|
#define RIBBON_8x10K 0x03 /* XXX GUESS - EK8810 (129-4966/109-9787) */
|
|
|
|
#define RIBBON_8x12K 0x04 /* EK8810 (127-7268/115-6413 or equiv) */
|
2019-08-13 08:48:07 -04:00
|
|
|
|
2016-08-19 17:40:12 -04:00
|
|
|
static const char *ribbon_sizes (uint8_t v) {
|
|
|
|
switch (v) {
|
2019-05-13 10:41:28 -04:00
|
|
|
case RIBBON_NONE:
|
2016-08-19 17:40:12 -04:00
|
|
|
return "None";
|
2019-05-13 10:41:28 -04:00
|
|
|
case RIBBON_8x10:
|
2019-08-15 15:21:42 -04:00
|
|
|
case RIBBON_8x10K:
|
2016-08-19 17:40:12 -04:00
|
|
|
return "8x10";
|
2019-05-13 10:41:28 -04:00
|
|
|
case RIBBON_8x12:
|
2019-08-13 08:48:07 -04:00
|
|
|
case RIBBON_8x12K:
|
2016-08-19 17:40:12 -04:00
|
|
|
return "8x12";
|
|
|
|
default:
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ribbon_counts (uint8_t v) {
|
|
|
|
switch (v) {
|
2019-05-13 10:41:28 -04:00
|
|
|
case RIBBON_8x10:
|
2016-08-19 17:40:12 -04:00
|
|
|
return 120;
|
2019-05-13 10:41:28 -04:00
|
|
|
case RIBBON_8x12:
|
2016-08-19 17:40:12 -04:00
|
|
|
return 100;
|
2019-08-15 15:21:42 -04:00
|
|
|
case RIBBON_8x10K:
|
2019-09-08 21:33:30 -04:00
|
|
|
return 300;
|
2019-08-15 15:21:42 -04:00
|
|
|
case RIBBON_8x12K:
|
|
|
|
return 250;
|
2016-08-19 17:40:12 -04:00
|
|
|
default:
|
|
|
|
return 120;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-02 23:32:16 -04:00
|
|
|
struct s6245_errorlog_resp {
|
2019-05-12 23:41:04 -04:00
|
|
|
struct sinfonia_status_hdr hdr;
|
2015-07-02 23:32:16 -04:00
|
|
|
uint16_t error_count;
|
|
|
|
uint8_t error_major;
|
|
|
|
uint8_t error_minor;
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t print_counter;
|
|
|
|
uint16_t ribbon_remain;
|
|
|
|
uint8_t ribbon_takeup_diameter;
|
|
|
|
uint8_t ribbon_supply_diameter;
|
|
|
|
uint16_t main_fw_ver;
|
|
|
|
uint16_t dsp_fw_ver;
|
|
|
|
uint16_t print_param_ver;
|
|
|
|
uint16_t boot_fw_ver;
|
|
|
|
uint8_t time_sec;
|
|
|
|
uint8_t time_min;
|
|
|
|
uint8_t time_hour;
|
|
|
|
uint8_t time_day;
|
|
|
|
uint8_t time_month;
|
|
|
|
uint8_t time_year;
|
|
|
|
uint16_t reserved2;
|
|
|
|
uint8_t printer_thermistor;
|
|
|
|
uint8_t head_thermistor;
|
|
|
|
uint8_t printer_humidity;
|
|
|
|
uint8_t reserved3[13];
|
|
|
|
uint8_t status;
|
|
|
|
uint8_t reserved4[3];
|
|
|
|
uint16_t image_cols;
|
|
|
|
uint16_t image_rows;
|
|
|
|
uint8_t reserved5[8];
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2018-04-27 15:40:09 -04:00
|
|
|
/* Private data structure */
|
|
|
|
struct shinkos6245_ctx {
|
2019-05-24 23:49:51 -04:00
|
|
|
struct sinfonia_usbdev dev;
|
2015-07-02 23:32:16 -04:00
|
|
|
|
2018-04-27 15:40:09 -04:00
|
|
|
uint8_t jobid;
|
|
|
|
|
|
|
|
struct marker marker;
|
|
|
|
|
2019-12-13 19:54:50 -05:00
|
|
|
char serial[32];
|
|
|
|
char fwver[32];
|
|
|
|
|
2019-09-08 21:33:30 -04:00
|
|
|
struct sinfonia_6x45_mediainfo_resp media;
|
2018-04-27 15:40:09 -04:00
|
|
|
};
|
2015-07-02 23:32:16 -04:00
|
|
|
|
|
|
|
#define CMDBUF_LEN sizeof(struct s6245_print_cmd)
|
|
|
|
|
|
|
|
static int get_status(struct shinkos6245_ctx *ctx)
|
|
|
|
{
|
2019-05-12 23:41:04 -04:00
|
|
|
struct sinfonia_cmd_hdr cmd;
|
2020-07-28 20:40:43 -04:00
|
|
|
struct sinfonia_status_resp resp;
|
2019-05-13 10:41:28 -04:00
|
|
|
struct sinfonia_getextcounter_resp resp2;
|
2015-07-02 23:32:16 -04:00
|
|
|
int ret, num = 0;
|
|
|
|
|
2019-05-13 10:41:28 -04:00
|
|
|
cmd.cmd = cpu_to_le16(SINFONIA_CMD_GETSTATUS);
|
2015-07-02 23:32:16 -04:00
|
|
|
cmd.len = cpu_to_le16(0);
|
|
|
|
|
2019-05-24 23:49:51 -04:00
|
|
|
if ((ret = sinfonia_docmd(&ctx->dev,
|
|
|
|
(uint8_t*)&cmd, sizeof(cmd),
|
|
|
|
(uint8_t*) &resp, sizeof(resp),
|
2019-09-21 23:03:05 -04:00
|
|
|
&num))) {
|
2015-07-02 23:32:16 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-04-27 15:40:09 -04:00
|
|
|
INFO("Printer Status: 0x%02x (%s)\n", resp.hdr.status,
|
2019-05-13 10:41:28 -04:00
|
|
|
sinfonia_status_str(resp.hdr.status));
|
2018-04-27 15:40:09 -04:00
|
|
|
if (resp.hdr.status == ERROR_PRINTER) {
|
|
|
|
if(resp.hdr.error == ERROR_NONE)
|
|
|
|
resp.hdr.error = resp.hdr.status;
|
2015-07-02 23:32:16 -04:00
|
|
|
INFO(" Error 0x%02x (%s) 0x%02x/0x%02x (%s)\n",
|
2018-04-27 15:40:09 -04:00
|
|
|
resp.hdr.error,
|
2019-05-09 12:39:18 -04:00
|
|
|
sinfonia_error_str(resp.hdr.error),
|
2018-04-27 15:40:09 -04:00
|
|
|
resp.hdr.printer_major,
|
2019-09-03 19:02:13 -04:00
|
|
|
resp.hdr.printer_minor, ctx->dev.error_codes(resp.hdr.printer_major, resp.hdr.printer_minor));
|
2015-07-02 23:32:16 -04:00
|
|
|
}
|
2019-09-21 23:03:05 -04:00
|
|
|
|
|
|
|
/* Sanity checking */
|
2020-07-28 20:40:43 -04:00
|
|
|
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct sinfonia_status_resp) - sizeof(struct sinfonia_status_hdr)))
|
2019-09-21 23:03:05 -04:00
|
|
|
return CUPS_BACKEND_OK;
|
2015-07-02 23:32:16 -04:00
|
|
|
|
|
|
|
INFO(" Print Counts:\n");
|
2018-04-27 15:40:09 -04:00
|
|
|
INFO("\tSince Paper Changed:\t%08u\n", le32_to_cpu(resp.count_paper));
|
|
|
|
INFO("\tLifetime:\t\t%08u\n", le32_to_cpu(resp.count_lifetime));
|
|
|
|
INFO("\tMaintenance:\t\t%08u\n", le32_to_cpu(resp.count_maint));
|
|
|
|
INFO("\tPrint Head:\t\t%08u\n", le32_to_cpu(resp.count_head));
|
|
|
|
INFO(" Cutter Actuations:\t%08u\n", le32_to_cpu(resp.count_cutter));
|
2019-05-23 12:25:01 -04:00
|
|
|
INFO(" Ribbon Remaining:\t%8u%%\n", le32_to_cpu(resp.count_ribbon_left));
|
2019-08-15 15:21:42 -04:00
|
|
|
INFO(" Prints Remaining:\t%8u\n", ribbon_counts(ctx->media.ribbon_code) - le32_to_cpu(resp.count_paper));
|
2015-07-02 23:32:16 -04:00
|
|
|
INFO("Bank 1: 0x%02x (%s) Job %03u @ %03u/%03u (%03u remaining)\n",
|
2019-05-06 16:28:07 -04:00
|
|
|
resp.bank1_status, sinfonia_bank_statuses(resp.bank1_status),
|
2018-04-27 15:40:09 -04:00
|
|
|
resp.bank1_printid,
|
|
|
|
le16_to_cpu(resp.bank1_finished),
|
|
|
|
le16_to_cpu(resp.bank1_specified),
|
|
|
|
le16_to_cpu(resp.bank1_remaining));
|
2015-07-02 23:32:16 -04:00
|
|
|
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO("Bank 2: 0x%02x (%s) Job %03u @ %03u/%03u (%03u remaining)\n",
|
2019-05-06 16:28:07 -04:00
|
|
|
resp.bank2_status, sinfonia_bank_statuses(resp.bank1_status),
|
2018-04-27 15:40:09 -04:00
|
|
|
resp.bank2_printid,
|
|
|
|
le16_to_cpu(resp.bank2_finished),
|
|
|
|
le16_to_cpu(resp.bank2_specified),
|
|
|
|
le16_to_cpu(resp.bank2_remaining));
|
2015-07-02 23:32:16 -04:00
|
|
|
|
2019-05-06 16:28:07 -04:00
|
|
|
INFO("Tonecurve Status: 0x%02x (%s)\n", resp.tonecurve_status, sinfonia_tonecurve_statuses(resp.tonecurve_status));
|
2015-07-02 23:32:16 -04:00
|
|
|
|
2019-08-15 15:21:42 -04:00
|
|
|
|
2015-07-02 23:32:16 -04:00
|
|
|
/* Query Extended counters */
|
2019-08-15 15:21:42 -04:00
|
|
|
if (ctx->dev.type == P_KODAK_8810)
|
2019-09-21 23:03:05 -04:00
|
|
|
return CUPS_BACKEND_OK; /* Kodak 8810 returns 12 bytes of garbage. */
|
2019-08-15 15:21:42 -04:00
|
|
|
|
2019-05-13 10:41:28 -04:00
|
|
|
cmd.cmd = cpu_to_le16(SINFONIA_CMD_EXTCOUNTER);
|
2015-07-02 23:32:16 -04:00
|
|
|
cmd.len = cpu_to_le16(0);
|
|
|
|
|
2019-05-24 23:49:51 -04:00
|
|
|
if ((ret = sinfonia_docmd(&ctx->dev,
|
|
|
|
(uint8_t*)&cmd, sizeof(cmd),
|
|
|
|
(uint8_t*)&resp2, sizeof(resp2),
|
2019-09-21 23:03:05 -04:00
|
|
|
&num))) {
|
2015-07-02 23:32:16 -04:00
|
|
|
return ret;
|
|
|
|
}
|
2019-08-15 15:21:42 -04:00
|
|
|
|
|
|
|
if (le16_to_cpu(resp2.hdr.payload_len) < 12)
|
2019-09-21 23:03:05 -04:00
|
|
|
return CUPS_BACKEND_OK;
|
2015-07-02 23:32:16 -04:00
|
|
|
|
2018-04-27 15:40:09 -04:00
|
|
|
INFO("Lifetime Distance: %08u inches\n", le32_to_cpu(resp2.lifetime_distance));
|
|
|
|
INFO("Maintenance Distance: %08u inches\n", le32_to_cpu(resp2.maint_distance));
|
|
|
|
INFO("Head Distance: %08u inches\n", le32_to_cpu(resp2.head_distance));
|
2015-07-02 23:32:16 -04:00
|
|
|
|
2019-09-21 23:03:05 -04:00
|
|
|
return CUPS_BACKEND_OK;
|
2015-07-02 23:32:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int get_errorlog(struct shinkos6245_ctx *ctx)
|
|
|
|
{
|
2020-07-28 20:40:43 -04:00
|
|
|
struct sinfonia_errorlog2_cmd cmd;
|
2018-04-27 15:40:09 -04:00
|
|
|
struct s6245_errorlog_resp resp;
|
2015-07-04 10:01:23 -04:00
|
|
|
int num = 0;
|
2015-07-02 23:32:16 -04:00
|
|
|
int i = 0;
|
|
|
|
|
2019-05-13 10:41:28 -04:00
|
|
|
cmd.hdr.cmd = cpu_to_le16(SINFONIA_CMD_ERRORLOG);
|
2015-07-02 23:32:16 -04:00
|
|
|
cmd.hdr.len = cpu_to_le16(2);
|
|
|
|
|
|
|
|
do {
|
2015-07-04 10:01:23 -04:00
|
|
|
int ret;
|
2015-07-02 23:32:16 -04:00
|
|
|
cmd.index = i;
|
2017-07-10 20:15:56 -04:00
|
|
|
|
2019-05-24 23:49:51 -04:00
|
|
|
if ((ret = sinfonia_docmd(&ctx->dev,
|
|
|
|
(uint8_t*)&cmd, sizeof(cmd),
|
|
|
|
(uint8_t*)&resp, sizeof(resp),
|
2019-09-21 23:03:05 -04:00
|
|
|
&num))) {
|
2015-07-02 23:32:16 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-05-12 23:41:04 -04:00
|
|
|
if (le16_to_cpu(resp.hdr.payload_len) != (sizeof(struct s6245_errorlog_resp) - sizeof(struct sinfonia_status_hdr)))
|
2015-07-02 23:32:16 -04:00
|
|
|
return -2;
|
|
|
|
|
|
|
|
INFO("Stored Error ID %d:\n", i);
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO(" %04d-%02u-%02u %02u:%02u:%02u @ %08u prints : 0x%02x/0x%02x (%s)\n",
|
2018-04-27 15:40:09 -04:00
|
|
|
resp.time_year + 2000, resp.time_month, resp.time_day,
|
|
|
|
resp.time_hour, resp.time_min, resp.time_sec,
|
|
|
|
le32_to_cpu(resp.print_counter),
|
|
|
|
resp.error_major, resp.error_minor,
|
2019-09-03 19:02:13 -04:00
|
|
|
ctx->dev.error_codes(resp.error_major, resp.error_minor));
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO(" Temp: %02u/%02u Hum: %02u\n",
|
2018-04-27 15:40:09 -04:00
|
|
|
resp.printer_thermistor, resp.head_thermistor, resp.printer_humidity);
|
|
|
|
} while (++i < le16_to_cpu(resp.error_count));
|
2017-07-10 20:15:56 -04:00
|
|
|
|
2019-09-21 23:03:05 -04:00
|
|
|
return CUPS_BACKEND_OK;
|
2015-07-02 23:32:16 -04:00
|
|
|
}
|
|
|
|
|
2019-09-08 21:33:30 -04:00
|
|
|
static void dump_mediainfo(struct sinfonia_6x45_mediainfo_resp *resp)
|
2015-07-02 23:32:16 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2016-08-19 17:40:12 -04:00
|
|
|
INFO("Loaded Media Type: %s\n", ribbon_sizes(resp->ribbon_code));
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO("Supported Media Information: %u entries:\n", resp->count);
|
2015-07-02 23:32:16 -04:00
|
|
|
for (i = 0 ; i < resp->count ; i++) {
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO(" %02d: C 0x%02x (%s), %04ux%04u, P 0x%02x (%s)\n", i,
|
2019-05-13 10:41:28 -04:00
|
|
|
resp->items[i].code,
|
|
|
|
sinfonia_print_codes(resp->items[i].code, 1),
|
2019-05-06 13:38:09 -04:00
|
|
|
resp->items[i].columns,
|
|
|
|
resp->items[i].rows,
|
2019-05-13 10:41:28 -04:00
|
|
|
resp->items[i].method,
|
|
|
|
sinfonia_print_methods(resp->items[i].method));
|
2015-07-02 23:32:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void shinkos6245_cmdline(void)
|
|
|
|
{
|
2019-09-18 22:23:36 -04:00
|
|
|
DEBUG("\t\t[ -b 0|1 ] # Disable/Enable control panel\n");
|
2015-07-02 23:32:16 -04:00
|
|
|
DEBUG("\t\t[ -c filename ] # Get user/NV tone curve\n");
|
|
|
|
DEBUG("\t\t[ -C filename ] # Set user/NV tone curve\n");
|
|
|
|
DEBUG("\t\t[ -e ] # Query error log\n");
|
|
|
|
DEBUG("\t\t[ -F ] # Flash Printer LED\n");
|
2015-07-04 10:01:23 -04:00
|
|
|
DEBUG("\t\t[ -i ] # Query printer info\n");
|
|
|
|
DEBUG("\t\t[ -k num ] # Set sleep time (5-240 minutes)\n");
|
2015-07-02 23:32:16 -04:00
|
|
|
DEBUG("\t\t[ -l filename ] # Get current tone curve\n");
|
|
|
|
DEBUG("\t\t[ -L filename ] # Set current tone curve\n");
|
|
|
|
DEBUG("\t\t[ -m ] # Query media\n");
|
|
|
|
DEBUG("\t\t[ -r ] # Reset user/NV tone curve\n");
|
|
|
|
DEBUG("\t\t[ -R ] # Reset printer to factory defaults\n");
|
|
|
|
DEBUG("\t\t[ -s ] # Query status\n");
|
|
|
|
DEBUG("\t\t[ -X jobid ] # Abort a printjob\n");
|
2019-09-19 15:49:00 -04:00
|
|
|
// DEBUG("\t\t[ -Z ] # Dump all parameters\n");
|
2015-07-02 23:32:16 -04:00
|
|
|
}
|
|
|
|
|
2020-03-24 18:22:39 -04:00
|
|
|
static int shinkos6245_cmdline_arg(void *vctx, int argc, char **argv)
|
2015-07-02 23:32:16 -04:00
|
|
|
{
|
|
|
|
struct shinkos6245_ctx *ctx = vctx;
|
|
|
|
int i, j = 0;
|
|
|
|
|
2015-08-24 17:28:10 -04:00
|
|
|
if (!ctx)
|
|
|
|
return -1;
|
|
|
|
|
2019-09-22 00:14:12 -04:00
|
|
|
while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "b:c:C:eFik:l:L:mrR:sX:Z:")) >= 0) {
|
2015-07-02 23:32:16 -04:00
|
|
|
switch(i) {
|
2015-08-13 21:09:56 -04:00
|
|
|
GETOPT_PROCESS_GLOBAL
|
2019-09-18 22:23:36 -04:00
|
|
|
case 'b':
|
|
|
|
if (ctx->dev.type != P_KODAK_8810)
|
|
|
|
return -1;
|
|
|
|
else 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;
|
2015-07-02 23:32:16 -04:00
|
|
|
case 'c':
|
2019-05-24 23:49:51 -04:00
|
|
|
j = sinfonia_gettonecurve(&ctx->dev, TONECURVE_USER, optarg);
|
2015-08-24 17:28:10 -04:00
|
|
|
break;
|
2015-07-02 23:32:16 -04:00
|
|
|
case 'C':
|
2019-09-19 14:56:37 -04:00
|
|
|
j = sinfonia_settonecurve(&ctx->dev, UPDATE_TARGET_TONE_USER, optarg);
|
2015-08-24 17:28:10 -04:00
|
|
|
break;
|
2015-07-02 23:32:16 -04:00
|
|
|
case 'e':
|
2019-08-13 08:48:07 -04:00
|
|
|
if (ctx->dev.type == P_KODAK_8810) {
|
|
|
|
j = sinfonia_geterrorlog(&ctx->dev);
|
|
|
|
} else {
|
|
|
|
j = get_errorlog(ctx);
|
|
|
|
}
|
2015-08-24 17:28:10 -04:00
|
|
|
break;
|
2015-07-02 23:32:16 -04:00
|
|
|
case 'F':
|
2019-05-24 23:49:51 -04:00
|
|
|
j = sinfonia_flashled(&ctx->dev);
|
2015-08-24 17:28:10 -04:00
|
|
|
break;
|
2015-07-02 23:32:16 -04:00
|
|
|
case 'i':
|
2019-05-24 23:49:51 -04:00
|
|
|
j = sinfonia_getfwinfo(&ctx->dev);
|
2015-08-24 17:28:10 -04:00
|
|
|
break;
|
|
|
|
case 'k': {
|
2019-05-06 21:10:43 -04:00
|
|
|
i = atoi(optarg);
|
2015-08-24 17:28:10 -04:00
|
|
|
if (i < 5)
|
|
|
|
i = 0;
|
|
|
|
else if (i < 15)
|
|
|
|
i = 1;
|
|
|
|
else if (i < 30)
|
|
|
|
i = 2;
|
|
|
|
else if (i < 60)
|
|
|
|
i = 3;
|
|
|
|
else if (i < 120)
|
|
|
|
i = 4;
|
|
|
|
else if (i < 240)
|
|
|
|
i = 5;
|
|
|
|
else
|
|
|
|
i = 5;
|
|
|
|
|
2019-05-24 23:49:51 -04:00
|
|
|
j = sinfonia_setparam(&ctx->dev, PARAM_SLEEP_TIME, i);
|
2015-08-24 17:28:10 -04:00
|
|
|
break;
|
|
|
|
}
|
2015-07-02 23:32:16 -04:00
|
|
|
case 'l':
|
2019-05-24 23:49:51 -04:00
|
|
|
j = sinfonia_gettonecurve(&ctx->dev, TONECURVE_CURRENT, optarg);
|
2015-08-24 17:28:10 -04:00
|
|
|
break;
|
2015-07-02 23:32:16 -04:00
|
|
|
case 'L':
|
|