serch for display name in other descriptors

This commit is contained in:
King Kévin 2022-08-05 15:14:37 +02:00
parent e211a5446a
commit af416909d1
1 changed files with 9 additions and 7 deletions

16
main.c
View File

@ -169,19 +169,21 @@ static void edid_modify(uint8_t* edid)
edid[126] = 1;
}
// 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
for (uint8_t i = 0; i < 4; i++) { // go through descriptors
if ((0 != edid[54 + i * 18 + 0]) || (0 != edid[54 + i * 18 + 1]) || (0 != edid[54 + i * 18 + 2]) || (0xfc != edid[54 + i * 18 + 3]) || (0 != edid[54 + i * 18 + 4])) { // ensure descriptor is for Display name
continue;
}
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
for (last_c = 54 + i * 18 + 5; last_c < 54 + i * 18 + 18 && 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 pipe
if (last_c > 125) { // ensure we insert as the last possible character
last_c = 125;
if (last_c > 54 + i * 18 + 17) { // ensure we insert as the last possible character
last_c = 54 + i * 18 + 17;
}
edid[last_c++] = firewall_indicator; // insert pipe
if (last_c < 126) {
if (last_c < 54 + i * 18 + 17) {
edid[last_c++] = '\n'; // insert LF to terminate string
}
while (last_c < 126) {
while (last_c < 54 + i * 18 + 18) {
edid[last_c++] = ' '; // insert padding space
}
}