hiti: Implement (and decode) CMD_RDC_ROC

This commit is contained in:
Solomon Peachy 2023-04-14 14:06:08 -04:00
parent 2f5e58eab9
commit 62ae9f74f3
1 changed files with 36 additions and 4 deletions

View File

@ -62,7 +62,7 @@ struct hiti_cmd {
/* Request Device Characteristics */
#define CMD_RDC_RS 0x0100 /* Request Summary */
#define CMD_RDC_ROC 0x0104 /* Request Option Characteristics XX (1 resp on p52x, not on p51x, 16 on p461 */
#define CMD_RDC_ROC 0x0104 /* Request Option Characteristics (1 resp on p52x, not on p51x, 16 on p461 */
/* Printer Configuratio Control */
#define CMD_PCC_RP 0x0301 /* Reset Printer (1 arg) */
@ -883,6 +883,33 @@ static const char *hiti_errors(uint32_t code)
}
}
static int hiti_dump_options(struct hiti_ctx *ctx)
{
int ret;
uint8_t buf[256];
uint16_t len = 256;
int i;
uint8_t *ptr;
ret = hiti_docmd_resp(ctx, CMD_RDC_ROC, NULL, 0,
buf, &len);
if (ret)
return ret;
ptr = buf;
while (len > 0 && *ptr) {
i = ptr[ptr[1]+2];
ptr[ptr[1]+2] = 0;
INFO("Option %02x: '%s'\n", *ptr, ptr+2);
len -= ptr[1] + 2;
ptr += ptr[1] + 2;
*ptr = i;
}
return CUPS_BACKEND_OK;
}
static int hiti_get_info(struct hiti_ctx *ctx)
{
int ret;
@ -898,6 +925,12 @@ static int hiti_get_info(struct hiti_ctx *ctx)
INFO("Printer Version: %s\n", ctx->version);
INFO("Serial Number: %s\n", ctx->serno);
if (ctx->conn->type != P_HITI_51X) {
ret = hiti_dump_options(ctx);
if (ret)
return ret;
}
INFO("Calibration: H: %d V: %d\n", ctx->calibration.horiz, ctx->calibration.vert);
INFO("LED Calibration: %d %d %d / %d %d %d\n",
ctx->led_calibration[4], ctx->led_calibration[5],
@ -1604,7 +1637,7 @@ static const char* hiti_get_heat_file(struct hiti_ctx *ctx, uint8_t mode)
if (mode) {
return "P53x_heatqcrk.bin";
} else {
return "P53x_heatpcrk.bin";
return "P53x_heattcrk.bin";
}
case P_HITI_720:
if (mediatype == 0x1000) { /* CHC media */
@ -1676,7 +1709,6 @@ static const char* hiti_get_heat_file(struct hiti_ctx *ctx, uint8_t mode)
break;
case P_HITI_520:
case P_HITI_525:
case P_HITI_530:
// XXX anything?
default:
return NULL;
@ -3048,7 +3080,7 @@ const struct dyesub_backend hiti_backend = {
* Rework to take advantage of auto-vectorization?
* Pre-compute then cache entire map on disk?
* Use external "Cube LUT" implementation?
- Commands 8008, 8011, EST_SEHT, ESD_SHPTC, RDC_ROC, PCC_STP, CMD_EDM_*
- Commands 8008, 8011, EST_SEHT, ESD_SHPTC, PCC_STP, CMD_EDM_*
- Test with P720, P750
- Start research into P530D, X610
- Start research into M610, P910L (Do they have HiTi firmware?)