[PATCH v3] HID: hid-msi: Ignore unexpected 0x06 ACKs outside WRITE_PROFILE_DATA
From: Kenhou Iijima
Date: Mon Nov 16 2026 - 08:46:57 EST
On the MSI Claw handhelds (e.g. 0db0:1901), some timeout-0 commands
answer with more than one generic 0x06 ACK: SYNC_TO_ROM (0x22) sends an
immediate ACK plus a flash commit ACK about 560 ms later, and
SWITCH_MODE (0x24) can answer with a second ACK about 15 ms after the
command (~8 ms after the first ACK). The first ACK is consumed by the
orphan_ack_pending path; the delayed ones fall through to the rest of
the CLAW_COMMAND_TYPE_ACK handler.
That handler only ignores an ACK when waiting_cmd is
CLAW_COMMAND_TYPE_NONE. If a delayed 0x06 arrives while a read command
is in flight, e.g. READ_GAMEPAD_MODE after an RGB update sequence, the
ACK completes send_cmd_complete early without invoking the read response
handler: the caller returns stale cached data and the real 0x27 reply
arriving moments later is discarded. Reproduced on firmware 2.30: a
READ_GAMEPAD_MODE that normally takes about 6 ms completed in 1.56 ms
and returned the cached gamepad mode. The same fall-through also makes
every expected second ACK print a "Got unexpected ACK from MCU"
dev_warn during normal operation.
Only WRITE_PROFILE_DATA (0x21) waits for a generic 0x06 ACK; reads wait
for their own ACK command types. Complete send_cmd_complete on an ACK
only while WRITE_PROFILE_DATA is pending, and downgrade the rest to a
dev_dbg including the command being waited on so they can still be
traced when needed.
Fixes: a9517958e828 ("HID: hid-msi: Add MSI Claw configuration driver")
Signed-off-by: Kenhou Iijima <kenhou@xxxxxxxxxx>
---
Changes in v3:
- Apologies for the noise in v1/v2: the "MCU re-sends the 0x06 ACK
every ~2 s" claim was my own misdiagnosis. A local userspace LED
daemon on my test machine had a bug that kept re-writing the LED
sysfs every ~2 s, and each write's trailing SYNC_TO_ROM produced its
normal ~560 ms flash-commit ACK. Timestamped captures of the config
interface on firmware 2.30 with local userspace helpers stopped
confirm the firmware only ever sends the two ACKs described above.
Drop orphan_ack_work, claw_orphan_ack_drain(), the
disable_work_sync()/enable_work() pairing and the .reset_resume hook
accordingly: there is nothing left to drain.
- Keep the core fix: complete send_cmd_complete on a generic 0x06 ACK
only while WRITE_PROFILE_DATA is pending, and demote the
ignored-ACK log to dev_dbg with the command being waited on.
- Link to v2: https://lore.kernel.org/linux-input/20261114125059.17772-1-kenhou@xxxxxxxxxx/
- Link to v1: https://lore.kernel.org/linux-input/20261114101045.21986-1-kenhou@xxxxxxxxxx/
drivers/hid/hid-msi.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-msi.c b/drivers/hid/hid-msi.c
index 23d731f700..0c30846ac8 100644
--- a/drivers/hid/hid-msi.c
+++ b/drivers/hid/hid-msi.c
@@ -531,8 +531,20 @@ static int claw_raw_event(struct claw_drvdata *drvdata, struct hid_report *repor
break;
}
- if (drvdata->waiting_cmd == CLAW_COMMAND_TYPE_NONE) {
- dev_warn(&drvdata->hdev->dev, "Got unexpected ACK from MCU, ignoring\n");
+ if (drvdata->waiting_cmd != CLAW_COMMAND_TYPE_WRITE_PROFILE_DATA) {
+ /*
+ * Only WRITE_PROFILE_DATA waits for a generic 0x06 ACK;
+ * reads wait for their own ACK command type. SYNC_TO_ROM
+ * answers twice (an immediate ACK and a flash commit ACK
+ * ~560 ms later) and SWITCH_MODE can answer with a second
+ * delayed ACK as well; the first is consumed above, so any
+ * 0x06 arriving here is a leftover of an already finished
+ * command. Ignore it instead of completing the pending
+ * read early.
+ */
+ dev_dbg(&drvdata->hdev->dev,
+ "Got unexpected ACK from MCU, ignoring (waiting CMD: %x)\n",
+ drvdata->waiting_cmd);
break;
}
--
2.56.0