magicard: Add sensor query support..
This commit is contained in:
parent
e14c98e7bb
commit
e42e8730b7
1
README
1
README
|
@ -806,5 +806,6 @@ Notes:
|
|||
|
||||
-s Query printer status
|
||||
-q Generate printer information dump
|
||||
-I Query printer sensors
|
||||
|
||||
***************************************************************************
|
||||
|
|
|
@ -171,6 +171,40 @@ static uint8_t * magicard_parse_resp(uint8_t *buf, uint16_t len, uint16_t *respl
|
|||
return hdr->data;
|
||||
}
|
||||
|
||||
static int magicard_query_sensors(struct magicard_ctx *ctx)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
uint8_t buf[256];
|
||||
char buf2[24];
|
||||
|
||||
for (i = 1 ; ; i++) {
|
||||
int num = 0;
|
||||
|
||||
snprintf(buf2, sizeof(buf2), "SNR%d", i);
|
||||
ret = magicard_build_cmd_simple(buf, buf2);
|
||||
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
buf, ret)))
|
||||
return ret;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
ret = read_data(ctx->dev, ctx->endp_up,
|
||||
buf, sizeof(buf), &num);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!memcmp(buf, "END", 3))
|
||||
break;
|
||||
|
||||
buf[num] = 0;
|
||||
INFO("%s\n", buf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int magicard_query_printer(struct magicard_ctx *ctx)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -682,7 +716,7 @@ static int magicard_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "sq")) >= 0) {
|
||||
while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "sqI")) >= 0) {
|
||||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 's':
|
||||
|
@ -691,6 +725,9 @@ static int magicard_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
case 'q':
|
||||
j = magicard_query_printer(ctx);
|
||||
break;
|
||||
case 'I':
|
||||
j = magicard_query_sensors(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
if (j) return j;
|
||||
|
@ -701,7 +738,7 @@ static int magicard_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
|
||||
struct dyesub_backend magicard_backend = {
|
||||
.name = "Magicard family",
|
||||
.version = "0.04",
|
||||
.version = "0.05",
|
||||
.uri_prefix = "magicard",
|
||||
.cmdline_arg = magicard_cmdline_arg,
|
||||
.cmdline_usage = magicard_cmdline,
|
||||
|
@ -742,6 +779,24 @@ struct dyesub_backend magicard_backend = {
|
|||
color data is b0b0b0b0.. b1b1b1b1.. .. b5b5b5b5.
|
||||
* Job ends with 0x03
|
||||
|
||||
** ** ** ** ** **
|
||||
|
||||
Firmware updates:
|
||||
|
||||
0x05 (x9) 0x01 REQ,FRM###### 0x1c
|
||||
|
||||
Where ###### is the length of the firmware image.
|
||||
|
||||
Then send over 64 bytes at a time until it's done.
|
||||
|
||||
Then send 0x03 to mark end of job.
|
||||
|
||||
Follow it with:
|
||||
|
||||
0x01 STA,CHK########, 0x03 (8-digit checksum?)
|
||||
|
||||
0x05 (x9) 0x01 REQ,UPG, 0x1c 0x03
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue