diff options
-rw-r--r-- | src/include/edid.h | 1 | ||||
-rw-r--r-- | src/lib/edid.c | 31 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/include/edid.h b/src/include/edid.h index e5f7d98926..a97b99b579 100644 --- a/src/include/edid.h +++ b/src/include/edid.h @@ -95,6 +95,7 @@ struct edid { int hdmi_monitor_detected; char ascii_string[EDID_ASCII_STRING_LENGTH + 1]; + char manufacturer_name[3 + 1]; }; enum edid_status { diff --git a/src/lib/edid.c b/src/lib/edid.c index 3b81b5c30a..964dce260e 100644 --- a/src/lib/edid.c +++ b/src/lib/edid.c @@ -72,7 +72,6 @@ struct edid_context { /* Stuff that isn't used anywhere but is nice to pretty-print while we're decoding everything else. */ static struct { - char manuf_name[4]; unsigned int model; unsigned int serial; unsigned int year; @@ -94,20 +93,20 @@ static struct { static struct edid tmp_edid; -static char *manufacturer_name(unsigned char *x) +static int manufacturer_name(unsigned char *x, char *output) { - extra_info.manuf_name[0] = ((x[0] & 0x7C) >> 2) + '@'; - extra_info.manuf_name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) - + '@'; - extra_info.manuf_name[2] = (x[1] & 0x1F) + '@'; - extra_info.manuf_name[3] = 0; - - if (isupper(extra_info.manuf_name[0]) && - isupper(extra_info.manuf_name[1]) && - isupper(extra_info.manuf_name[2])) - return extra_info.manuf_name; - - return NULL; + output[0] = ((x[0] & 0x7C) >> 2) + '@'; + output[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'; + output[2] = (x[1] & 0x1F) + '@'; + output[3] = 0; + + if (isupper(output[0]) && + isupper(output[1]) && + isupper(output[2])) + return 1; + + memset(output, 0, 4); + return 0; } static int @@ -1154,7 +1153,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out) return EDID_ABSENT; } - if (manufacturer_name(edid + 0x08)) + if (manufacturer_name(edid + 0x08, out->manufacturer_name)) c.manufacturer_name_well_formed = 1; extra_info.model = (unsigned short)(edid[0x0A] + (edid[0x0B] << 8)); @@ -1162,7 +1161,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out) + (edid[0x0E] << 16) + (edid[0x0F] << 24)); printk(BIOS_SPEW, "Manufacturer: %s Model %x Serial Number %u\n", - extra_info.manuf_name, + out->manufacturer_name, (unsigned short)(edid[0x0A] + (edid[0x0B] << 8)), (unsigned int)(edid[0x0C] + (edid[0x0D] << 8) + (edid[0x0E] << 16) + (edid[0x0F] << 24))); |