From a9b184d0ea951f52664f057ba64b9a4d969eba72 Mon Sep 17 00:00:00 2001 From: Baptiste MOINE Date: Fri, 6 Nov 2026 13:00:49 +0100 Subject: [PATCH] Fix the left Joy-Con rail reading as attached --- t210/mmio.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/t210/mmio.cpp b/t210/mmio.cpp index 8cd2c10..2e6dd55 100644 --- a/t210/mmio.cpp +++ b/t210/mmio.cpp @@ -561,6 +561,17 @@ uint32_t gpio_read(EmuState *state, uint64_t addr) { return v; } + // Port E IN (bank 1, port 0). PE6 is the left Joy-Con rail's attach line, + // active low, as PH6 is the right one's: nothing is plugged in, so it reads + // high while undriven. Mirroring OUT answered 0, a Joy-Con on the left rail, + // and bdk's driver took UART-C over for good. The rest mirror OUT. + if (offset == 0x130) { + uint32_t v = mmio_regs.get(addr - 0x10); + if (!(mmio_regs.get(GPIO_BASE + 0x110) & (1u << 6))) + v |= 1u << 6; + return v; + } + // Tegra X1 GPIO is organized as 8 banks of 256 bytes; within each // bank a port occupies a 4-byte slot at offsets: // CNF +0x00..0x0F (GPIO vs SPIO mode select per pin)