2013-10-05 09:55:29 -04:00
|
|
|
/*
|
|
|
|
* Mitsubishi CP-D70/D707 Photo Printer CUPS backend -- libusb-1.0 version
|
|
|
|
*
|
2019-06-03 19:40:45 -04:00
|
|
|
* (c) 2013-2019 Solomon Peachy <pizza@shaftnet.org>
|
2013-10-05 09:55:29 -04:00
|
|
|
*
|
|
|
|
* The latest version of this program can be found at:
|
2013-10-05 11:52:37 -04:00
|
|
|
*
|
2013-10-05 09:55:29 -04:00
|
|
|
* http://git.shaftnet.org/cgit/selphy_print.git
|
2013-10-05 11:52:37 -04:00
|
|
|
*
|
2013-10-05 09:55:29 -04:00
|
|
|
* 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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* [http://www.gnu.org/licenses/gpl-3.0.html]
|
|
|
|
*
|
2017-11-17 13:34:26 -05:00
|
|
|
* SPDX-License-Identifier: GPL-3.0+
|
|
|
|
*
|
2013-10-05 09:55:29 -04:00
|
|
|
*/
|
|
|
|
|
2019-09-28 11:05:42 -04:00
|
|
|
#define BACKEND mitsu70x_backend
|
2013-10-05 09:55:29 -04:00
|
|
|
|
2019-09-28 11:05:42 -04:00
|
|
|
#include "backend_common.h"
|
2013-10-05 09:55:29 -04:00
|
|
|
|
2016-10-05 10:40:10 -04:00
|
|
|
/* For Integration into gutenprint */
|
|
|
|
#if defined(HAVE_CONFIG_H)
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(USE_DLOPEN)
|
|
|
|
#define WITH_DYNAMIC
|
|
|
|
#include <dlfcn.h>
|
2017-07-10 20:15:56 -04:00
|
|
|
#define DL_INIT() do {} while(0)
|
2016-10-05 10:40:10 -04:00
|
|
|
#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
|
|
|
|
#define DL_SYM(__x, __y) dlsym(__x, __y)
|
|
|
|
#define DL_CLOSE(__x) dlclose(__x)
|
|
|
|
#define DL_EXIT() do {} while(0)
|
|
|
|
#elif defined(USE_LTDL)
|
|
|
|
#define WITH_DYNAMIC
|
|
|
|
#include <ltdl.h>
|
|
|
|
#define DL_INIT() lt_dlinit()
|
|
|
|
#define DL_OPEN(__x) lt_dlopen(__x)
|
|
|
|
#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
|
|
|
|
#define DL_CLOSE(__x) do {} while(0)
|
|
|
|
#define DL_EXIT() lt_dlexit()
|
|
|
|
#else
|
|
|
|
#define DL_INIT() do {} while(0)
|
|
|
|
#define DL_CLOSE(__x) do {} while(0)
|
|
|
|
#define DL_EXIT() do {} while(0)
|
|
|
|
#warning "No dynamic loading support!"
|
|
|
|
#endif
|
|
|
|
|
2016-10-06 08:20:52 -04:00
|
|
|
// #include "lib70x/libMitsuD70ImageReProcess.h"
|
|
|
|
|
|
|
|
#ifndef LUT_LEN
|
|
|
|
#define COLORCONV_RGB 0
|
|
|
|
#define COLORCONV_BGR 1
|
|
|
|
|
|
|
|
#define LUT_LEN 14739
|
|
|
|
struct BandImage {
|
|
|
|
void *imgbuf;
|
|
|
|
int32_t bytes_per_row;
|
|
|
|
uint16_t origin_cols;
|
|
|
|
uint16_t origin_rows;
|
|
|
|
uint16_t cols;
|
|
|
|
uint16_t rows;
|
|
|
|
};
|
|
|
|
#endif
|
2016-10-05 10:40:10 -04:00
|
|
|
|
2017-03-19 19:29:37 -04:00
|
|
|
#define REQUIRED_LIB_APIVERSION 4
|
2017-03-14 23:21:08 -04:00
|
|
|
|
2016-10-05 10:40:10 -04:00
|
|
|
/* Image processing library function prototypes */
|
|
|
|
#define LIB_NAME_RE "libMitsuD70ImageReProcess.so" // Reimplemented library
|
|
|
|
|
2017-03-14 23:21:08 -04:00
|
|
|
typedef int (*lib70x_getapiversionFN)(void);
|
2016-10-05 10:40:10 -04:00
|
|
|
typedef int (*Get3DColorTableFN)(uint8_t *buf, const char *filename);
|
|
|
|
typedef struct CColorConv3D *(*Load3DColorTableFN)(const uint8_t *ptr);
|
|
|
|
typedef void (*Destroy3DColorTableFN)(struct CColorConv3D *this);
|
|
|
|
typedef void (*DoColorConvFN)(struct CColorConv3D *this, uint8_t *data, uint16_t cols, uint16_t rows, uint32_t bytes_per_row, int rgb_bgr);
|
|
|
|
typedef struct CPCData *(*get_CPCDataFN)(const char *filename);
|
|
|
|
typedef void (*destroy_CPCDataFN)(struct CPCData *data);
|
2017-03-19 19:29:37 -04:00
|
|
|
typedef int (*do_image_effectFN)(struct CPCData *cpc, struct CPCData *ecpc, struct BandImage *input, struct BandImage *output, int sharpen, int reverse, uint8_t rew[2]);
|
2016-10-05 10:40:10 -04:00
|
|
|
typedef int (*send_image_dataFN)(struct BandImage *out, void *context,
|
|
|
|
int (*callback_fn)(void *context, void *buffer, uint32_t len));
|
|
|
|
|
|
|
|
#ifndef CORRTABLE_PATH
|
2016-10-06 08:25:30 -04:00
|
|
|
#ifdef PACKAGE_DATA_DIR
|
|
|
|
#define CORRTABLE_PATH PACKAGE_DATA_DIR "/backend_data"
|
|
|
|
#else
|
|
|
|
#error "Must define CORRTABLE_PATH or PACKAGE_DATA_DIR!"
|
|
|
|
#endif
|
2016-10-05 10:40:10 -04:00
|
|
|
#endif
|
|
|
|
|
2013-10-05 09:55:29 -04:00
|
|
|
#define USB_VID_MITSU 0x06D3
|
|
|
|
#define USB_PID_MITSU_D70X 0x3B30
|
2014-03-10 14:08:30 -04:00
|
|
|
#define USB_PID_MITSU_K60 0x3B31
|
2016-11-04 15:44:02 -04:00
|
|
|
#define USB_PID_MITSU_D80 0x3B36
|
2014-12-25 09:20:50 -05:00
|
|
|
#define USB_VID_KODAK 0x040a
|
|
|
|
#define USB_PID_KODAK305 0x404f
|
2017-09-09 08:00:14 -04:00
|
|
|
#define USB_VID_FUJIFILM 0x04cb
|
|
|
|
#define USB_PID_FUJI_ASK300 0x5006
|
2013-10-05 09:55:29 -04:00
|
|
|
|
2016-10-19 23:20:09 -04:00
|
|
|
/* Width of the laminate data file */
|
|
|
|
#define LAMINATE_STRIDE 1864
|
|
|
|
|
2017-02-16 08:07:20 -05:00
|
|
|
/* Max size of data chunk sent over */
|
|
|
|
#define CHUNK_LEN (256*1024)
|
|
|
|
|
2017-05-05 08:06:28 -04:00
|
|
|
/* Private data structure */
|
2018-06-15 14:55:03 -04:00
|
|
|
struct mitsu70x_printjob {
|
|
|
|
uint8_t *databuf;
|
|
|
|
int datalen;
|
|
|
|
|
2018-06-17 22:02:58 -04:00
|
|
|
uint8_t *spoolbuf;
|
|
|
|
int spoolbuflen;
|
|
|
|
|
2018-06-15 14:55:03 -04:00
|
|
|
uint16_t rows;
|
|
|
|
uint16_t cols;
|
2018-06-17 22:02:58 -04:00
|
|
|
uint32_t planelen;
|
2018-06-15 14:55:03 -04:00
|
|
|
uint32_t matte;
|
|
|
|
int raw_format;
|
|
|
|
int copies;
|
|
|
|
|
2018-09-18 10:23:55 -04:00
|
|
|
int decks_exact[2]; /* Media is exact match */
|
|
|
|
int decks_ok[2]; /* Media can be used */
|
|
|
|
|
2018-06-15 14:55:03 -04:00
|
|
|
/* These are used only for the image processing */
|
|
|
|
int sharpen; /* ie mhdr.sharpen - 1 */
|
|
|
|
int reverse;
|
|
|
|
|
|
|
|
char *laminatefname;
|
|
|
|
char *lutfname;
|
|
|
|
char *cpcfname;
|
|
|
|
char *ecpcfname;
|
|
|
|
};
|
|
|
|
|
2013-10-05 09:55:29 -04:00
|
|
|
struct mitsu70x_ctx {
|
|
|
|
struct libusb_device_handle *dev;
|
|
|
|
uint8_t endp_up;
|
|
|
|
uint8_t endp_down;
|
2015-08-12 22:56:29 -04:00
|
|
|
int type;
|
2013-10-05 09:55:29 -04:00
|
|
|
|
2018-06-15 14:55:03 -04:00
|
|
|
uint16_t jobid;
|
2014-10-03 20:30:09 -04:00
|
|
|
|
2018-04-27 15:40:09 -04:00
|
|
|
struct marker marker[2];
|
2018-06-19 14:00:35 -04:00
|
|
|
uint8_t medias[2];
|
2018-04-27 15:40:09 -04:00
|
|
|
|
|
|
|
uint16_t last_l;
|
|
|
|
uint16_t last_u;
|
2016-08-19 17:40:12 -04:00
|
|
|
int num_decks;
|
|
|
|
|
2016-10-05 10:40:10 -04:00
|
|
|
void *dl_handle;
|
2017-03-14 23:21:08 -04:00
|
|
|
lib70x_getapiversionFN GetAPIVersion;
|
2016-10-05 10:40:10 -04:00
|
|
|
Get3DColorTableFN Get3DColorTable;
|
|
|
|
Load3DColorTableFN Load3DColorTable;
|
|
|
|
Destroy3DColorTableFN Destroy3DColorTable;
|
|
|
|
DoColorConvFN DoColorConv;
|
|
|
|
get_CPCDataFN GetCPCData;
|
|
|
|
destroy_CPCDataFN DestroyCPCData;
|
2017-03-17 21:50:50 -04:00
|
|
|
do_image_effectFN DoImageEffect60;
|
|
|
|
do_image_effectFN DoImageEffect70;
|
|
|
|
do_image_effectFN DoImageEffect80;
|
2016-10-05 10:40:10 -04:00
|
|
|
do_image_effectFN DoImageEffect;
|
|
|
|
send_image_dataFN SendImageData;
|
|
|
|
|
2016-10-04 22:34:35 -04:00
|
|
|
struct CColorConv3D *lut;
|
|
|
|
struct CPCData *cpcdata;
|
2017-03-17 21:50:50 -04:00
|
|
|
struct CPCData *ecpcdata;
|
2016-09-13 20:58:16 -04:00
|
|
|
|
|
|
|
char *last_cpcfname;
|
2017-03-17 21:50:50 -04:00
|
|
|
char *last_ecpcfname;
|
2016-09-10 15:34:39 -04:00
|
|
|
|
2016-10-04 09:58:25 -04:00
|
|
|
struct BandImage output;
|
2013-10-05 09:55:29 -04:00
|
|
|
};
|
|
|
|
|
2014-09-19 20:39:04 -04:00
|
|
|
/* Printer data structures */
|
2015-12-25 16:21:06 -05:00
|
|
|
struct mitsu70x_jobstatus {
|
2016-09-21 07:02:09 -04:00
|
|
|
uint8_t hdr[4]; /* E4 56 31 30 */
|
|
|
|
uint16_t jobid; /* BE */
|
|
|
|
uint16_t mecha_no; /* BE */
|
2015-12-25 16:21:06 -05:00
|
|
|
uint8_t job_status[4];
|
|
|
|
uint8_t memory;
|
|
|
|
uint8_t power;
|
|
|
|
uint8_t mecha_status[2];
|
|
|
|
uint8_t temperature;
|
|
|
|
uint8_t error_status[3];
|
2018-08-27 12:15:08 -04:00
|
|
|
uint8_t mecha_status_up[2];
|
|
|
|
uint8_t temperature_up;
|
|
|
|
uint8_t error_status_up[3];
|
2014-10-03 20:35:05 -04:00
|
|
|
} __attribute__((packed));
|
2014-12-29 14:21:39 -05:00
|
|
|
|
2016-11-16 22:05:03 -05:00
|
|
|
struct mitsu70x_job {
|
|
|
|
uint16_t id; /* BE */
|
|
|
|
uint8_t status[4];
|
2016-12-15 09:37:31 -05:00
|
|
|
} __attribute__((packed));
|
2016-11-16 22:05:03 -05:00
|
|
|
|
|
|
|
#define NUM_JOBS 170
|
|
|
|
|
2015-12-25 17:48:55 -05:00
|
|
|
struct mitsu70x_jobs {
|
2016-09-21 07:02:09 -04:00
|
|
|
uint8_t hdr[4]; /* E4 56 31 31 */
|
2016-11-16 22:05:03 -05:00
|
|
|
struct mitsu70x_job jobs[NUM_JOBS];
|
2015-12-25 17:48:55 -05:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
2015-12-25 16:21:06 -05:00
|
|
|
#define TEMPERATURE_NORMAL 0x00
|
|
|
|
#define TEMPERATURE_PREHEAT 0x40
|
|
|
|
#define TEMPERATURE_COOLING 0x80
|
|
|
|
|
|
|
|
#define MECHA_STATUS_INIT 0x80
|
|
|
|
#define MECHA_STATUS_FEED 0x50
|
|
|
|
#define MECHA_STATUS_LOAD 0x40
|
2017-03-17 21:48:28 -04:00
|
|
|
#define MECHA_STATUS_LOAD2 0x30
|
2015-12-25 16:21:06 -05:00
|
|
|
#define MECHA_STATUS_PRINT 0x20
|
|
|
|
#define MECHA_STATUS_IDLE 0x00
|
|
|
|
|
|
|
|
#define JOB_STATUS0_NONE 0x00
|
|
|
|
#define JOB_STATUS0_DATA 0x10
|
|
|
|
#define JOB_STATUS0_QUEUE 0x20
|
|
|
|
#define JOB_STATUS0_PRINT 0x50
|
|
|
|
#define JOB_STATUS0_ASSIGN 0x70 // XXX undefined.
|
|
|
|
#define JOB_STATUS0_END 0x80
|
|
|
|
|
|
|
|
#define JOB_STATUS1_PRINT_MEDIALOAD 0x10
|
|
|
|
#define JOB_STATUS1_PRINT_PRE_Y 0x20
|
|
|
|
#define JOB_STATUS1_PRINT_Y 0x30
|
|
|
|
#define JOB_STATUS1_PRINT_PRE_M 0x40
|
|
|
|
#define JOB_STATUS1_PRINT_M 0x50
|
|
|
|
#define JOB_STATUS1_PRINT_PRE_C 0x60
|
|
|
|
#define JOB_STATUS1_PRINT_C 0x70
|
|
|
|
#define JOB_STATUS1_PRINT_PRE_OC 0x80
|
|
|
|
#define JOB_STATUS1_PRINT_OC 0x90
|
|
|
|
#define JOB_STATUS1_PRINT_EJECT 0xA0
|
|
|
|
|
|
|
|
#define JOB_STATUS1_END_OK 0x00
|
|
|
|
#define JOB_STATUS1_END_MECHA 0x10 // 0x10...0x7f
|
|
|
|
#define JOB_STATUS1_END_HEADER 0x80
|
|
|
|
#define JOB_STATUS1_END_PRINT 0x90
|
|
|
|
#define JOB_STATUS1_END_INTERRUPT 0xA0
|
|
|
|
|
|
|
|
#define JOB_STATUS2_END_HEADER_ERROR 0x00
|
|
|
|
#define JOB_STATUS2_END_HEADER_MEMORY 0x10
|
|
|
|
#define JOB_STATUS2_END_PRINT_MEDIA 0x00
|
|
|
|
#define JOB_STATUS2_END_PRINT_PREVERR 0x10
|
|
|
|
#define JOB_STATUS2_END_INT_TIMEOUT 0x00
|
|
|
|
#define JOB_STATUS2_END_INT_CANCEL 0x10
|
|
|
|
#define JOB_STATUS2_END_INT_DISCON 0x20
|
|
|
|
|
|
|
|
/* Error codes */
|
|
|
|
#define ERROR_STATUS0_NOSTRIPBIN 0x01
|
|
|
|
#define ERROR_STATUS0_NORIBBON 0x02
|
|
|
|
#define ERROR_STATUS0_NOPAPER 0x03
|
|
|
|
#define ERROR_STATUS0_MEDIAMISMATCH 0x04
|
|
|
|
#define ERROR_STATUS0_RIBBONCNTEND 0x05
|
|
|
|
#define ERROR_STATUS0_BADRIBBON 0x06
|
|
|
|
#define ERROR_STATUS0_BADJOBPARAM 0x07
|
|
|
|
#define ERROR_STATUS0_PAPEREND 0x08
|
|
|
|
#define ERROR_STATUS0_RIBBONEND 0x09
|
|
|
|
#define ERROR_STATUS0_DOOROPEN_IDLE 0x0A
|
|
|
|
#define ERROR_STATUS0_DOOROPEN_PRNT 0x0B
|
2017-03-17 21:48:28 -04:00
|
|
|
#define ERROR_STATUS0_POWEROFF 0x0C // Powered off during printing..?
|
2015-12-25 16:21:06 -05:00
|
|
|
#define ERROR_STATUS0_NOMCOP 0x0D
|
|
|
|
#define ERROR_STATUS0_RIBBONSKIP1 0x0E
|
|
|
|
#define ERROR_STATUS0_RIBBONSKIP2 0x0F
|
|
|
|
#define ERROR_STATUS0_RIBBONJAM 0x10
|
|
|
|
#define ERROR_STATUS0_RIBBON_OTHER 0x11 // 0x11->0x1F
|
|
|
|
#define ERROR_STATUS0_PAPER_JAM 0x20 // 0x20->0x2F
|
|
|
|
#define ERROR_STATUS0_MECHANICAL 0x30 // 0x30->0x39
|
|
|
|
#define ERROR_STATUS0_RFID 0x3A
|
|
|
|
#define ERROR_STATUS0_FLASH 0x3B
|
|
|
|
#define ERROR_STATUS0_EEPROM 0x3C
|
|
|
|
#define ERROR_STATUS0_PREHEAT 0x3D
|
|
|
|
#define ERROR_STATUS0_MDASTATE 0x3E
|
|
|
|
#define ERROR_STATUS0_PSUFANLOCKED 0x3F
|
|
|
|
#define ERROR_STATUS0_OTHERS 0x40 // 0x40..?
|
|
|
|
|
|
|
|
/* Error classifications */
|
|
|
|
#define ERROR_STATUS1_PAPER 0x01
|
|
|
|
#define ERROR_STATUS1_RIBBON 0x02
|
|
|
|
#define ERROR_STATUS1_SETTING 0x03
|
|
|
|
#define ERROR_STATUS1_OPEN 0x05
|
|
|
|
#define ERROR_STATUS1_NOSTRIPBIN 0x06
|
|
|
|
#define ERROR_STATUS1_PAPERJAM 0x07
|
|
|
|
#define ERROR_STATUS1_RIBBONSYS 0x08
|
|
|
|
#define ERROR_STATUS1_MECHANICAL 0x09
|
|
|
|
#define ERROR_STATUS1_ELECTRICAL 0x0A
|
|
|
|
#define ERROR_STATUS1_FIRMWARE 0x0E
|
|
|
|
#define ERROR_STATUS1_OTHER 0x0F
|
|
|
|
|
|
|
|
/* Error recovery conditions */
|
|
|
|
#define ERROR_STATUS2_AUTO 0x00
|
|
|
|
#define ERROR_STATUS2_RELOAD_PAPER 0x01
|
|
|
|
#define ERROR_STATUS2_RELOAD_RIBBON 0x02
|
|
|
|
#define ERROR_STATUS2_CHANGE_BOTH 0x03
|
|
|
|
#define ERROR_STATUS2_CHANGE_ONE 0x04
|
|
|
|
#define ERROR_STATUS2_CLOSEUNIT 0x05
|
|
|
|
#define ERROR_STATUS2_ATTACHSTRIPBIN 0x06
|
|
|
|
#define ERROR_STATUS2_CLEARJAM 0x07
|
|
|
|
#define ERROR_STATUS2_CHECKRIBBON 0x08
|
|
|
|
#define ERROR_STATUS2_OPENCLOSEUNIT 0x0A
|
|
|
|
#define ERROR_STATUS2_POWEROFF 0x0F
|
|
|
|
|
2014-09-19 20:39:04 -04:00
|
|
|
struct mitsu70x_status_deck {
|
2015-12-25 16:21:06 -05:00
|
|
|
uint8_t mecha_status[2];
|
2017-04-26 10:06:13 -04:00
|
|
|
uint8_t temperature; /* D70/D80 family only, K60 no? */
|
2015-12-25 16:21:06 -05:00
|
|
|
uint8_t error_status[3];
|
2018-09-18 19:57:18 -04:00
|
|
|
uint8_t rsvd_a[10]; /* K60 [1] == temperature? All: [3:6] == some counter in BCD. K60 [9] == ?? */
|
2015-12-25 16:21:06 -05:00
|
|
|
uint8_t media_brand;
|
|
|
|
uint8_t media_type;
|
|
|
|
uint8_t rsvd_b[2];
|
2018-10-18 10:57:57 -04:00
|
|
|
int16_t capacity; /* media capacity */
|
|
|
|
int16_t remain; /* media remaining */
|
2015-12-25 16:21:06 -05:00
|
|
|
uint8_t rsvd_c[2];
|
2016-10-31 19:32:38 -04:00
|
|
|
uint8_t lifetime_prints[4]; /* lifetime prints on deck + 10, in BCD! */
|
2018-09-19 14:40:06 -04:00
|
|
|
uint8_t rsvd_d[2]; // Unknown
|
2018-09-18 19:57:18 -04:00
|
|
|
uint16_t rsvd_e[16]; /* all 80 00 */
|
2014-12-29 14:21:39 -05:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct mitsu70x_status_ver {
|
2016-12-02 18:57:54 -05:00
|
|
|
char ver[6];
|
2015-09-13 11:34:22 -04:00
|
|
|
uint16_t checksum; /* Presumably BE */
|
2014-10-03 20:35:05 -04:00
|
|
|
} __attribute__((packed));
|
2014-12-29 14:21:39 -05:00
|
|
|
|
2015-12-25 17:40:27 -05:00
|
|
|
struct mitsu70x_printerstatus_resp {
|
2018-09-18 19:57:18 -04:00
|
|
|
uint8_t hdr[4]; /* E4 56 32 30 */
|
2016-09-21 07:02:09 -04:00
|
|
|
uint8_t memory;
|
|
|
|
uint8_t power;
|
2017-03-18 20:50:54 -04:00
|
|
|
uint8_t unk[20];
|
2017-05-22 23:53:02 -04:00
|
|
|
uint8_t sleeptime; /* In minutes, 0-60 */
|
2017-03-18 21:45:05 -04:00
|
|
|
uint8_t iserial; /* 0x00 for Enabled, 0x80 for Disabled */
|
2018-09-19 14:40:06 -04:00
|
|
|
uint8_t unk_b[5]; // [4] == 0x44 on D70x, 0x02 on D80
|
|
|
|
uint8_t dual_deck; /* 0x80 for dual-deck D707 */
|
|
|
|
uint8_t unk_c[6]; // [3] == 0x5f on D70x, 0x01 on D80. [5] == 0xbd on D70x, 0x87 on D80
|
2014-12-29 14:21:39 -05:00
|
|
|
int16_t model[6]; /* LE, UTF-16 */
|
|
|
|
int16_t serno[6]; /* LE, UTF-16 */
|
2016-12-02 08:51:51 -05:00
|
|
|
struct mitsu70x_status_ver vers[7]; // components are 'MLRTF'
|
2017-03-19 14:46:36 -04:00
|
|
|
uint8_t null[2];
|
2019-10-28 20:32:09 -04:00
|
|
|
uint8_t user_serno[6]; /* XXX Supposedly. Don't know how to set it! */
|
2014-09-19 20:39:04 -04:00
|
|
|
struct mitsu70x_status_deck lower;
|
|
|
|
struct mitsu70x_status_deck upper;
|
2014-10-03 20:35:05 -04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
2015-12-25 16:21:06 -05:00
|
|
|
struct mitsu70x_memorystatus_resp {
|
2016-09-21 07:02:09 -04:00
|
|
|
uint8_t hdr[3]; /* E4 56 33 */
|
2015-12-25 16:21:06 -05:00
|
|
|
uint8_t memory;
|
|
|
|
uint8_t size;
|
|
|
|
uint8_t rsvd;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2017-07-10 20:15:56 -04:00
|
|
|
// XXX also seen commands 0x67, 0x72, 0x54, 0x6e
|
2016-10-19 22:04:58 -04:00
|
|
|
|
2014-10-03 20:35:05 -04:00
|
|
|
struct mitsu70x_hdr {
|
2016-10-19 22:04:58 -04:00
|
|
|
uint8_t hdr[4]; /* 1b 5a 54 XX */ // XXX also, seen 1b 5a 43!
|
2015-12-25 16:21:06 -05:00
|
|
|
uint16_t jobid;
|
2017-04-26 10:06:13 -04:00
|
|
|
uint8_t rewind[2]; /* K60/EK305/D80 only */
|
2016-10-19 21:04:25 -04:00
|
|
|
uint8_t zero0[8];
|
2014-10-03 20:35:05 -04:00
|
|
|
|
|
|
|
uint16_t cols;
|
|
|
|
uint16_t rows;
|
|
|
|
uint16_t lamcols;
|
|
|
|
uint16_t lamrows;
|
2016-01-18 11:34:58 -05:00
|
|
|
uint8_t speed;
|
2014-10-03 20:35:05 -04:00
|
|
|
uint8_t zero1[7];
|
|
|
|
|
2017-04-26 10:06:13 -04:00
|
|
|
uint8_t deck; /* 0 = default, 1 = lower, 2 = upper -- Non-D70/D707 is always '1' */
|
2014-10-03 20:35:05 -04:00
|
|
|
uint8_t zero2[7];
|
2015-12-28 11:29:31 -05:00
|
|
|
uint8_t laminate; /* 00 == on, 01 == off */
|
2016-10-09 08:59:21 -04:00
|
|
|
uint8_t laminate_mode; /* 00 == glossy, 02 == matte */
|
2015-12-28 11:29:31 -05:00
|
|
|
uint8_t zero3[6];
|
2014-10-03 20:35:05 -04:00
|
|
|
|
|
|
|
uint8_t multicut;
|
2017-04-26 10:06:13 -04:00
|
|
|
uint8_t zero4[12]; /* NOTE: everything past this point is an extension */
|
2016-10-04 09:58:25 -04:00
|
|
|
uint8_t sharpen; /* 0-9. 5 is "normal", 0 is "off" */
|
2016-09-10 15:34:39 -04:00
|
|
|
uint8_t mode; /* 0 for cooked YMC planar, 1 for packed BGR */
|
|
|
|
uint8_t use_lut; /* in BGR mode, 0 disables, 1 enables */
|
2017-03-19 19:29:37 -04:00
|
|
|
uint8_t reversed; /* 1 tells the backend the row data is correct */
|
|
|
|
uint8_t pad[447];
|
2014-10-03 20:35:05 -04:00
|
|
|
} __attribute__((packed));
|
2014-09-19 20:39:04 -04:00
|
|
|
|
2017-12-07 10:26:55 -05:00
|
|
|
static int mitsu70x_get_printerstatus(struct mitsu70x_ctx *ctx, struct mitsu70x_printerstatus_resp *resp);
|
2018-06-19 09:04:17 -04:00
|
|
|
static int mitsu70x_main_loop(void *vctx, const void *vjob);
|
2017-12-07 10:26:55 -05:00
|
|
|
|
2016-01-18 11:34:58 -05:00
|
|
|
/* Error dumps, etc */
|
|
|
|
|
2018-05-17 15:08:28 -04:00
|
|
|
const char *mitsu70x_temperatures(uint8_t temp)
|
2017-12-07 13:54:30 -05:00
|
|
|
{
|
|
|
|
switch(temp) {
|
|
|
|
case TEMPERATURE_NORMAL:
|
|
|
|
return "Normal";
|
|
|
|
case TEMPERATURE_PREHEAT:
|
|
|
|
return "Warming Up";
|
|
|
|
case TEMPERATURE_COOLING:
|
|
|
|
return "Cooling Down";
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "Unknown Temperature Status";
|
|
|
|
}
|
|
|
|
|
2018-05-17 15:08:28 -04:00
|
|
|
static const char *mitsu70x_mechastatus(uint8_t *sts)
|
2015-12-25 23:27:35 -05:00
|
|
|
{
|
|
|
|
switch(sts[0]) {
|
|
|
|
case MECHA_STATUS_INIT:
|
|
|
|
return "Initializing";
|
|
|
|
case MECHA_STATUS_FEED:
|
|
|
|
return "Paper Feeding/Cutting";
|
|
|
|
case MECHA_STATUS_LOAD:
|
2017-03-17 21:48:28 -04:00
|
|
|
case MECHA_STATUS_LOAD2:
|
2015-12-25 23:27:35 -05:00
|
|
|
return "Media Loading";
|
|
|
|
case MECHA_STATUS_PRINT:
|
|
|
|
return "Printing";
|
|
|
|
case MECHA_STATUS_IDLE:
|
|
|
|
return "Idle";
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "Unknown Mechanical Status";
|
|
|
|
}
|
|
|
|
|
2018-05-17 20:19:16 -04:00
|
|
|
static const char *mitsu70x_jobstatuses(uint8_t *sts)
|
2015-12-25 16:21:06 -05:00
|
|
|
{
|
|
|
|
switch(sts[0]) {
|
|
|
|
case JOB_STATUS0_NONE:
|
|
|
|
return "No Job";
|
|
|
|
case JOB_STATUS0_DATA:
|
|
|
|
return "Data transfer";
|
|
|
|
case JOB_STATUS0_QUEUE:
|
|
|
|
return "Queued for printing";
|
2017-07-10 20:15:56 -04:00
|
|
|
case JOB_STATUS0_PRINT:
|
2015-12-25 16:21:06 -05:00
|
|
|
switch(sts[1]) {
|
|
|
|
case JOB_STATUS1_PRINT_MEDIALOAD:
|
2016-08-31 21:45:29 -04:00
|
|
|
return "Media loading";
|
2015-12-25 16:21:06 -05:00
|
|
|
case JOB_STATUS1_PRINT_PRE_Y:
|
|
|
|
return "Waiting to print yellow plane";
|
|
|
|
case JOB_STATUS1_PRINT_Y:
|
2017-07-10 20:15:56 -04:00
|
|
|
return "Printing yellow plane";
|
2015-12-25 16:21:06 -05:00
|
|
|
case JOB_STATUS1_PRINT_PRE_M:
|
|
|
|
return "Waiting to print magenta plane";
|
|
|
|
case JOB_STATUS1_PRINT_M:
|
|
|
|
return "Printing magenta plane";
|
|
|
|
case JOB_STATUS1_PRINT_PRE_C:
|
|
|
|
return "Waiting to print cyan plane";
|
|
|
|
case JOB_STATUS1_PRINT_C:
|
|
|
|
return "Printing cyan plane";
|
|
|
|
case JOB_STATUS1_PRINT_PRE_OC:
|
|
|
|
return "Waiting to laminate page";
|
|
|
|
case JOB_STATUS1_PRINT_OC:
|
|
|
|
return "Laminating page";
|
|
|
|
case JOB_STATUS1_PRINT_EJECT:
|
|
|
|
return "Ejecting page";
|
|
|
|
default:
|
2016-09-01 03:18:18 -04:00
|
|
|
return "Unknown 'Print' status1";
|
2015-12-25 16:21:06 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case JOB_STATUS0_ASSIGN:
|
2016-09-01 03:18:18 -04:00
|
|
|
return "Unknown 'Assignment' status1";
|
2015-12-25 16:21:06 -05:00
|
|
|
case JOB_STATUS0_END:
|
|
|
|
switch(sts[1]) {
|
|
|
|
case JOB_STATUS1_END_OK:
|
|
|
|
return "Normal End";
|
|
|
|
case JOB_STATUS1_END_HEADER:
|
2017-09-09 08:01:01 -04:00
|
|
|
switch(sts[2]) {
|
|
|
|
case JOB_STATUS2_END_HEADER_ERROR:
|
|
|
|
return "Incorrect Header data (bad print size?)";
|
|
|
|
case JOB_STATUS2_END_HEADER_MEMORY:
|
|
|
|
return "Insufficient printer memory";
|
|
|
|
default:
|
|
|
|
return "Unknown 'End Header' status2";
|
|
|
|
}
|
2017-11-06 14:36:32 -05:00
|
|
|
break;
|
2015-12-25 16:21:06 -05:00
|
|
|
case JOB_STATUS1_END_PRINT:
|
|
|
|
switch(sts[2]) {
|
|
|
|
case JOB_STATUS2_END_PRINT_MEDIA:
|
|
|
|
return "Incorrect mediasize";
|
|
|
|
case JOB_STATUS2_END_PRINT_PREVERR:
|
|
|
|
return "Previous job terminated abnormally";
|
|
|
|
default:
|
|
|
|
return "Unknown 'End Print' status2";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case JOB_STATUS1_END_INTERRUPT:
|
|
|
|
switch(sts[2]) {
|
|
|
|
case JOB_STATUS2_END_INT_TIMEOUT:
|
|
|
|
return "Timeout";
|
|
|
|
case JOB_STATUS2_END_INT_CANCEL:
|
|
|
|
return "Job cancelled";
|
|
|
|
case JOB_STATUS2_END_INT_DISCON:
|
|
|
|
return "Printer disconnected";
|
|
|
|
default:
|
|
|
|
return "Unknown 'End Print' status2";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (sts[1] >= 0x10 && sts[1] <= 0x7f)
|
|
|
|
return "Mechanical Error";
|
|
|
|
else
|
|
|
|
return "Unknown 'End' status1";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown status0";
|
|
|
|
}
|
|
|
|
|
2018-05-17 20:19:16 -04:00
|
|
|
static const char *mitsu70x_errorclass(uint8_t *err)
|
2015-12-25 17:23:48 -05:00
|
|
|
{
|
|
|
|
switch(err[1]) {
|
|
|
|
case ERROR_STATUS1_PAPER:
|
|
|
|
return "Paper";
|
|
|
|
case ERROR_STATUS1_RIBBON:
|
|
|
|
return "Ribbon";
|
|
|
|
case ERROR_STATUS1_SETTING:
|
|
|
|
return "Job settings";
|
|
|
|
case ERROR_STATUS1_OPEN:
|
|
|
|
return "Cover open";
|
|
|
|
case ERROR_STATUS1_NOSTRIPBIN:
|
|
|
|
return "No cut bin";
|
|
|
|
case ERROR_STATUS1_PAPERJAM:
|
|
|
|
return "Paper jam";
|
|
|
|
case ERROR_STATUS1_RIBBONSYS:
|
|
|
|
return "Ribbon system";
|
|
|
|
case ERROR_STATUS1_MECHANICAL:
|
|
|
|
return "Mechanical";
|
|
|
|
case ERROR_STATUS1_ELECTRICAL:
|
|
|
|
return "Electrical";
|
|
|
|
case ERROR_STATUS1_FIRMWARE:
|
|
|
|
return "Firmware";
|
|
|
|
case ERROR_STATUS1_OTHER:
|
|
|
|
return "Other";
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "Unknown error class";
|
|
|
|
}
|
|
|
|
|
2018-05-17 20:19:16 -04:00
|
|
|
static const char *mitsu70x_errorrecovery(uint8_t *err)
|
2015-12-25 17:23:48 -05:00
|
|
|
{
|
|
|
|
switch(err[1]) {
|
|
|
|
case ERROR_STATUS2_AUTO:
|
|
|
|
return "Automatic recovery";
|
|
|
|
case ERROR_STATUS2_RELOAD_PAPER:
|
|
|
|
return "Reload or change paper";
|
|
|
|
case ERROR_STATUS2_RELOAD_RIBBON:
|
|
|
|
return "Reload or change ribbon";
|
|
|
|
case ERROR_STATUS2_CHANGE_BOTH:
|
|
|
|
return "Change paper and ribbon";
|
|
|
|
case ERROR_STATUS2_CHANGE_ONE:
|
|
|
|
return "Change paper or ribbon";
|
|
|
|
case ERROR_STATUS2_CLOSEUNIT:
|
|
|
|
return "Close printer";
|
|
|
|
case ERROR_STATUS2_ATTACHSTRIPBIN:
|
|
|
|
return "Attach Strip Bin";
|
|
|
|
case ERROR_STATUS2_CLEARJAM:
|
|
|
|
return "Remove and reload paper";
|
|
|
|
case ERROR_STATUS2_CHECKRIBBON:
|
|
|
|
return "Check ribbon and reload paper";
|
|
|
|
case ERROR_STATUS2_OPENCLOSEUNIT:
|
|
|
|
return "Open then close printer";
|
|
|
|
case ERROR_STATUS2_POWEROFF:
|
|
|
|
return "Power-cycle printer";
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "Unknown recovery";
|
|
|
|
}
|
|
|
|
|
2018-05-17 20:19:16 -04:00
|
|
|
static const char *mitsu70x_errors(uint8_t *err)
|
2015-12-25 17:23:48 -05:00
|
|
|
{
|
|
|
|
switch(err[0]) {
|
|
|
|
case ERROR_STATUS0_NOSTRIPBIN:
|
|
|
|
return "Strip bin not attached";
|
|
|
|
case ERROR_STATUS0_NORIBBON:
|
|
|
|
return "No ribbon detected";
|
|
|
|
case ERROR_STATUS0_NOPAPER:
|
|
|
|
return "No paper loaded";
|
|
|
|
case ERROR_STATUS0_MEDIAMISMATCH:
|
|
|
|
return "Ribbon/Paper mismatch";
|
|
|
|
case ERROR_STATUS0_RIBBONCNTEND:
|
|
|
|
return "Ribbon count end";
|
|
|
|
case ERROR_STATUS0_BADRIBBON:
|
|
|
|
return "Illegal Ribbon";
|
|
|
|
case ERROR_STATUS0_BADJOBPARAM:
|
|
|
|
return "Job does not match loaded media";
|
|
|
|
case ERROR_STATUS0_PAPEREND:
|
|
|
|
return "End of paper detected";
|
|
|
|
case ERROR_STATUS0_RIBBONEND:
|
|
|
|
return "End of ribbon detected";
|
|
|
|
case ERROR_STATUS0_DOOROPEN_IDLE:
|
|
|
|
case ERROR_STATUS0_DOOROPEN_PRNT:
|
|
|
|
return "Printer door open";
|
|
|
|
case ERROR_STATUS0_POWEROFF:
|
|
|
|
return "Printer powered off"; // nonsense..
|
|
|
|
case ERROR_STATUS0_RIBBONSKIP1:
|
|
|
|
case ERROR_STATUS0_RIBBONSKIP2:
|
|
|
|
return "Ribbon skipped";
|
|
|
|
case ERROR_STATUS0_RIBBONJAM:
|
|
|
|
return "Ribbon stuck to paper";
|
|
|
|
case ERROR_STATUS0_RFID:
|
|
|
|
return "RFID read error";
|
|
|
|
case ERROR_STATUS0_FLASH:
|
|
|
|
return "FLASH read error";
|
|
|
|
case ERROR_STATUS0_EEPROM:
|
|
|
|
return "EEPROM read error";
|
|
|
|
case ERROR_STATUS0_PREHEAT:
|
|
|
|
return "Preheating unit time out";
|
|
|
|
case ERROR_STATUS0_MDASTATE:
|
|
|
|
return "Unknown MDA state";
|
|
|
|
case ERROR_STATUS0_PSUFANLOCKED:
|
|
|
|
return "Power supply fan locked up";
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (err[0] >= ERROR_STATUS0_RIBBON_OTHER &&
|
|
|
|
err[0] < ERROR_STATUS0_PAPER_JAM) {
|
|
|
|
return "Unknown ribbon error";
|
|
|
|
// XXX use err[1]/err[2] codes?
|
|
|
|
}
|
|
|
|
if (err[0] >= ERROR_STATUS0_PAPER_JAM &&
|
|
|
|
err[0] < ERROR_STATUS0_MECHANICAL) {
|
|
|
|
return "Paper jam";
|
|
|
|
// XXX use err[1]/err[2] codes?
|
|
|
|
}
|
|
|
|
if (err[0] >= ERROR_STATUS0_MECHANICAL &&
|
|
|
|
err[0] < ERROR_STATUS0_RFID) {
|
|
|
|
return "Unknown mechanical error";
|
|
|
|
// XXX use err[1]/err[2] codes?
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown error";
|
|
|
|
}
|
2015-12-25 16:21:06 -05:00
|
|
|
|
2018-05-11 16:23:43 -04:00
|
|
|
const char *mitsu70x_media_types(uint8_t brand, uint8_t type)
|
2016-08-19 17:40:12 -04:00
|
|
|
{
|
2016-11-03 09:54:28 -04:00
|
|
|
if (brand == 0xff && type == 0x01)
|
|
|
|
return "CK-D735 (3.5x5)";
|
|
|
|
else if (brand == 0xff && type == 0x02)
|
|
|
|
return "CK-D746 (4x6)";
|
|
|
|
else if (brand == 0xff && type == 0x04)
|
|
|
|
return "CK-D757 (5x7)";
|
|
|
|
else if (brand == 0xff && type == 0x05)
|
|
|
|
return "CK-D769 (6x9)";
|
2016-08-19 17:40:12 -04:00
|
|
|
else if (brand == 0xff && type == 0x0f)
|
2017-05-22 23:53:02 -04:00
|
|
|
return "CK-D768/CK-D868 (6x8)";
|
2016-11-03 09:54:28 -04:00
|
|
|
else if (brand == 0x6c && type == 0x84)
|
|
|
|
return "Kodak 5R (5x7)";
|
2016-08-19 17:40:12 -04:00
|
|
|
else if (brand == 0x6c && type == 0x8f)
|
2016-08-31 21:45:29 -04:00
|
|
|
return "Kodak 6R (6x8)";
|
2016-11-03 09:54:28 -04:00
|
|
|
else if (brand == 0x61 && type == 0x84)
|
|
|
|
return "CK-K57R (5x7)";
|
2016-08-31 21:45:29 -04:00
|
|
|
else if (brand == 0x61 && type == 0x8f)
|
2016-11-03 09:54:28 -04:00
|
|
|
return "CK-K76R (6x8)";
|
2017-09-22 20:25:29 -04:00
|
|
|
else if (brand == 0x7a && type == 0x01)
|
2017-09-19 06:28:58 -04:00
|
|
|
return "RL-CF900 (3.5x5)";
|
|
|
|
else if (brand == 0x7a && type == 0x02)
|
|
|
|
return "RK-CF800/4R (4x6)";
|
|
|
|
else if (brand == 0x7a && type == 0x04)
|
|
|
|
return "R2L-CF460/5R (5x7)";
|
|
|
|
else if (brand == 0x7a && type == 0x0f)
|
|
|
|
return "R68-CF400/6R (6x8)";
|
2016-08-19 17:40:12 -04:00
|
|
|
else
|
|
|
|
return "Unknown";
|
2017-03-01 15:40:11 -05:00
|
|
|
|
|
|
|
// Also CK-D715, CK-D718, CK-D720, CK-D723 (4x6,5x8,6x8,6x9) for D70-S model
|
|
|
|
// CK-D746-U for D70-U model
|
|
|
|
// CK-D820 (6x8) for D80-S model
|
2017-05-22 23:53:02 -04:00
|
|
|
// D90 can use _all_ of these types except for the -U!
|
2017-03-01 15:40:11 -05:00
|
|
|
|
2016-08-19 17:40:12 -04:00
|
|
|
}
|
|
|
|
|
2014-10-03 20:30:09 -04:00
|
|
|
#define CMDBUF_LEN 512
|
|
|
|
#define READBACK_LEN 256
|
|
|
|
|
2013-10-05 09:55:29 -04:00
|
|
|
static void *mitsu70x_init(void)
|
|
|
|
{
|
|
|
|
struct mitsu70x_ctx *ctx = malloc(sizeof(struct mitsu70x_ctx));
|
2015-06-23 20:32:41 -04:00
|
|
|
if (!ctx) {
|
|
|
|
ERROR("Memory Allocation Failure!\n");
|
2013-10-05 09:55:29 -04:00
|
|
|
return NULL;
|
2015-06-23 20:32:41 -04:00
|
|
|
}
|
2013-10-05 09:55:29 -04:00
|
|
|
memset(ctx, 0, sizeof(struct mitsu70x_ctx));
|
|
|
|
|
2016-10-05 10:40:10 -04:00
|
|
|
DL_INIT();
|
|
|
|
|
2013-10-05 09:55:29 -04:00
|
|
|
return ctx;
|
|
|
|
}
|
|
|
|
|
2018-05-09 23:09:01 -04:00
|
|
|
static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int type,
|
2018-04-27 15:07:43 -04:00
|
|
|
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
2013-10-05 09:55:29 -04:00
|
|
|
{
|
|
|
|
struct mitsu70x_ctx *ctx = vctx;
|
|
|
|
|
2015-12-25 16:21:06 -05:00
|
|
|
ctx->jobid = jobid;
|
2016-01-15 08:24:23 -05:00
|
|
|
if (!ctx->jobid)
|
|
|
|
jobid++;
|
2013-11-23 19:51:55 -05:00
|
|
|
|
2013-10-05 11:52:37 -04:00
|
|
|
ctx->dev = dev;
|
2013-10-05 09:55:29 -04:00
|
|
|
ctx->endp_up = endp_up;
|
|
|
|
ctx->endp_down = endp_down;
|
2018-05-09 23:09:01 -04:00
|
|
|
ctx->type = type;
|
2016-08-19 17:40:12 -04:00
|
|
|
|
2018-04-27 15:40:09 -04:00
|
|
|
ctx->last_l = ctx->last_u = 65535;
|
2016-09-21 07:02:09 -04:00
|
|
|
|
2016-10-05 10:40:10 -04:00
|
|
|
/* Attempt to open the library */
|
|
|
|
#if defined(WITH_DYNAMIC)
|
2017-03-17 00:05:15 -04:00
|
|
|
DEBUG("Attempting to load image processing library\n");
|
2016-10-05 10:40:10 -04:00
|
|
|
ctx->dl_handle = DL_OPEN(LIB_NAME_RE);
|
|
|
|
if (!ctx->dl_handle)
|
|
|
|
WARNING("Image processing library not found, using internal fallback code\n");
|
|
|
|
if (ctx->dl_handle) {
|
2017-03-14 23:21:08 -04:00
|
|
|
ctx->GetAPIVersion = DL_SYM(ctx->dl_handle, "lib70x_getapiversion");
|
|
|
|
if (!ctx->GetAPIVersion) {
|
2017-03-17 21:50:50 -04:00
|
|
|
ERROR("Problem resolving API Version symbol in imaging processing library, too old or not installed?\n");
|
2017-03-14 23:21:08 -04:00
|
|
|
DL_CLOSE(ctx->dl_handle);
|
|
|
|
ctx->dl_handle = NULL;
|
2018-04-27 15:07:43 -04:00
|
|
|
return CUPS_BACKEND_FAILED;
|
2017-03-14 23:21:08 -04:00
|
|
|
}
|
2017-03-17 21:50:50 -04:00
|
|
|
if (ctx->GetAPIVersion() != REQUIRED_LIB_APIVERSION) {
|
|
|
|
ERROR("Image processing library API version mismatch!\n");
|
2017-03-14 23:21:08 -04:00
|
|
|
DL_CLOSE(ctx->dl_handle);
|
|
|
|
ctx->dl_handle = NULL;
|
2018-04-27 15:07:43 -04:00
|
|
|
return CUPS_BACKEND_FAILED;
|
2017-03-14 23:21:08 -04:00
|
|
|
}
|
2017-07-10 20:15:56 -04:00
|
|
|
|
2016-10-05 10:40:10 -04:00
|
|
|
ctx->Get3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Get3DColorTable");
|
|
|
|
ctx->Load3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Load3DColorTable");
|
|
|
|
ctx->Destroy3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Destroy3DColorTable");
|
|
|
|
ctx->DoColorConv = DL_SYM(ctx->dl_handle, "CColorConv3D_DoColorConv");
|
|
|
|
ctx->GetCPCData = DL_SYM(ctx->dl_handle, "get_CPCData");
|
|
|
|
ctx->DestroyCPCData = DL_SYM(ctx->dl_handle, "destroy_CPCData");
|
2017-03-17 21:50:50 -04:00
|
|
|
ctx->DoImageEffect60 = DL_SYM(ctx->dl_handle, "do_image_effect60");
|
|
|
|
ctx->DoImageEffect70 = DL_SYM(ctx->dl_handle, "do_image_effect70");
|
|
|
|
ctx->DoImageEffect80 = DL_SYM(ctx->dl_handle, "do_image_effect80");
|
2016-10-05 10:40:10 -04:00
|
|
|
ctx->SendImageData = DL_SYM(ctx->dl_handle, "send_image_data");
|
|
|
|
if (!ctx->Get3DColorTable || !ctx->Load3DColorTable ||
|
|
|
|
!ctx->Destroy3DColorTable || !ctx->DoColorConv ||
|
|
|
|
!ctx->GetCPCData || !ctx->DestroyCPCData ||
|
2017-03-17 21:50:50 -04:00
|
|
|
!ctx->DoImageEffect60 || !ctx->DoImageEffect70 ||
|
|
|
|
!ctx->DoImageEffect80 || !ctx->SendImageData) {
|
|
|
|
ERROR("Problem resolving symbols in imaging processing library\n");
|
2016-10-05 10:40:10 -04:00
|
|
|
DL_CLOSE(ctx->dl_handle);
|
|
|
|
ctx->dl_handle = NULL;
|
2018-04-27 15:07:43 -04:00
|
|
|
return CUPS_BACKEND_FAILED;
|
2016-10-05 10:40:10 -04:00
|
|
|
} else {
|
2017-03-17 00:05:15 -04:00
|
|
|
DEBUG("Image processing library successfully loaded\n");
|
2016-10-05 10:40:10 -04:00
|
|
|
}
|
|
|
|
}
|
2017-03-17 21:50:50 -04:00
|
|
|
|
|
|
|
switch (ctx->type) {
|
|
|
|
case P_MITSU_D80:
|
|
|
|
ctx->DoImageEffect = ctx->DoImageEffect80;
|
|
|
|
break;
|
|
|
|
case P_MITSU_K60:
|
|
|
|
case P_KODAK_305:
|
|
|
|
ctx->DoImageEffect = ctx->DoImageEffect60;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ctx->DoImageEffect = ctx->DoImageEffect70;
|
|
|
|
break;
|
|
|
|
}
|
2016-10-05 10:40:10 -04:00
|
|
|
#else
|
|
|
|
WARNING("Dynamic library support not enabled, using internal fallback code\n");
|
|
|
|
#endif
|
2017-12-07 10:26:55 -05:00
|