Fix TGUI DDC read bug

This commit is contained in:
RichardG867
2021-11-10 15:37:12 -03:00
parent 02df33d1aa
commit 485403ac65

View File

@@ -606,16 +606,18 @@ tgui_in(uint16_t addr, void *p)
return svga->crtcreg; return svga->crtcreg;
case 0x3D5: case 0x3D5:
temp = svga->crtc[svga->crtcreg]; temp = svga->crtc[svga->crtcreg];
if (!(svga->crtc[0x37] & 0x04)) { if (svga->crtcreg == 0x37) {
temp &= 0xfd; if (!(temp & 0x04)) {
temp &= ~0x02;
if (i2c_gpio_get_scl(tgui->i2c)) if (i2c_gpio_get_scl(tgui->i2c))
temp |= 0x02; temp |= 0x02;
} }
if (!(svga->crtc[0x37] & 0x08)) { if (!(temp & 0x08)) {
temp &= 0xfe; temp &= ~0x01;
if (i2c_gpio_get_sda(tgui->i2c)) if (i2c_gpio_get_sda(tgui->i2c))
temp |= 0x01; temp |= 0x01;
} }
}
return temp; return temp;
case 0x3d8: case 0x3d8:
return tgui->tgui_3d8; return tgui->tgui_3d8;