From e0a86a8983e33a3e8d7acbb0b556fff873d16956 Mon Sep 17 00:00:00 2001 From: MarcelineVPQ Date: Tue, 19 May 2026 17:56:24 -0600 Subject: [PATCH] =?UTF-8?q?fix(diag):=20mic=5Fdiag.sh=20=E2=80=94=20strip?= =?UTF-8?q?=20kernel-prepended=20report=20ID=20byte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bt-trace was reading kernel-prepended 0xFD as the low byte of bt_31 counter (and shifting all subsequent fields by 1), producing nonsensical rates like 200000/s and frame lengths of 20224 bytes. Slicing buf[1:] before decoding gives the firmware-supplied payload bytes aligned to the documented 0xFD layout. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/mic_diag.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/mic_diag.sh b/scripts/mic_diag.sh index a7fbd5f..4285e1f 100755 --- a/scripts/mic_diag.sh +++ b/scripts/mic_diag.sh @@ -173,7 +173,8 @@ def query(): buf = bytearray(32); buf[0] = 0xFD ioctl_num_32 = (3 << 30) | (32 << 16) | (ord('H') << 8) | 0x07 fcntl.ioctl(f, ioctl_num_32, buf) - return bytes(buf) + # Kernel prepends the report ID at byte 0; firmware payload starts at byte 1. + return bytes(buf[1:]) def decode(b): bt31 = struct.unpack('