diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index ef95c6c1698f..61b1137d7e56 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -1300,6 +1300,28 @@ static void csi_m(struct vc_data *vc) case 27: vc->vc_reverse = 0; break; + case 38: + case 48: /* ITU T.416 + * Higher colour modes. + * They break the usual properties of SGR codes + * and thus need to be detected and ignored by + * hand. Strictly speaking, that standard also + * wants : rather than ; as separators, contrary + * to ECMA-48, but no one produces such codes + * and almost no one accepts them. + */ + i++; + if (i > vc->vc_npar) + break; + if (vc->vc_par[i] == 5) /* 256 colours */ + i++; /* ubiquitous */ + else if (vc->vc_par[i] == 2) /* 24 bit colours */ + i += 3; /* extremely rare */ + /* Subcommands 3 (CMY) and 4 (CMYK) are so insane + * that detecting them is not worth the few extra + * bytes of kernel's size. + */ + break; case 39: vc->vc_color = (vc->vc_def_color & 0x0f) | (vc->vc_color & 0xf0); break;