2013-06-27 22:45:32 -04:00
|
|
|
/*
|
2013-07-25 17:13:36 -04:00
|
|
|
* Kodak 6800/6850 Photo Printer CUPS backend -- libusb-1.0 version
|
2013-06-27 22:45:32 -04:00
|
|
|
*
|
2016-01-24 09:44:19 -05:00
|
|
|
* (c) 2013-2016 Solomon Peachy <pizza@shaftnet.org>
|
2013-06-27 22:45:32 -04:00
|
|
|
*
|
2014-06-03 20:43:31 -04:00
|
|
|
* Development of this backend was sponsored by:
|
|
|
|
*
|
|
|
|
* LiveLink Technology [ www.livelinktechnology.net ]
|
|
|
|
*
|
2013-06-27 22:45:32 -04:00
|
|
|
* The latest version of this program can be found at:
|
2014-01-13 05:41:48 -05:00
|
|
|
*
|
2013-08-20 20:10:21 -04:00
|
|
|
* http://git.shaftnet.org/cgit/selphy_print.git
|
2014-01-13 05:41:48 -05:00
|
|
|
*
|
2013-06-27 22:45:32 -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]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
2015-08-13 21:09:56 -04:00
|
|
|
#define BACKEND kodak6800_backend
|
|
|
|
|
2013-07-18 18:03:40 -04:00
|
|
|
#include "backend_common.h"
|
|
|
|
|
2013-07-25 17:13:36 -04:00
|
|
|
#define USB_VID_KODAK 0x040A
|
|
|
|
#define USB_PID_KODAK_6800 0x4021
|
|
|
|
#define USB_PID_KODAK_6850 0x402B
|
|
|
|
|
2013-07-18 20:32:44 -04:00
|
|
|
/* File header */
|
|
|
|
struct kodak6800_hdr {
|
2015-08-25 18:09:51 -04:00
|
|
|
uint8_t hdr[7]; /* Always 03 1b 43 48 43 0a 00 */
|
|
|
|
uint8_t jobid; /* Non-zero */
|
|
|
|
uint16_t copies; /* BE, in BCD format (1-9999) */
|
2013-07-18 20:32:44 -04:00
|
|
|
uint16_t columns; /* BE */
|
|
|
|
uint16_t rows; /* BE */
|
2015-08-24 22:24:46 -04:00
|
|
|
uint8_t size; /* 0x06 for 6x8, 0x00 for 6x4, 0x07 for 5x7 */
|
2013-07-18 20:32:44 -04:00
|
|
|
uint8_t laminate; /* 0x01 to laminate, 0x00 for not */
|
2015-08-25 18:09:51 -04:00
|
|
|
uint8_t mode; /* 0x00 or 0x01 (for 4x6 on 6x8 media) */
|
2014-04-12 12:41:09 -04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct kodak68x0_status_readback {
|
2014-07-09 19:31:49 -04:00
|
|
|
uint8_t hdr; /* Always 01 */
|
2015-08-25 18:09:51 -04:00
|
|
|
uint8_t status; /* STATUS_* */
|
|
|
|
uint8_t status1; /* STATUS1_* */
|
|
|
|
uint32_t status2; /* STATUS2_* */
|
2014-12-05 22:01:36 -05:00
|
|
|
uint8_t errcode; /* Error ## */
|
2015-08-25 18:09:51 -04:00
|
|
|
uint32_t lifetime; /* Lifetime Prints (BE) */
|
|
|
|
uint32_t maint; /* Maint Prints (BE) */
|
|
|
|
uint32_t media; /* Media Prints (6850), Unknown (6800) (BE) */
|
|
|
|
uint32_t cutter; /* Cutter Actuations (BE) */
|
2014-12-05 22:01:36 -05:00
|
|
|
uint8_t nullB[2];
|
2015-08-25 18:09:51 -04:00
|
|
|
uint8_t errtype; /* seen 0x00 or 0xd0 */
|
|
|
|
uint8_t donor; /* Percentage, 0-100 */
|
|
|
|
uint16_t main_boot; /* Always 003 */
|
|
|
|
uint16_t main_fw; /* seen 652, 656, 670, 671 (6850) and 232 (6800) */
|
|
|
|
uint16_t dsp_boot; /* Always 001 */
|
|
|
|
uint16_t dsp_fw; /* Seen 540, 541, 560 (6850) and 131 (6800) */
|
|
|
|
uint8_t b1_jobid;
|
|
|
|
uint8_t b2_jobid;
|
|
|
|
uint16_t b1_remain; /* Remaining prints in job */
|
|
|
|
uint16_t b1_complete; /* Completed prints in job */
|
|
|
|
uint16_t b1_total; /* Total prints in job */
|
|
|
|
uint16_t b2_remain; /* Remaining prints in job */
|
|
|
|
uint16_t b2_complete; /* Completed prints in job */
|
|
|
|
uint16_t b2_total; /* Total prints in job */
|
|
|
|
uint8_t curve_status; /* Always seems to be 0x00 */
|
2014-04-12 12:41:09 -04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
2015-08-27 21:41:47 -04:00
|
|
|
enum {
|
|
|
|
CMD_CODE_OK = 1,
|
|
|
|
CMD_CODE_BAD = 2,
|
|
|
|
};
|
|
|
|
|
2015-08-25 18:09:51 -04:00
|
|
|
enum {
|
|
|
|
STATUS_PRINTING = 1,
|
|
|
|
STATUS_IDLE = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2015-08-27 21:41:47 -04:00
|
|
|
STATE_STATUS1_STANDBY = 1,
|
|
|
|
STATE_STATUS1_ERROR = 2,
|
|
|
|
STATE_STATUS1_WAIT = 3,
|
2015-08-25 18:09:51 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define STATE_STANDBY_STATUS2 0x0
|
|
|
|
|
|
|
|
enum {
|
|
|
|
WAIT_STATUS2_INIT = 0,
|
|
|
|
WAIT_STATUS2_RIBBON = 1,
|
|
|
|
WAIT_STATUS2_THERMAL = 2,
|
|
|
|
WAIT_STATUS2_OPERATING = 3,
|
|
|
|
WAIT_STATUS2_BUSY = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ERROR_STATUS2_CTRL_CIRCUIT (1<<31)
|
|
|
|
#define ERROR_STATUS2_MECHANISM_CTRL (1<<30)
|
|
|
|
#define ERROR_STATUS2_SENSOR (1<<13)
|
|
|
|
#define ERROR_STATUS2_COVER_OPEN (1<<12)
|
|
|
|
#define ERROR_STATUS2_TEMP_SENSOR (1<<9)
|
|
|
|
#define ERROR_STATUS2_PAPER_JAM (1<<8)
|
|
|
|
#define ERROR_STATUS2_PAPER_EMPTY (1<<6)
|
|
|
|
#define ERROR_STATUS2_RIBBON_ERR (1<<4)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
CTRL_CIR_ERROR_EEPROM1 = 0x01,
|
|
|
|
CTRL_CIR_ERROR_EEPROM2 = 0x02,
|
|
|
|
CTRL_CIR_ERROR_DSP = 0x04,
|
|
|
|
CTRL_CIR_ERROR_CRC_MAIN = 0x06,
|
|
|
|
CTRL_CIR_ERROR_DL_MAIN = 0x07,
|
|
|
|
CTRL_CIR_ERROR_CRC_DSP = 0x08,
|
|
|
|
CTRL_CIR_ERROR_DL_DSP = 0x09,
|
|
|
|
CTRL_CIR_ERROR_ASIC = 0x0a,
|
|
|
|
CTRL_CIR_ERROR_DRAM = 0x0b,
|
|
|
|
CTRL_CIR_ERROR_DSPCOMM = 0x29,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MECH_ERROR_HEAD_UP = 0x01,
|
|
|
|
MECH_ERROR_HEAD_DOWN = 0x02,
|
|
|
|
MECH_ERROR_MAIN_PINCH_UP = 0x03,
|
|
|
|
MECH_ERROR_MAIN_PINCH_DOWN = 0x04,
|
|
|
|
MECH_ERROR_SUB_PINCH_UP = 0x05,
|
|
|
|
MECH_ERROR_SUB_PINCH_DOWN = 0x06,
|
|
|
|
MECH_ERROR_FEEDIN_PINCH_UP = 0x07,
|
|
|
|
MECH_ERROR_FEEDIN_PINCH_DOWN = 0x08,
|
|
|
|
MECH_ERROR_FEEDOUT_PINCH_UP = 0x09,
|
|
|
|
MECH_ERROR_FEEDOUT_PINCH_DOWN = 0x0a,
|
|
|
|
MECH_ERROR_CUTTER_LR = 0x0b,
|
|
|
|
MECH_ERROR_CUTTER_RL = 0x0c,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SENSOR_ERROR_CUTTER = 0x05,
|
|
|
|
SENSOR_ERROR_HEAD_DOWN = 0x09,
|
|
|
|
SENSOR_ERROR_HEAD_UP = 0x0a,
|
|
|
|
SENSOR_ERROR_MAIN_PINCH_DOWN = 0x0b,
|
|
|
|
SENSOR_ERROR_MAIN_PINCH_UP = 0x0c,
|
|
|
|
SENSOR_ERROR_FEED_PINCH_DOWN = 0x0d,
|
|
|
|
SENSOR_ERROR_FEED_PINCH_UP = 0x0e,
|
|
|
|
SENSOR_ERROR_EXIT_PINCH_DOWN = 0x0f,
|
|
|
|
SENSOR_ERROR_EXIT_PINCH_UP = 0x10,
|
|
|
|
SENSOR_ERROR_LEFT_CUTTER = 0x11,
|
|
|
|
SENSOR_ERROR_RIGHT_CUTTER = 0x12,
|
|
|
|
SENSOR_ERROR_CENTER_CUTTER = 0x13,
|
|
|
|
SENSOR_ERROR_UPPER_CUTTER = 0x14,
|
|
|
|
SENSOR_ERROR_PAPER_FEED_COVER = 0x15,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TEMP_SENSOR_ERROR_HEAD_HIGH = 0x01,
|
|
|
|
TEMP_SENSOR_ERROR_HEAD_LOW = 0x02,
|
|
|
|
TEMP_SENSOR_ERROR_ENV_HIGH = 0x03,
|
|
|
|
TEMP_SENSOR_ERROR_ENV_LOW = 0x04,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
COVER_OPEN_ERROR_UPPER = 0x01,
|
|
|
|
COVER_OPEN_ERROR_LOWER = 0x02,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PAPER_EMPTY_ERROR = 0x00,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
RIBBON_ERROR = 0x00,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
CURVE_TABLE_STATUS_INITIAL = 0x00,
|
|
|
|
CURVE_TABLE_STATUS_USERSET = 0x01,
|
|
|
|
CURVE_TABLE_STATUS_CURRENT = 0x02,
|
|
|
|
};
|
|
|
|
|
2014-04-12 12:41:09 -04:00
|
|
|
struct kodak6800_printsize {
|
|
|
|
uint8_t hdr; /* Always 0x06 */
|
|
|
|
uint16_t width; /* BE */
|
|
|
|
uint16_t height; /* BE */
|
2015-08-25 18:09:51 -04:00
|
|
|
uint8_t type; /* MEDIA_TYPE_* [ ie paper ] */
|
2014-10-04 11:55:56 -04:00
|
|
|
uint8_t code; /* 00, 01, 02, 03, 04, 05 seen. An index? */
|
2016-08-18 21:03:53 -04:00
|
|
|
uint8_t code2; /* 00, 01 seen. Alternates every other 4x6 printed, but only 1 on unknown/1844x2490 print size. */
|
2014-04-12 12:41:09 -04:00
|
|
|
uint8_t null[2];
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2014-06-02 22:16:28 -04:00
|
|
|
#define MAX_MEDIA_LEN 128
|
|
|
|
|
2014-04-12 12:41:09 -04:00
|
|
|
struct kodak68x0_media_readback {
|
|
|
|
uint8_t hdr; /* Always 0x01 */
|
2016-06-20 21:43:59 -04:00
|
|
|
uint8_t type; /* Media code, KODAK68x0_MEDIA_xxx */
|
2014-04-26 20:20:07 -04:00
|
|
|
uint8_t null[5];
|
2014-04-12 12:41:09 -04:00
|
|
|
uint8_t count; /* Always 0x04 (6800) or 0x06 (6850)? */
|
|
|
|
struct kodak6800_printsize sizes[];
|
2013-07-18 20:32:44 -04:00
|
|
|
} __attribute__((packed));
|
2013-07-18 18:03:40 -04:00
|
|
|
|
2016-06-20 21:43:59 -04:00
|
|
|
#define KODAK68x0_MEDIA_6R 0x0b // 197-4096
|
2015-08-24 22:24:46 -04:00
|
|
|
#define KODAK68x0_MEDIA_UNK 0x03
|
2016-06-20 21:43:59 -04:00
|
|
|
#define KODAK68x0_MEDIA_6TR2 0x2c // 396-2941
|
2015-08-24 22:24:46 -04:00
|
|
|
#define KODAK68x0_MEDIA_NONE 0x00
|
2016-06-20 21:43:59 -04:00
|
|
|
/* 6R: Also seen: 101-0867, 141-9597, 659-9054, 169-6418, DNP 900-060 */
|
2014-10-04 11:55:56 -04:00
|
|
|
|
2013-07-18 18:03:40 -04:00
|
|
|
#define CMDBUF_LEN 17
|
|
|
|
|
|
|
|
/* Private data stucture */
|
|
|
|
struct kodak6800_ctx {
|
|
|
|
struct libusb_device_handle *dev;
|
|
|
|
uint8_t endp_up;
|
|
|
|
uint8_t endp_down;
|
|
|
|
|
2013-07-25 17:13:36 -04:00
|
|
|
int type;
|
2015-08-23 19:11:59 -04:00
|
|
|
|
2015-08-25 18:09:51 -04:00
|
|
|
uint8_t jobid;
|
|
|
|
|
2015-08-23 19:11:59 -04:00
|
|
|
struct kodak68x0_media_readback *media;
|
2014-10-04 11:55:56 -04:00
|
|
|
|
2013-07-18 20:32:44 -04:00
|
|
|
struct kodak6800_hdr hdr;
|
2013-07-18 18:03:40 -04:00
|
|
|
uint8_t *databuf;
|
|
|
|
int datalen;
|
2016-08-17 20:32:48 -04:00
|
|
|
|
|
|
|
uint8_t last_donor;
|
2013-07-18 18:03:40 -04:00
|
|
|
};
|
2015-08-27 21:14:09 -04:00
|
|
|
|
2016-08-19 17:40:12 -04:00
|
|
|
static const char *kodak68xx_mediatypes(int type)
|
|
|
|
{
|
|
|
|
switch(type) {
|
|
|
|
case KODAK68x0_MEDIA_NONE:
|
|
|
|
return "No media";
|
|
|
|
case KODAK68x0_MEDIA_6R:
|
|
|
|
case KODAK68x0_MEDIA_6TR2:
|
|
|
|
return "Kodak 6R";
|
|
|
|
default:
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Baseline commands */
|
|
|
|
static int kodak6800_do_cmd(struct kodak6800_ctx *ctx,
|
|
|
|
void *cmd, int cmd_len,
|
|
|
|
void *resp, int resp_len,
|
|
|
|
int *actual_len)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Write command */
|
|
|
|
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
|
|
|
cmd, cmd_len)))
|
|
|
|
return (ret < 0) ? ret : -99;
|
|
|
|
|
|
|
|
/* Read response */
|
|
|
|
ret = read_data(ctx->dev, ctx->endp_up,
|
|
|
|
resp, resp_len, actual_len);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2013-06-27 23:02:34 -04:00
|
|
|
|
2016-08-19 17:40:12 -04:00
|
|
|
|
|
|
|
|
2014-04-19 11:33:50 -04:00
|
|
|
static void kodak68x0_dump_mediainfo(struct kodak68x0_media_readback *media)
|
2014-04-12 12:41:09 -04:00
|
|
|
{
|
|
|
|
int i;
|
2016-06-20 21:43:59 -04:00
|
|
|
if (media->type == KODAK68x0_MEDIA_NONE) {
|
2015-08-25 22:58:38 -04:00
|
|
|
INFO("No Media Loaded\n");
|
2015-08-24 22:24:46 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-06-20 21:43:59 -04:00
|
|
|
switch (media->type) {
|
|
|
|
case KODAK68x0_MEDIA_6R:
|
2015-08-25 22:58:38 -04:00
|
|
|
INFO("Media type: 6R (Kodak 197-4096 or equivalent)\n");
|
2016-06-20 21:43:59 -04:00
|
|
|
break;
|
|
|
|
case KODAK68x0_MEDIA_6TR2:
|
|
|
|
INFO("Media type: 6R (Kodak 396-2941 or equivalent)\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
INFO("Media type %02x (unknown, please report!)\n", media->type);
|
|
|
|
break;
|
2014-10-04 11:55:56 -04:00
|
|
|
}
|
2015-08-25 22:58:38 -04:00
|
|
|
INFO("Legal print sizes:\n");
|
2014-04-12 12:41:09 -04:00
|
|
|
for (i = 0 ; i < media->count ; i++) {
|
2015-08-25 22:58:38 -04:00
|
|
|
INFO("\t%d: %dx%d (%02x) %s\n", i,
|
2016-08-18 21:03:53 -04:00
|
|
|
be16_to_cpu(media->sizes[i].width),
|
|
|
|
be16_to_cpu(media->sizes[i].height),
|
|
|
|
media->sizes[i].code,
|
|
|
|
media->sizes[i].code2? "Disallowed?" : "");
|
2014-04-12 12:41:09 -04:00
|
|
|
}
|
2015-08-25 22:58:38 -04:00
|
|
|
INFO("\n");
|
2014-04-12 12:41:09 -04:00
|
|
|
}
|
|
|
|
|
2014-06-02 22:16:28 -04:00
|
|
|
static int kodak6800_get_mediainfo(struct kodak6800_ctx *ctx, struct kodak68x0_media_readback *media)
|
2014-04-12 12:41:09 -04:00
|
|
|
{
|
|
|
|
uint8_t req[16];
|
|
|
|
int ret, num;
|
|
|
|
|
|
|
|
memset(req, 0, sizeof(req));
|
2014-06-02 22:16:28 -04:00
|
|
|
memset(media, 0, sizeof(*media));
|
2014-04-12 12:41:09 -04:00
|
|
|
|
|
|
|
req[0] = 0x03;
|
|
|
|
req[1] = 0x1b;
|
|
|
|
req[2] = 0x43;
|
|
|
|
req[3] = 0x48;
|
|
|
|
req[4] = 0x43;
|
|
|
|
req[5] = 0x1a;
|
2016-08-18 21:03:53 -04:00
|
|
|
req[6] = 0x00; /* This can be non-zero for additional "banks" */
|
2014-04-12 12:41:09 -04:00
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Issue command and get response */
|
|
|
|
if ((ret = kodak6800_do_cmd(ctx, req, sizeof(req),
|
|
|
|
media, MAX_MEDIA_LEN,
|
|
|
|
&num)))
|
2014-04-12 12:41:09 -04:00
|
|
|
return ret;
|
2014-10-04 11:55:56 -04:00
|
|
|
|
|
|
|
/* Validate proper response */
|
2015-08-27 21:41:47 -04:00
|
|
|
if (media->hdr != CMD_CODE_OK ||
|
2014-10-04 11:55:56 -04:00
|
|
|
media->null[0] != 0x00) {
|
|
|
|
ERROR("Unexpected response from media query!\n");
|
|
|
|
return CUPS_BACKEND_STOP;
|
|
|
|
}
|
|
|
|
|
2014-04-12 12:41:09 -04:00
|
|
|
return 0;
|
|
|
|
}
|
2013-06-27 22:45:32 -04:00
|
|
|
|
2015-08-25 18:09:51 -04:00
|
|
|
static int kodak68x0_canceljob(struct kodak6800_ctx *ctx,
|
|
|
|
int id)
|
2015-08-24 22:24:46 -04:00
|
|
|
{
|
2015-08-25 18:09:51 -04:00
|
|
|
uint8_t req[16];
|
|
|
|
int ret, num;
|
|
|
|
struct kodak68x0_status_readback sts;
|
|
|
|
|
|
|
|
memset(req, 0, sizeof(req));
|
|
|
|
|
|
|
|
req[0] = 0x03;
|
|
|
|
req[1] = 0x1b;
|
|
|
|
req[2] = 0x43;
|
|
|
|
req[3] = 0x48;
|
|
|
|
req[4] = 0x43;
|
|
|
|
req[5] = 0x13;
|
|
|
|
req[6] = id;
|
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Issue command and get response */
|
|
|
|
if ((ret = kodak6800_do_cmd(ctx, req, sizeof(req),
|
|
|
|
&sts, sizeof(sts),
|
|
|
|
&num)))
|
2015-08-25 18:09:51 -04:00
|
|
|
return ret;
|
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Validate proper response */
|
2015-08-27 21:41:47 -04:00
|
|
|
if (sts.hdr != CMD_CODE_OK) {
|
2015-08-27 21:14:09 -04:00
|
|
|
ERROR("Unexpected response from job cancel!\n");
|
|
|
|
return -99;
|
2015-08-24 22:24:46 -04:00
|
|
|
}
|
2015-08-27 21:14:09 -04:00
|
|
|
|
2015-08-25 18:09:51 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-28 10:28:42 -04:00
|
|
|
static int kodak68x0_reset(struct kodak6800_ctx *ctx)
|
|
|
|
{
|
|
|
|
uint8_t req[16];
|
|
|
|
int ret, num;
|
|
|
|
struct kodak68x0_status_readback sts;
|
|
|
|
|
|
|
|
memset(req, 0, sizeof(req));
|
|
|
|
|
|
|
|
req[0] = 0x03;
|
|
|
|
req[1] = 0x1b;
|
|
|
|
req[2] = 0x43;
|
|
|
|
req[3] = 0x48;
|
|
|
|
req[4] = 0xc0;
|
|
|
|
|
|
|
|
/* Issue command and get response */
|
|
|
|
if ((ret = kodak6800_do_cmd(ctx, req, sizeof(req),
|
|
|
|
&sts, sizeof(sts),
|
|
|
|
&num)))
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Validate proper response */
|
|
|
|
if (sts.hdr != CMD_CODE_OK) {
|
|
|
|
ERROR("Unexpected response from job cancel!\n");
|
|
|
|
return -99;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-25 18:09:51 -04:00
|
|
|
/* Structure dumps */
|
|
|
|
static char *kodak68x0_status_str(struct kodak68x0_status_readback *resp)
|
|
|
|
{
|
|
|
|
switch(resp->status1) {
|
2015-08-27 21:41:47 -04:00
|
|
|
case STATE_STATUS1_STANDBY:
|
2015-08-25 18:09:51 -04:00
|
|
|
return "Standby (Ready)";
|
2015-08-27 21:41:47 -04:00
|
|
|
case STATE_STATUS1_WAIT:
|
2015-08-25 18:09:51 -04:00
|
|
|
switch (be32_to_cpu(resp->status2)) {
|
|
|
|
case WAIT_STATUS2_INIT:
|
|
|
|
return "Wait (Initializing)";
|
|
|
|
case WAIT_STATUS2_RIBBON:
|
|
|
|
return "Wait (Ribbon Winding)";
|
|
|
|
case WAIT_STATUS2_THERMAL:
|
|
|
|
return "Wait (Thermal Protection)";
|
|
|
|
case WAIT_STATUS2_OPERATING:
|
|
|
|
return "Wait (Operating)";
|
|
|
|
case WAIT_STATUS2_BUSY:
|
|
|
|
return "Wait (Busy)";
|
|
|
|
default:
|
|
|
|
return "Wait (Unknown)";
|
|
|
|
}
|
2015-08-27 21:41:47 -04:00
|
|
|
case STATE_STATUS1_ERROR:
|
2015-08-25 18:09:51 -04:00
|
|
|
switch (be32_to_cpu(resp->status2)) {
|
|
|
|
case ERROR_STATUS2_CTRL_CIRCUIT:
|
|
|
|
switch (resp->errcode) {
|
|
|
|
case CTRL_CIR_ERROR_EEPROM1:
|
|
|
|
return "Error (EEPROM1)";
|
|
|
|
case CTRL_CIR_ERROR_EEPROM2:
|
|
|
|
return "Error (EEPROM2)";
|
|
|
|
case CTRL_CIR_ERROR_DSP:
|
|
|
|
return "Error (DSP)";
|
|
|
|
case CTRL_CIR_ERROR_CRC_MAIN:
|
|
|
|
return "Error (Main CRC)";
|
|
|
|
case CTRL_CIR_ERROR_DL_MAIN:
|
|
|
|
return "Error (Main Download)";
|
|
|
|
case CTRL_CIR_ERROR_CRC_DSP:
|
|
|
|
return "Error (DSP CRC)";
|
|
|
|
case CTRL_CIR_ERROR_DL_DSP:
|
|
|
|
return "Error (DSP Download)";
|
|
|
|
case CTRL_CIR_ERROR_ASIC:
|
|
|
|
return "Error (ASIC)";
|
|
|
|
case CTRL_CIR_ERROR_DRAM:
|
|
|
|
return "Error (DRAM)";
|
|
|
|
case CTRL_CIR_ERROR_DSPCOMM:
|
|
|
|
return "Error (DSP Communincation)";
|
|
|
|
default:
|
|
|
|
return "Error (Unknown Circuit)";
|
|
|
|
}
|
|
|
|
case ERROR_STATUS2_MECHANISM_CTRL:
|
|
|
|
switch (resp->errcode) {
|
|
|
|
case MECH_ERROR_HEAD_UP:
|
|
|
|
return "Error (Head Up Mechanism)";
|
|
|
|
case MECH_ERROR_HEAD_DOWN:
|
|
|
|
return "Error (Head Down Mechanism)";
|
|
|
|
case MECH_ERROR_MAIN_PINCH_UP:
|
|
|
|
return "Error (Main Pinch Up Mechanism)";
|
|
|
|
case MECH_ERROR_MAIN_PINCH_DOWN:
|
|
|
|
return "Error (Main Pinch Down Mechanism)";
|
|
|
|
case MECH_ERROR_SUB_PINCH_UP:
|
|
|
|
return "Error (Sub Pinch Up Mechanism)";
|
|
|
|
case MECH_ERROR_SUB_PINCH_DOWN:
|
|
|
|
return "Error (Sub Pinch Down Mechanism)";
|
|
|
|
case MECH_ERROR_FEEDIN_PINCH_UP:
|
|
|
|
return "Error (Feed-in Pinch Up Mechanism)";
|
|
|
|
case MECH_ERROR_FEEDIN_PINCH_DOWN:
|
|
|
|
return "Error (Feed-in Pinch Down Mechanism)";
|
|
|
|
case MECH_ERROR_FEEDOUT_PINCH_UP:
|
|
|
|
return "Error (Feed-out Pinch Up Mechanism)";
|
|
|
|
case MECH_ERROR_FEEDOUT_PINCH_DOWN:
|
|
|
|
return "Error (Feed-out Pinch Down Mechanism)";
|
|
|
|
case MECH_ERROR_CUTTER_LR:
|
|
|
|
return "Error (Left->Right Cutter)";
|
|
|
|
case MECH_ERROR_CUTTER_RL:
|
|
|
|
return "Error (Right->Left Cutter)";
|
|
|
|
default:
|
|
|
|
return "Error (Unknown Mechanism)";
|
|
|
|
}
|
|
|
|
case ERROR_STATUS2_SENSOR:
|
|
|
|
switch (resp->errcode) {
|
|
|
|
case SENSOR_ERROR_CUTTER:
|
|
|
|
return "Error (Cutter Sensor)";
|
|
|
|
case SENSOR_ERROR_HEAD_DOWN:
|
|
|
|
return "Error (Head Down Sensor)";
|
|
|
|
case SENSOR_ERROR_HEAD_UP:
|
|
|
|
return "Error (Head Up Sensor)";
|
|
|
|
case SENSOR_ERROR_MAIN_PINCH_DOWN:
|
|
|
|
return "Error (Main Pinch Down Sensor)";
|
|
|
|
case SENSOR_ERROR_MAIN_PINCH_UP:
|
|
|
|
return "Error (Main Pinch Up Sensor)";
|
|
|
|
case SENSOR_ERROR_FEED_PINCH_DOWN:
|
|
|
|
return "Error (Feed Pinch Down Sensor)";
|
|
|
|
case SENSOR_ERROR_FEED_PINCH_UP:
|
|
|
|
return "Error (Feed Pinch Up Sensor)";
|
|
|
|
case SENSOR_ERROR_EXIT_PINCH_DOWN:
|
|
|
|
return "Error (Exit Pinch Up Sensor)";
|
|
|
|
case SENSOR_ERROR_EXIT_PINCH_UP:
|
|
|
|
return "Error (Exit Pinch Up Sensor)";
|
|
|
|
case SENSOR_ERROR_LEFT_CUTTER:
|
|
|
|
return "Error (Left Cutter Sensor)";
|
|
|
|
case SENSOR_ERROR_RIGHT_CUTTER:
|
|
|
|
return "Error (Right Cutter Sensor)";
|
|
|
|
case SENSOR_ERROR_CENTER_CUTTER:
|
|
|
|
return "Error (Center Cutter Sensor)";
|
|
|
|
case SENSOR_ERROR_UPPER_CUTTER:
|
|
|
|
return "Error (Upper Cutter Sensor)";
|
|
|
|
case SENSOR_ERROR_PAPER_FEED_COVER:
|
|
|
|
return "Error (Paper Feed Cover)";
|
|
|
|
default:
|
|
|
|
return "Error (Unknown Sensor)";
|
|
|
|
}
|
|
|
|
case ERROR_STATUS2_COVER_OPEN:
|
|
|
|
switch (resp->errcode) {
|
|
|
|
case COVER_OPEN_ERROR_UPPER:
|
|
|
|
return "Error (Upper Cover Open)";
|
|
|
|
case COVER_OPEN_ERROR_LOWER:
|
|
|
|
return "Error (Lower Cover Open)";
|
|
|
|
default:
|
|
|
|
return "Error (Unknown Cover Open)";
|
|
|
|
}
|
|
|
|
case ERROR_STATUS2_TEMP_SENSOR:
|
|
|
|
switch (resp->errcode) {
|
|
|
|
case TEMP_SENSOR_ERROR_HEAD_HIGH:
|
|
|
|
return "Error (Head Temperature High)";
|
|
|
|
case TEMP_SENSOR_ERROR_HEAD_LOW:
|
|
|
|
return "Error (Head Temperature Low)";
|
|
|
|
case TEMP_SENSOR_ERROR_ENV_HIGH:
|
|
|
|
return "Error (Environmental Temperature High)";
|
|
|
|
case TEMP_SENSOR_ERROR_ENV_LOW:
|
|
|
|
return "Error (Environmental Temperature Low)";
|
|
|
|
default:
|
|
|
|
return "Error (Unknown Temperature)";
|
|
|
|
}
|
|
|
|
case ERROR_STATUS2_PAPER_JAM:
|
|
|
|
return "Error (Paper Jam)";
|
|
|
|
case ERROR_STATUS2_PAPER_EMPTY:
|
|
|
|
return "Error (Paper Empty)";
|
|
|
|
case ERROR_STATUS2_RIBBON_ERR:
|
|
|
|
return "Error (Ribbon)";
|
|
|
|
default:
|
|
|
|
return "Error (Unknown)";
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return "Unknown!";
|
|
|
|
}
|
2015-08-24 22:24:46 -04:00
|
|
|
}
|
|
|
|
|
2014-10-04 11:55:56 -04:00
|
|
|
static void kodak68x0_dump_status(struct kodak6800_ctx *ctx, struct kodak68x0_status_readback *status)
|
2014-06-02 22:16:28 -04:00
|
|
|
{
|
2015-08-25 18:09:51 -04:00
|
|
|
char *detail;
|
|
|
|
|
|
|
|
switch (status->status) {
|
|
|
|
case STATUS_PRINTING:
|
|
|
|
detail = "Printing";
|
|
|
|
break;
|
|
|
|
case STATUS_IDLE:
|
|
|
|
detail = "Idle";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
detail = "Unknown";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
INFO("Printer Status : %s\n", detail);
|
|
|
|
|
|
|
|
INFO("Printer State : %s # %02x %08x %02x\n",
|
|
|
|
kodak68x0_status_str(status),
|
|
|
|
status->status1, be32_to_cpu(status->status2), status->errcode);
|
|
|
|
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO("Bank 1 ID: %u\n", status->b1_jobid);
|
2015-08-25 18:09:51 -04:00
|
|
|
INFO("\tPrints: %d/%d complete\n",
|
|
|
|
be16_to_cpu(status->b1_complete), be16_to_cpu(status->b1_total));
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO("Bank 2 ID: %u\n", status->b2_jobid);
|
2015-08-25 18:09:51 -04:00
|
|
|
INFO("\tPrints: %d/%d complete\n",
|
|
|
|
be16_to_cpu(status->b2_complete), be16_to_cpu(status->b2_total));
|
|
|
|
|
2015-08-27 21:41:47 -04:00
|
|
|
switch (status->curve_status) {
|
|
|
|
case CURVE_TABLE_STATUS_INITIAL:
|
|
|
|
detail = "Initial/Default";
|
|
|
|
break;
|
|
|
|
case CURVE_TABLE_STATUS_USERSET:
|
|
|
|
detail = "User Stored";
|
|
|
|
break;
|
|
|
|
case CURVE_TABLE_STATUS_CURRENT:
|
|
|
|
detail = "Current";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
detail = "Unknown";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
INFO("Tone Curve Status: %s\n", detail);
|
|
|
|
|
2015-08-25 18:09:51 -04:00
|
|
|
INFO("Counters:\n");
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO("\tLifetime : %u\n", be32_to_cpu(status->lifetime));
|
|
|
|
INFO("\tThermal Head : %u\n", be32_to_cpu(status->maint));
|
|
|
|
INFO("\tCutter : %u\n", be32_to_cpu(status->cutter));
|
2015-08-24 22:24:46 -04:00
|
|
|
|
2014-10-04 11:55:56 -04:00
|
|
|
if (ctx->type == P_KODAK_6850) {
|
|
|
|
int max;
|
2015-08-25 18:09:51 -04:00
|
|
|
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO("\tMedia : %u\n", be32_to_cpu(status->media));
|
2015-08-25 18:09:51 -04:00
|
|
|
|
2016-08-17 20:32:48 -04:00
|
|
|
switch(ctx->media->type) {
|
|
|
|
case KODAK68x0_MEDIA_6R:
|
|
|
|
case KODAK68x0_MEDIA_6TR2:
|
2014-10-04 11:55:56 -04:00
|
|
|
max = 375;
|
2016-08-17 20:32:48 -04:00
|
|
|
break;
|
|
|
|
default:
|
2014-10-04 11:55:56 -04:00
|
|
|
max = 0;
|
2016-08-17 20:32:48 -04:00
|
|
|
break;
|
2014-10-04 11:55:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (max) {
|
2016-08-17 20:32:48 -04:00
|
|
|
INFO("\t Remaining : %d\n", max - be32_to_cpu(status->media));
|
2014-10-04 11:55:56 -04:00
|
|
|
} else {
|
2016-08-17 20:32:48 -04:00
|
|
|
INFO("\t Remaining : Unknown\n");
|
2014-10-04 11:55:56 -04:00
|
|
|
}
|
|
|
|
}
|
2016-08-17 20:32:48 -04:00
|
|
|
INFO("Main FW version : %d\n", be16_to_cpu(status->main_fw));
|
|
|
|
INFO("DSP FW version : %d\n", be16_to_cpu(status->dsp_fw));
|
2016-08-21 10:23:00 -04:00
|
|
|
INFO("Donor : %u%%\n", status->donor);
|
2015-08-25 18:09:51 -04:00
|
|
|
INFO("\n");
|
2014-06-02 22:16:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int kodak6800_get_status(struct kodak6800_ctx *ctx,
|
|
|
|
struct kodak68x0_status_readback *status)
|
|
|
|
{
|
|
|
|
uint8_t req[16];
|
|
|
|
int ret, num;
|
|
|
|
|
|
|
|
memset(req, 0, sizeof(req));
|
|
|
|
memset(status, 0, sizeof(*status));
|
|
|
|
|
|
|
|
req[0] = 0x03;
|
|
|
|
req[1] = 0x1b;
|
|
|
|
req[2] = 0x43;
|
|
|
|
req[3] = 0x48;
|
|
|
|
req[4] = 0x43;
|
|
|
|
req[5] = 0x03;
|
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Issue command and get response */
|
|
|
|
if ((ret = kodak6800_do_cmd(ctx, req, sizeof(req),
|
|
|
|
status, sizeof(*status),
|
|
|
|
&num)))
|
2014-06-02 22:16:28 -04:00
|
|
|
return ret;
|
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Validate proper response */
|
2015-08-27 21:41:47 -04:00
|
|
|
if (status->hdr != CMD_CODE_OK) {
|
2014-07-08 21:31:10 -04:00
|
|
|
ERROR("Unexpected response from status query!\n");
|
2015-08-27 21:14:09 -04:00
|
|
|
return -99;
|
2014-06-02 22:16:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-08 21:59:51 -04:00
|
|
|
#define UPDATE_SIZE 1536
|
2013-07-18 18:03:40 -04:00
|
|
|
static int kodak6800_get_tonecurve(struct kodak6800_ctx *ctx, char *fname)
|
2013-07-08 21:59:51 -04:00
|
|
|
{
|
|
|
|
uint8_t cmdbuf[16];
|
|
|
|
uint8_t respbuf[64];
|
|
|
|
int ret, num = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
uint16_t *data = malloc(UPDATE_SIZE);
|
2015-06-23 20:32:41 -04:00
|
|
|
if (!data) {
|
|
|
|
ERROR("Memory Allocation Failure\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2013-07-08 21:59:51 -04:00
|
|
|
|
|
|
|
INFO("Dump Tone Curve to '%s'\n", fname);
|
|
|
|
|
|
|
|
/* Initial Request */
|
|
|
|
cmdbuf[0] = 0x03;
|
|
|
|
cmdbuf[1] = 0x1b;
|
|
|
|
cmdbuf[2] = 0x43;
|
|
|
|
cmdbuf[3] = 0x48;
|
|
|
|
cmdbuf[4] = 0x43;
|
|
|
|
cmdbuf[5] = 0x0c;
|
|
|
|
cmdbuf[6] = 0x54;
|
|
|
|
cmdbuf[7] = 0x4f;
|
|
|
|
cmdbuf[8] = 0x4e;
|
|
|
|
cmdbuf[9] = 0x45;
|
|
|
|
cmdbuf[10] = 0x72;
|
2016-08-18 21:03:53 -04:00
|
|
|
cmdbuf[11] = 0x01; /* 01 for user tonecurve, can be 00 or 02 */
|
|
|
|
cmdbuf[12] = 0x00; /* param table? */
|
2013-07-08 21:59:51 -04:00
|
|
|
cmdbuf[13] = 0x00;
|
|
|
|
cmdbuf[14] = 0x00;
|
|
|
|
cmdbuf[15] = 0x00;
|
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Issue command and get response */
|
|
|
|
if ((ret = kodak6800_do_cmd(ctx, cmdbuf, sizeof(cmdbuf),
|
|
|
|
respbuf, sizeof(respbuf),
|
|
|
|
&num)))
|
|
|
|
|
|
|
|
/* Validate proper response */
|
2015-08-27 21:41:47 -04:00
|
|
|
if (respbuf[0] != CMD_CODE_OK) {
|
2015-08-27 21:14:09 -04:00
|
|
|
ERROR("Unexpected response from tonecurve query!\n");
|
2015-09-13 09:56:27 -04:00
|
|
|
ret = -99;
|
|
|
|
goto done;
|
2013-07-08 21:59:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Then we can poll the data */
|
|
|
|
cmdbuf[0] = 0x03;
|
|
|
|
cmdbuf[1] = 0x1b;
|
|
|
|
cmdbuf[2] = 0x43;
|
|
|
|
cmdbuf[3] = 0x48;
|
|
|
|
cmdbuf[4] = 0x43;
|
|
|
|
cmdbuf[5] = 0x0c;
|
|
|
|
cmdbuf[6] = 0x54;
|
|
|
|
cmdbuf[7] = 0x4f;
|
|
|
|
cmdbuf[8] = 0x4e;
|
|
|
|
cmdbuf[9] = 0x45;
|
|
|
|
cmdbuf[10] = 0x20;
|
|
|
|
for (i = 0 ; i < 24 ; i++) {
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Issue command and get response */
|
|
|
|
if ((ret = kodak6800_do_cmd(ctx, cmdbuf, sizeof(cmdbuf),
|
|
|
|
respbuf, sizeof(respbuf),
|
|
|
|
&num)))
|
2014-02-11 20:11:33 -05:00
|
|
|
goto done;
|
|
|
|
|
2013-12-21 22:55:33 -05:00
|
|
|
if (num != 64) {
|
|
|
|
ERROR("Short read! (%d/%d)\n", num, 51);
|
2014-02-11 20:11:33 -05:00
|
|
|
ret = 4;
|
|
|
|
goto done;
|
2013-07-08 21:59:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy into buffer */
|
|
|
|
memcpy(((uint8_t*)data)+i*64, respbuf, 64);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open file and write it out */
|
|
|
|
{
|
2013-11-25 09:09:29 -05:00
|
|
|
int tc_fd = open(fname, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);
|
2014-02-11 20:11:33 -05:00
|
|
|
if (tc_fd < 0) {
|
|
|
|
ret = 4;
|
|
|
|
goto done;
|
|
|
|
}
|
2013-11-25 09:09:29 -05:00
|
|
|
|
2013-07-08 21:59:51 -04:00
|
|
|
for (i = 0 ; i < 768; i++) {
|
|
|
|
/* Byteswap appropriately */
|
|
|
|
data[i] = cpu_to_be16(le16_to_cpu(data[i]));
|
|
|
|
write(tc_fd, &data[i], sizeof(uint16_t));
|
|
|
|
}
|
|
|
|
close(tc_fd);
|
|
|
|
}
|
|
|
|
|
2014-02-11 20:11:33 -05:00
|
|
|
done:
|
2013-07-08 21:59:51 -04:00
|
|
|
/* We're done */
|
|
|
|
free(data);
|
|
|
|
|
2015-07-04 11:03:52 -04:00
|
|
|
return ret;
|
2013-07-08 21:59:51 -04:00
|
|
|
}
|
|
|
|
|
2013-07-18 18:03:40 -04:00
|
|
|
static int kodak6800_set_tonecurve(struct kodak6800_ctx *ctx, char *fname)
|
2013-07-08 22:33:54 -04:00
|
|
|
{
|
|
|
|
uint8_t cmdbuf[64];
|
|
|
|
uint8_t respbuf[64];
|
|
|
|
int ret, num = 0;
|
|
|
|
int remain;
|
|
|
|
|
|
|
|
uint16_t *data = malloc(UPDATE_SIZE);
|
|
|
|
uint8_t *ptr;
|
|
|
|
|
2015-06-23 20:32:41 -04:00
|
|
|
if (!data) {
|
|
|
|
ERROR("Memory Allocation Failure\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2015-08-25 18:09:51 -04:00
|
|
|
|
2013-07-08 22:33:54 -04:00
|
|
|
INFO("Set Tone Curve from '%s'\n", fname);
|
|
|
|
|
|
|
|
/* Read in file */
|
|
|
|
int tc_fd = open(fname, O_RDONLY);
|
2014-02-11 20:11:33 -05:00
|
|
|
if (tc_fd < 0) {
|
|
|
|
ret = -1;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (read(tc_fd, data, UPDATE_SIZE) != UPDATE_SIZE) {
|
|
|
|
ret = -2;
|
|
|
|
goto done;
|
|
|
|
}
|
2013-07-08 22:33:54 -04:00
|
|
|
close(tc_fd);
|
|
|
|
|
|
|
|
/* Byteswap data to printer's format */
|
2013-11-24 10:53:39 -05:00
|
|
|
for (ret = 0; ret < (UPDATE_SIZE)/2 ; ret++) {
|
2013-07-08 22:33:54 -04:00
|
|
|
data[ret] = cpu_to_le16(be16_to_cpu(data[ret]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initial Request */
|
|
|
|
cmdbuf[0] = 0x03;
|
|
|
|
cmdbuf[1] = 0x1b;
|
|
|
|
cmdbuf[2] = 0x43;
|
|
|
|
cmdbuf[3] = 0x48;
|
|
|
|
cmdbuf[4] = 0x43;
|
|
|
|
cmdbuf[5] = 0x0c;
|
|
|
|
cmdbuf[6] = 0x54;
|
|
|
|
cmdbuf[7] = 0x4f;
|
|
|
|
cmdbuf[8] = 0x4e;
|
|
|
|
cmdbuf[9] = 0x45;
|
|
|
|
cmdbuf[10] = 0x77;
|
2016-08-18 21:03:53 -04:00
|
|
|
cmdbuf[11] = 0x01; /* User TC. Can be 00 or 02 */
|
|
|
|
cmdbuf[12] = 0x00; /* param table? */
|
2013-07-08 22:33:54 -04:00
|
|
|
cmdbuf[13] = 0x00;
|
|
|
|
cmdbuf[14] = 0x00;
|
|
|
|
cmdbuf[15] = 0x00;
|
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Issue command and get response */
|
|
|
|
if ((ret = kodak6800_do_cmd(ctx, cmdbuf, sizeof(cmdbuf),
|
|
|
|
respbuf, sizeof(respbuf),
|
|
|
|
&num)))
|
2015-08-25 18:09:51 -04:00
|
|
|
|
2015-08-27 21:14:09 -04:00
|
|
|
/* Validate proper response */
|
2013-12-21 22:55:33 -05:00
|
|
|
if (num != 51) {
|
|
|
|
ERROR("Short read! (%d/%d)\n", num, 51);
|
2014-02-11 20:11:33 -05:00
|
|
|
ret = 4;
|
|
|
|