hiti: Query the matrix data on p51x

This commit is contained in:
Solomon Peachy 2022-10-20 20:56:40 -04:00
parent 88c4f92af7
commit 3e26608a69
1 changed files with 31 additions and 11 deletions

View File

@ -48,16 +48,16 @@ struct hiti_cmd {
#define CMD_STATUS_OK 0x50 #define CMD_STATUS_OK 0x50
#define CMD_STATUS_OK2 0x51 /* Seen with ERDC_RLC on p51x */ #define CMD_STATUS_OK2 0x51 /* Seen with ERDC_RLC on p51x */
#define CMD_STATUS_OK3 0x53 /* Seen with EPC_SP on p51x, sometimes? */ #define CMD_STATUS_OK3 0x53 /* Seen with EPC_SP on p51x, sometimes? */
#define CMD_STATUS_BAD_CMD 0xd8 /* Seen with EFM_RD on p51x */ #define CMD_STATUS_BAD_CMD 0xd8 /* eg seen with EFM_RD on p51x */
#define CMD_STATUS_UNK2 0xdb /* Seen with ESD_SEHT2 on p51x */ #define CMD_STATUS_UNK2 0xdb /* Seen with ESD_SEHT2 on p51x */
/* Request Device Characteristics */ /* Request Device Characteristics */
#define CMD_RDC_RS 0x0100 /* Request Summary */ #define CMD_RDC_RS 0x0100 /* Request Summary */
#define CMD_RDC_ROC 0x0104 /* Request Option Characteristics XX (1 resp) */ #define CMD_RDC_ROC 0x0104 /* Request Option Characteristics XX (1 resp, not p51x) */
/* Printer Configuratio Control */ /* Printer Configuratio Control */
#define CMD_PCC_RP 0x0301 /* Reset Printer (1 arg) */ #define CMD_PCC_RP 0x0301 /* Reset Printer (1 arg) */
#define CMD_PCC_STP 0x030F /* Set Target Printer (1 arg) XX -- master or slave perhaps? */ #define CMD_PCC_STP 0x030F /* Set Target Printer (1 arg) XXX -- 00 == master or 01 == slave ? Or maybe it's a bank select for CMD_EFM_RNV? */
/* Request Device Status */ /* Request Device Status */
#define CMD_RDS_RSS 0x0400 /* Request Status Summary */ #define CMD_RDS_RSS 0x0400 /* Request Status Summary */
@ -85,10 +85,11 @@ struct hiti_cmd {
#define CMD_ERDC_RLC 0x8006 /* Request LED calibration */ #define CMD_ERDC_RLC 0x8006 /* Request LED calibration */
#define CMD_ERDC_RSN 0x8007 /* Read Serial Number (1 arg) */ #define CMD_ERDC_RSN 0x8007 /* Read Serial Number (1 arg) */
#define CMD_ERDC_C_RPCS 0x8008 /* CS Request Printer Correction Status */ #define CMD_ERDC_C_RPCS 0x8008 /* CS Request Printer Correction Status */
#define CMD_ERDC_CTV 0x8008 /* Color Table Version XXX p51x, string (14 byte reply?) */
#define CMD_ERDC_RPIDM 0x8009 /* Request PID and Model Code */ #define CMD_ERDC_RPIDM 0x8009 /* Request PID and Model Code */
#define CMD_ERDC_RTLV 0x800E /* Request T/L Voltage */ #define CMD_ERDC_RTLV 0x800E /* Request T/L Voltage */
#define CMD_ERDC_RRVC 0x800F /* Read Ribbon Vendor Code */ #define CMD_ERDC_RRVC 0x800F /* Read Ribbon Vendor Code */
#define CMD_ERDC_UNK 0x8010 /* Unknown Query RE */ #define CMD_ERDC_UNK1 0x8010 /* Unknown Query RE */
#define CMD_ERDC_UNK2 0x8011 /* Unknown Query RE */ #define CMD_ERDC_UNK2 0x8011 /* Unknown Query RE */
#define CMD_ERDC_RHA 0x801C /* Read Highlight Adjustment (6 resp) RE */ #define CMD_ERDC_RHA 0x801C /* Read Highlight Adjustment (6 resp) RE */
@ -132,8 +133,8 @@ struct hiti_cmd {
#define CMD_ESD_C_SHPTC 0x830C /* CS Send Heating Parameters & Tone Curve XX (n arg) */ #define CMD_ESD_C_SHPTC 0x830C /* CS Send Heating Parameters & Tone Curve XX (n arg) */
/* Extended Flash/NVram */ /* Extended Flash/NVram */
#define CMD_EFM_RNV 0x8405 /* Read NVRam (1 arg) XX */ #define CMD_EFM_RNV 0x8405 /* Read NVRam (1 arg) -- arg is offset, 1 byte resp of data @ that offset. -- All newer than P51x */
#define CMD_EFM_RD 0x8408 /* Read single location (2 arg) -- XXX RE not P51x */ #define CMD_EFM_RD 0x8408 /* Read single location (2 byte offset arg, 1 byte of data @ that offset -- not P51x */
#define CMD_EFM_SHA 0x840E /* Set Highlight Adjustment (5 arg) -- XXX RE */ #define CMD_EFM_SHA 0x840E /* Set Highlight Adjustment (5 arg) -- XXX RE */
/* Extended Security Control */ /* Extended Security Control */
@ -465,6 +466,7 @@ static int hiti_query_job_qa(struct hiti_ctx *ctx, struct hiti_job *jobid, struc
static int hiti_query_status(struct hiti_ctx *ctx, uint8_t *sts, uint32_t *err); static int hiti_query_status(struct hiti_ctx *ctx, uint8_t *sts, uint32_t *err);
static int hiti_query_version(struct hiti_ctx *ctx); static int hiti_query_version(struct hiti_ctx *ctx);
static int hiti_query_matrix(struct hiti_ctx *ctx); static int hiti_query_matrix(struct hiti_ctx *ctx);
static int hiti_query_matrix_51x(struct hiti_ctx *ctx);
static int hiti_query_supplies(struct hiti_ctx *ctx); static int hiti_query_supplies(struct hiti_ctx *ctx);
static int hiti_query_tphv(struct hiti_ctx *ctx); static int hiti_query_tphv(struct hiti_ctx *ctx);
static int hiti_query_statistics(struct hiti_ctx *ctx); static int hiti_query_statistics(struct hiti_ctx *ctx);
@ -869,11 +871,13 @@ static int hiti_get_info(struct hiti_ctx *ctx)
ctx->erdc_rs.dpi_cols, ctx->erdc_rs.dpi_cols,
ctx->erdc_rs.dpi_rows); ctx->erdc_rs.dpi_rows);
if (ctx->conn->type != P_HITI_51X) { if (ctx->conn->type == P_HITI_51X) {
ret = hiti_query_matrix_51x(ctx);
} else {
ret = hiti_query_matrix(ctx); ret = hiti_query_matrix(ctx);
if (ret)
return CUPS_BACKEND_FAILED;
} }
if (ret)
return CUPS_BACKEND_FAILED;
uint32_t buf[2] = {0,0}; uint32_t buf[2] = {0,0};
ret = hiti_query_counter(ctx, 1, buf, ctx->erdc_rpc_len); ret = hiti_query_counter(ctx, 1, buf, ctx->erdc_rpc_len);
@ -891,7 +895,7 @@ static int hiti_get_info(struct hiti_ctx *ctx)
return CUPS_BACKEND_FAILED; return CUPS_BACKEND_FAILED;
INFO("6x8 prints: %u\n", buf[0]); INFO("6x8 prints: %u\n", buf[0]);
if (ctx->conn->type != P_HITI_51X) { {
int i; int i;
DEBUG("MAT "); DEBUG("MAT ");
for (i = 0 ; i < 256 ; i++) { for (i = 0 ; i < 256 ; i++) {
@ -2562,6 +2566,22 @@ static int hiti_query_matrix(struct hiti_ctx *ctx)
return ret; return ret;
} }
return CUPS_BACKEND_OK;
}
static int hiti_query_matrix_51x(struct hiti_ctx *ctx)
{
int ret;
int i;
uint16_t len = 1;
for (i = 0 ; i < 256 ; i++) {
uint8_t offset = i;
ret = hiti_docmd_resp(ctx, CMD_EFM_RNV, (uint8_t*)&offset, sizeof(offset), &ctx->matrix[i], &len);
if (ret)
return ret;
}
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
@ -2721,7 +2741,7 @@ static const char *hiti_prefixes[] = {
const struct dyesub_backend hiti_backend = { const struct dyesub_backend hiti_backend = {
.name = "HiTi Photo Printers", .name = "HiTi Photo Printers",
.version = "0.44", .version = "0.45",
.uri_prefixes = hiti_prefixes, .uri_prefixes = hiti_prefixes,
.cmdline_usage = hiti_cmdline, .cmdline_usage = hiti_cmdline,
.cmdline_arg = hiti_cmdline_arg, .cmdline_arg = hiti_cmdline_arg,