← dinohensen.nl

My Zoom TKL Dyna was eating keystrokes: Claude refused, Codex got stuck, Claude fixed it

· 6 min read

My Meletrix Zoom TKL Dyna dropped letters and doubled others. Not once a day, but in every sentence. I blamed my fingers for a while, then I blamed the keyboard, and then I did what any reasonable person does: I had the firmware pulled off the board and reverse engineered.

The short version, if you own one:

It took three attempts with two different AI coding agents. Claude would not start, Codex started but could not finish, and Claude finished it. I will say who did what, because that turned out to be the interesting part.

Part 0: Claude says no

Claude is what I normally use, so that is where I went first: get the firmware off this keyboard and reverse engineer it to find out why it misbehaves. It did not want to. Reverse engineering a vendor's firmware ran into its guardrails, and that was the end of that conversation.

It is my keyboard and my keystrokes going missing, so I took the job somewhere else.

Part 1: Codex gets the firmware out

OpenAI's Codex had no such objections. It did the groundwork:

The firmware turns the setting into a USB polling interval as 9 - setting. At high speed USB that gives:

VIA label Actual rate
1 KHz 62.5 Hz
2 KHz 125 Hz
3 KHz 250 Hz
4 KHz 500 Hz
5 KHz 1,000 Hz
6 KHz 2,000 Hz
7 KHz 4,000 Hz
8 KHz 8,000 Hz

Only the last label is right. Linux agreed: with "1 KHz" selected the endpoint showed up with a 16 ms interval.

We ended that session on "5 KHz" (a real 1,000 Hz), keyboard speed 10 ms and debounce "send to debounce". Typing felt a lot better.

But better is not fixed, and this is where Codex got stuck. It had the complete decompiled firmware in front of it and went looking for a bug. It found one path where a report could get lost when a queue was full, but could not show that it ever happens on the real keyboard. Beyond that it came up empty.

Part 2: back to Claude

A few days later I went back to Claude, this time the Fable 5.2 model, with a much smaller question: here are the decompiled sources that Codex produced, check them for potential issues, Codex could not find anything. That it was willing to do.

It found the actual bug in the function that sends keyboard reports to the computer. A USB keyboard does not push data; the computer asks for it at the polling rate. So after the keyboard hands a report to its USB hardware, that report sits there until the computer collects it. The firmware is supposed to wait for that before sending the next one.

It does not. The code checks whether its queue is empty, and if so calls a helper that sends the report immediately. That helper always returns "success" and never looks at whether the previous report is still waiting. Because it always succeeds, nothing is ever put in the queue, so the queue is always empty, so every report takes the direct path. The queue, the "previous report is done" flag and the routine that drains the queue are all in the firmware. They are just never used. That is also why Codex's lost report could not happen: the queue it needs to be full is never filled at all.

The result: two reports within one polling interval, and the second one is gone. If that second report was a key release, the computer thinks the key is still held and starts repeating it. If it was a key press, the letter never arrives.

Claude also settled what "keyboard speed" is: the debounce time in milliseconds. Mine had been on 1 ms, which lets switch bounce through as extra letters.

Proving it on the real keyboard

Reading code is nice, but I wanted to see it. Claude set up a VIA macro that types the alphabet with no delays and bound it to my Print key. One press should send 52 reports (every letter down, then up). It recorded what the laptop actually received:

Stock firmware Patched firmware
Reports received per press, out of 52 1, 1, 2, 1, 2 52, 52, 52, 52, 52
Full alphabet typed 0 of 5 5 of 5
Presses that left a key stuck 4 of 5 0 of 5

On stock firmware I got a single a, which then started repeating on its own. So VIA macros on this board are basically broken, and now we know why.

This also explains my worst day with this keyboard. While it was unknowingly at 62.5 Hz, any two key events within 16 ms could collide, and in normal fast typing that happens all the time.

The patch

The fix is small because everything needed was already there. The helper now checks the "previous report is done" flag. If the line is free it sends and marks it busy. If not, it says so, and the existing code puts the report in the existing queue, which the existing routine sends as soon as the computer has collected the previous one.

push  {r4, lr}
ldr   r3, [r0, #4]
ldr   r3, [r3, #0x24]
adds  r3, #0x97        @ the "endpoint idle" flag
ldrb  r4, [r3]
cmp   r4, #1
bne   busy
movs  r4, #0
strb  r4, [r3]         @ busy until the computer has collected it
mov   r3, r2
mov   r2, r1
movs  r1, #0x81
bl    0x0801ab84       @ the USB library's send routine
movs  r0, #0
pop   {r4, pc}
busy:
movs  r0, #1
pop   {r4, pc}

It replaces the 38 bytes at 0x08019f0a in the V4.0.0 (Oct 11 2025) image:

before: 2de9f04115460e460024074600f084fa032805d12b4632468121384600f02dfe2046bde8f081
after:  10b543685b6a97331c78012c08d100241c7013460a46812100f02ffe002010bd012010bd00bf

Before flashing, Claude ran the original and the patched code in an emulator against a simulated computer, checked that nothing else calls or jumps into those bytes, and wrote a flash script that only touches the one 2 KB page and reads everything back. I flashed it myself. The first attempt wrote nothing because fwupd was poking at the bootloader at that exact moment; the second went through.

After that I typed a few paragraphs while every report was recorded. In about 770 key presses there was no bounce, no stuck key and no lost report. What was left were three typos where I clipped the neighbouring key, which the timings show quite mercilessly. In those same recordings two reports arrived within a millisecond of each other roughly every four seconds. Each of those is a moment where the stock firmware could have lost one.

If you have this keyboard

Without flashing anything you can get most of the way, in VIA under Configure, Tools, System:

  1. Set "usb speed rate" to 5 KHz. That is the real 1,000 Hz.
  2. Set "keyboard speed" to 10ms.
  3. Set "debounce" to send to debounce.
  4. Wait five seconds before unplugging. The firmware saves settings with a delay.

Whatever you do, stay away from the low "KHz" options. They are not kilohertz and they make the bug much worse.

About the patch: it works on my board, with my firmware version, and I have used it for one evening. Flashing modified firmware can leave you with a keyboard that needs its case opened to recover, and it is probably not great for your warranty. The proper fix is a few lines in Meletrix's source, plus corrected labels in the VIA definition.

What I take away from this

I needed both agents, and not because I planned it that way. The one that turned out to be able to find the bug refused to produce the material it needed to find it. The one that was happy to dump and decompile the firmware could not see the bug in its own output. Codex did the heavy lifting and found a real but harmless oddity. Claude, handed that work, noticed that a function could never fail and followed that thread to the bug.

So the guardrail did not stop any reverse engineering. It only decided which company's model did the first half. And the part that convinced me in the end was not anyone's analysis, but the table with 1 out of 52 next to 52 out of 52.

keyboards reverse engineering linux