[automaton] enable 256-creg sixel when DA1 advertises feature 4 #2229

This commit is contained in:
nick black 2021-10-09 09:48:08 -04:00 committed by nick black
parent 98884e21a6
commit 4df2cab5a2

View File

@ -913,6 +913,16 @@ da1_cb(inputctx* ictx){
return 1; return 1;
} }
static inline void
da1_attr_op(struct initial_responses* idata, unsigned attr){
if(attr == 4){
if(idata->color_registers <= 0){
logdebug("wooo enabling 256 sixel cregs\n");
idata->color_registers = 256;
}
}
}
static int static int
da1_attrs_cb(inputctx* ictx){ da1_attrs_cb(inputctx* ictx){
loginfo("read primary device attributes\n"); loginfo("read primary device attributes\n");
@ -920,6 +930,17 @@ da1_attrs_cb(inputctx* ictx){
char* attrlist = amata_next_kleene(&ictx->amata, "", 'c'); char* attrlist = amata_next_kleene(&ictx->amata, "", 'c');
logdebug("DA1: %u [%s]\n", val, attrlist); logdebug("DA1: %u [%s]\n", val, attrlist);
if(ictx->initdata){ if(ictx->initdata){
unsigned curattr = 0;
for(const char* a = attrlist ; *a ; ++a){
if(isdigit(*a)){
curattr *= 10;
curattr += *a - '0';
}else if(*a == ';'){
da1_attr_op(ictx->initdata, curattr);
curattr = 0;
}
}
da1_attr_op(ictx->initdata, curattr);
handoff_initial_responses(ictx); handoff_initial_responses(ictx);
} }
free(attrlist); free(attrlist);