diff --git a/emu_state.h b/emu_state.h index 7e26dbc..8537870 100644 --- a/emu_state.h +++ b/emu_state.h @@ -517,6 +517,10 @@ struct EmuState { // reads HOS docks with (state 0x16, 0x0B, 0x18) but not the LED or hub // messages; 2 (nintendo:mute) answers none of the dock's own messages. std::atomic dock_clone{0}; + // --dock ...:latehpd: the TV's HPD comes 25 s after the DisplayPort + // configuration instead of 150 ms (a VIA Labs adapter, 2109:0103, + // raised it after hwtest's 1.5 s wait; 25 s outlasts any wait). + std::atomic dock_late_hpd{false}; std::atomic usb_pd_voltage_mv{5000}; std::atomic usb_pd_amperage_ma{1500}; diff --git a/main.cpp b/main.cpp index 93d489a..0f65a24 100644 --- a/main.cpp +++ b/main.cpp @@ -347,7 +347,8 @@ int main(int argc, char *argv[]) { // "none"; append ":notv" for a dock with nothing on its HDMI, // ":clone" for one that answers the reads HOS docks with but // not the LED or hub messages, ":mute" for one that answers - // none of the Nintendo dock's own messages. + // none of the Nintendo dock's own messages, ":latehpd" for a + // TV whose HPD comes 25 s after DisplayPort is configured. const char *d = argv[++i]; uint8_t k = 0xFF; if (!strncmp(d, "nintendo", 8)) k = 1; @@ -361,6 +362,7 @@ int main(int argc, char *argv[]) { state.dock_kind = k; state.dock_tv = strstr(d, ":notv") == nullptr; state.dock_clone = strstr(d, ":mute") ? 2 : strstr(d, ":clone") ? 1 : 0; + state.dock_late_hpd = strstr(d, ":latehpd") != nullptr; printf("[emu] Dock: %s%s [overrides ini]\n", d, ""); } else if (strcmp(argv[i], "--oem") == 0 && i + 1 < argc) { const char *oem = argv[++i]; diff --git a/t210/dock.cpp b/t210/dock.cpp index 341744c..513bd1d 100644 --- a/t210/dock.cpp +++ b/t210/dock.cpp @@ -455,8 +455,10 @@ void command(uint16_t cmd) { chip.dp_pin = (pin & 0x08) ? 0x08 : 0x04; DLOG("DisplayPort configured, pin %c\n", chip.dp_pin == 0x08 ? 'D' : 'C'); done(LASTCMD_COMPLETE); - if (tv_present()) - after_us(150000, [] { if (chip.dp_configured) hpd_update(true); }); + if (tv_present()) { + bool late = g_state && g_state->dock_late_hpd.load(); + after_us(late ? 25000000 : 150000, [] { if (chip.dp_configured) hpd_update(true); }); + } }); break; }