From 4148a3448668c38adeaa4cdee45673ad8fc95a1b Mon Sep 17 00:00:00 2001 From: shamsghani Date: Tue, 13 Oct 2026 14:52:31 +0500 Subject: [PATCH] feat(attackshark): enable live battery percent readout for X11 SE --- src/drivers/attackshark/hid.test.ts | 2 ++ src/drivers/attackshark/hid.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/drivers/attackshark/hid.test.ts b/src/drivers/attackshark/hid.test.ts index 2fa8bc10..ea8399d2 100644 --- a/src/drivers/attackshark/hid.test.ts +++ b/src/drivers/attackshark/hid.test.ts @@ -218,6 +218,8 @@ test("Attack Shark battery reports validate their signature and percentage", () // The R1 (0x10) reports charge on a 1-10 scale. assert.equal(AttackSharkHidClient.parseBatteryReport(new Uint8Array([0x03, 0x10, 0x40, 0x01, 7])), 70); assert.equal(AttackSharkHidClient.parseBatteryReport(new Uint8Array([0x03, 0x10, 0x40, 0x01, 11])), null); + // The X11 SE (0x07) reports battery percentage directly (0-100%). + assert.equal(AttackSharkHidClient.parseBatteryReport(new Uint8Array([0x03, 0x07, 0x40, 0x01, 85])), 85); // The X3 (0x4d) is named by its id, but its scale is unchecked: no battery. assert.equal(AttackSharkHidClient.parseBatteryReport(new Uint8Array([0x03, 0x4d, 0x40, 0x01, 0x64])), null); }); diff --git a/src/drivers/attackshark/hid.ts b/src/drivers/attackshark/hid.ts index 2f75b986..51939fcf 100644 --- a/src/drivers/attackshark/hid.ts +++ b/src/drivers/attackshark/hid.ts @@ -119,7 +119,7 @@ const X11_RECEIVER_MODELS: ReadonlyMap = new Map([ [0x4d, attackShark("X3")], [0x4e, attackShark("X3 Max")], [0x01, attackShark("X3 Pro")], - [0x07, attackShark("X11 SE")], + [0x07, attackShark("X11 SE", "percent")], [0xbe, attackShark("X11 Pro")], [0xb1, attackShark("X1")], [0x02, attackShark("X8 SE")],