main: add character in EDID product name to indicate firewall
This commit is contained in:
parent
eb4e30f79a
commit
b895c75621
26
main.c
26
main.c
|
@ -170,6 +170,32 @@ static void load_edid(void)
|
||||||
// save EDID + extension in EEPROM
|
// save EDID + extension in EEPROM
|
||||||
static bool save_edid(void)
|
static bool save_edid(void)
|
||||||
{
|
{
|
||||||
|
// modify EDID to include the character indicating the firewall
|
||||||
|
const char firewall_indicator = '|'; // sun character to indicate the firewall
|
||||||
|
// ensure descriptor 4 is for Display name
|
||||||
|
if ((0 == edid[108]) && (0 == edid[109]) && (0 == edid[110]) && (0xfc == edid[111]) && (0 == edid[112])) { // ensure descriptor 4 is for Display name
|
||||||
|
uint8_t last_c; // position of last character
|
||||||
|
for (last_c = 113; last_c < 126 && edid[last_c] != '\n'; last_c++); // find position for inserting our character
|
||||||
|
if (firewall_indicator != edid[last_c - 1]) { // the last character is not yet the sun
|
||||||
|
if (last_c > 125) { // ensure we insert as the last possible character
|
||||||
|
last_c = 125;
|
||||||
|
}
|
||||||
|
edid[last_c++] = firewall_indicator; // insert sun
|
||||||
|
if (last_c < 126) {
|
||||||
|
edid[last_c++] = '\n'; // insert LF to terminate string
|
||||||
|
}
|
||||||
|
while (last_c < 126) {
|
||||||
|
edid[last_c++] = ' '; // insert padding space
|
||||||
|
}
|
||||||
|
// calculate new checksum
|
||||||
|
uint8_t checksum = 0;
|
||||||
|
for (uint8_t i = 0; i < 127; i++) {
|
||||||
|
checksum += edid[i];
|
||||||
|
}
|
||||||
|
edid[127] = (256 - checksum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ram_eeprom_blockprog(edid, edid_length());
|
return ram_eeprom_blockprog(edid, edid_length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue