@openmouse/protocol 0.42.3 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/drivers/registry.d.ts +13 -1
  2. package/dist/drivers/registry.d.ts.map +1 -1
  3. package/dist/drivers/registry.js +24 -0
  4. package/dist/drivers/registry.js.map +1 -1
  5. package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.d.ts +65 -0
  6. package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.d.ts.map +1 -0
  7. package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.js +205 -0
  8. package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.js.map +1 -0
  9. package/dist/drivers/steelseries/prime-mini-hid.d.ts +59 -0
  10. package/dist/drivers/steelseries/prime-mini-hid.d.ts.map +1 -0
  11. package/dist/drivers/steelseries/prime-mini-hid.js +183 -0
  12. package/dist/drivers/steelseries/prime-mini-hid.js.map +1 -0
  13. package/dist/drivers/steelseries/rival-100-hid.d.ts +57 -0
  14. package/dist/drivers/steelseries/rival-100-hid.d.ts.map +1 -0
  15. package/dist/drivers/steelseries/rival-100-hid.js +181 -0
  16. package/dist/drivers/steelseries/rival-100-hid.js.map +1 -0
  17. package/dist/drivers/steelseries/rival-110-hid.d.ts +78 -0
  18. package/dist/drivers/steelseries/rival-110-hid.d.ts.map +1 -0
  19. package/dist/drivers/steelseries/rival-110-hid.js +206 -0
  20. package/dist/drivers/steelseries/rival-110-hid.js.map +1 -0
  21. package/dist/drivers/steelseries/rival-3-v2-hid.d.ts +59 -0
  22. package/dist/drivers/steelseries/rival-3-v2-hid.d.ts.map +1 -0
  23. package/dist/drivers/steelseries/rival-3-v2-hid.js +183 -0
  24. package/dist/drivers/steelseries/rival-3-v2-hid.js.map +1 -0
  25. package/dist/drivers/steelseries/rival-3-wireless-v2-hid.d.ts +64 -0
  26. package/dist/drivers/steelseries/rival-3-wireless-v2-hid.d.ts.map +1 -0
  27. package/dist/drivers/steelseries/rival-3-wireless-v2-hid.js +199 -0
  28. package/dist/drivers/steelseries/rival-3-wireless-v2-hid.js.map +1 -0
  29. package/dist/drivers/steelseries/rival-300-hid.d.ts +78 -0
  30. package/dist/drivers/steelseries/rival-300-hid.d.ts.map +1 -0
  31. package/dist/drivers/steelseries/rival-300-hid.js +206 -0
  32. package/dist/drivers/steelseries/rival-300-hid.js.map +1 -0
  33. package/dist/drivers/steelseries/rival-5-hid.d.ts +55 -0
  34. package/dist/drivers/steelseries/rival-5-hid.d.ts.map +1 -0
  35. package/dist/drivers/steelseries/rival-5-hid.js +177 -0
  36. package/dist/drivers/steelseries/rival-5-hid.js.map +1 -0
  37. package/dist/drivers/steelseries/rival-600-hid.d.ts +65 -0
  38. package/dist/drivers/steelseries/rival-600-hid.d.ts.map +1 -0
  39. package/dist/drivers/steelseries/rival-600-hid.js +184 -0
  40. package/dist/drivers/steelseries/rival-600-hid.js.map +1 -0
  41. package/dist/drivers/steelseries/sensei-310-hid.d.ts +54 -0
  42. package/dist/drivers/steelseries/sensei-310-hid.d.ts.map +1 -0
  43. package/dist/drivers/steelseries/sensei-310-hid.js +177 -0
  44. package/dist/drivers/steelseries/sensei-310-hid.js.map +1 -0
  45. package/dist/drivers/steelseries/sensei-raw-hid.d.ts +75 -0
  46. package/dist/drivers/steelseries/sensei-raw-hid.d.ts.map +1 -0
  47. package/dist/drivers/steelseries/sensei-raw-hid.js +199 -0
  48. package/dist/drivers/steelseries/sensei-raw-hid.js.map +1 -0
  49. package/dist/drivers/steelseries/sensei-rival-pro-hid.d.ts +42 -0
  50. package/dist/drivers/steelseries/sensei-rival-pro-hid.d.ts.map +1 -0
  51. package/dist/drivers/steelseries/sensei-rival-pro-hid.js +132 -0
  52. package/dist/drivers/steelseries/sensei-rival-pro-hid.js.map +1 -0
  53. package/dist/steelseries/aerox-3-wireless-gen2.d.ts +204 -0
  54. package/dist/steelseries/aerox-3-wireless-gen2.d.ts.map +1 -0
  55. package/dist/steelseries/aerox-3-wireless-gen2.js +301 -0
  56. package/dist/steelseries/aerox-3-wireless-gen2.js.map +1 -0
  57. package/dist/steelseries/aerox3.d.ts +3 -3
  58. package/dist/steelseries/aerox3.js +3 -3
  59. package/dist/steelseries/devices.d.ts +31 -14
  60. package/dist/steelseries/devices.d.ts.map +1 -1
  61. package/dist/steelseries/devices.js +417 -13
  62. package/dist/steelseries/devices.js.map +1 -1
  63. package/dist/steelseries/index.d.ts +12 -0
  64. package/dist/steelseries/index.d.ts.map +1 -1
  65. package/dist/steelseries/index.js +12 -0
  66. package/dist/steelseries/index.js.map +1 -1
  67. package/dist/steelseries/prime-mini-wireless.d.ts +9 -14
  68. package/dist/steelseries/prime-mini-wireless.d.ts.map +1 -1
  69. package/dist/steelseries/prime-mini-wireless.js +9 -14
  70. package/dist/steelseries/prime-mini-wireless.js.map +1 -1
  71. package/dist/steelseries/prime-mini.d.ts +173 -0
  72. package/dist/steelseries/prime-mini.d.ts.map +1 -0
  73. package/dist/steelseries/prime-mini.js +273 -0
  74. package/dist/steelseries/prime-mini.js.map +1 -0
  75. package/dist/steelseries/prime-plus.d.ts +5 -4
  76. package/dist/steelseries/prime-plus.d.ts.map +1 -1
  77. package/dist/steelseries/prime-plus.js +5 -4
  78. package/dist/steelseries/prime-plus.js.map +1 -1
  79. package/dist/steelseries/rival-100.d.ts +134 -0
  80. package/dist/steelseries/rival-100.d.ts.map +1 -0
  81. package/dist/steelseries/rival-100.js +195 -0
  82. package/dist/steelseries/rival-100.js.map +1 -0
  83. package/dist/steelseries/rival-110.d.ts +134 -0
  84. package/dist/steelseries/rival-110.d.ts.map +1 -0
  85. package/dist/steelseries/rival-110.js +205 -0
  86. package/dist/steelseries/rival-110.js.map +1 -0
  87. package/dist/steelseries/rival-3-v2.d.ts +168 -0
  88. package/dist/steelseries/rival-3-v2.d.ts.map +1 -0
  89. package/dist/steelseries/rival-3-v2.js +242 -0
  90. package/dist/steelseries/rival-3-v2.js.map +1 -0
  91. package/dist/steelseries/rival-3-wireless-v2.d.ts +219 -0
  92. package/dist/steelseries/rival-3-wireless-v2.d.ts.map +1 -0
  93. package/dist/steelseries/rival-3-wireless-v2.js +270 -0
  94. package/dist/steelseries/rival-3-wireless-v2.js.map +1 -0
  95. package/dist/steelseries/rival-300.d.ts +163 -0
  96. package/dist/steelseries/rival-300.d.ts.map +1 -0
  97. package/dist/steelseries/rival-300.js +266 -0
  98. package/dist/steelseries/rival-300.js.map +1 -0
  99. package/dist/steelseries/rival-5.d.ts +165 -0
  100. package/dist/steelseries/rival-5.d.ts.map +1 -0
  101. package/dist/steelseries/rival-5.js +212 -0
  102. package/dist/steelseries/rival-5.js.map +1 -0
  103. package/dist/steelseries/rival-600.d.ts +194 -0
  104. package/dist/steelseries/rival-600.d.ts.map +1 -0
  105. package/dist/steelseries/rival-600.js +262 -0
  106. package/dist/steelseries/rival-600.js.map +1 -0
  107. package/dist/steelseries/sensei-310.d.ts +162 -0
  108. package/dist/steelseries/sensei-310.d.ts.map +1 -0
  109. package/dist/steelseries/sensei-310.js +250 -0
  110. package/dist/steelseries/sensei-310.js.map +1 -0
  111. package/dist/steelseries/sensei-raw.d.ts +169 -0
  112. package/dist/steelseries/sensei-raw.d.ts.map +1 -0
  113. package/dist/steelseries/sensei-raw.js +233 -0
  114. package/dist/steelseries/sensei-raw.js.map +1 -0
  115. package/dist/steelseries/sensei-rival-pro.d.ts +214 -0
  116. package/dist/steelseries/sensei-rival-pro.d.ts.map +1 -0
  117. package/dist/steelseries/sensei-rival-pro.js +298 -0
  118. package/dist/steelseries/sensei-rival-pro.js.map +1 -0
  119. package/package.json +1 -1
@@ -0,0 +1,219 @@
1
+ /**
2
+ * SteelSeries Rival 3 Wireless Gen 2 configuration protocol — pure
3
+ * encode/decode helpers.
4
+ *
5
+ * Reconstructed from the vendor's own software, not from a third-party
6
+ * reimplementation: SteelSeries GG 121.0.0 ships
7
+ * `rival-3-wireless-v2.lisp` under
8
+ * `apps/engine/install/deviceSpecifications/`, and this module transcribes
9
+ * it. Those files are OpenPGP-armored ("DESCRIPTOR" armor, SKESK/AES-128);
10
+ * the bytes below are the documented HID report payloads, not guesses.
11
+ * rivalcfg lists a `rival3_wireless_gen2` profile (PID `1038:1872`) but its
12
+ * command set was never readable in this environment, so nothing here is
13
+ * corroborated beyond the vendor file — treat every byte as
14
+ * vendor-documented but not yet hardware-verified.
15
+ *
16
+ * Despite the shared "Rival 3 Wireless" name this is a different command
17
+ * set from Rival 3 Wireless Gen 1 (`./rival3-wireless.ts`: single-byte DPI
18
+ * `0x20`, 6 button slots, single lighting zone, `0xAA` 3-byte battery
19
+ * shape). The Gen 2 uses XY DPI (`0x2C`), 7 button slots plus a separate
20
+ * 2-slot wheel mapping, no lighting at all, and a 2-byte battery reply.
21
+ *
22
+ * Every command is an HID **output report** with report id 0x00 (65-byte
23
+ * reports throughout the specification). The specification frames commands
24
+ * through `write-op`/`read-op` mask helpers; on this 2.4 GHz-mode product
25
+ * id both masks are `0x00`, so the bytes go on the wire as written.
26
+ *
27
+ * DPI uses an XY batch (`0x2C`): `max_level` (0x01–0x05), `index`
28
+ * (0x01–0x05, **1-based** — unlike every other SteelSeries XY family in
29
+ * this package, which are 0-based), then five horizontal bytes followed by
30
+ * five vertical bytes (split arrays, not interleaved). The sensor table is
31
+ * TrueMove Air (100–18000), imported from `./rival3-wireless.ts`'s
32
+ * `TRUEMOVE_AIR_DPI_TO_BYTE` — the vendor file includes the same table
33
+ * (spot-checked `0x04→400`, `0x12→1600`, `0xD6→18000`). The specification
34
+ * always carries all five pairs per axis, so this codec requires exactly
35
+ * five presets rather than guessing at padding for shorter tables.
36
+ *
37
+ * Polling (`0x17`, values 1000→0x00, 500→0x01, 250→0x02, 125→0x03 — the
38
+ * same mapping as Gen 1's identical command byte, confirmed by direct
39
+ * comparison, not assumed) has a read-back, defined but not decoded here.
40
+ * Buttons are one 35-byte packet (7 slots × 5-byte fields: function byte
41
+ * plus 4 key-code bytes), command `0x19`, plus a separate 2-slot wheel
42
+ * mapping, command `0x1A`. The 7th button slot has no confirmed physical
43
+ * identity (the GG seed data exposes 6 buttons); it is encodable as
44
+ * `button7` and zero-filled when unmapped, both flagged here.
45
+ *
46
+ * Known but deliberately not implemented — documented so nobody re-derives
47
+ * them, withheld until there is hardware evidence and a reason to ship them:
48
+ *
49
+ * - `read_polling_rate` — polling read-back.
50
+ * - `power_mode` (`0x2B`, sleep timer only) and `wireless_power_mode`
51
+ * (`0x2E`, no-redundancy / boosted-bluetooth flags).
52
+ * - Accelerometer/deceleration and angle snapping: driver-side (`SSE`)
53
+ * settings, not HID commands, out of scope for this codec.
54
+ *
55
+ * This mouse has no lighting commands at all. Settings apply immediately;
56
+ * the save command (`0x09`, one byte) persists them to onboard flash. None
57
+ * of this has been verified on physical hardware by this project.
58
+ */
59
+ export declare const RIVAL3_WIRELESS_V2_REPORT_ID = 0;
60
+ /** Command prefixes; the payload is the prefix plus its arguments. */
61
+ export declare const RIVAL3_WIRELESS_V2_COMMAND: {
62
+ readonly dpiPresets: readonly [44];
63
+ readonly pollingRate: readonly [23];
64
+ readonly buttonsMapping: readonly [25];
65
+ readonly wheelMapping: readonly [26];
66
+ readonly batteryLevel: readonly [170, 1];
67
+ readonly firmware: readonly [16];
68
+ };
69
+ /** `0x09` — one byte; commit the current settings to onboard flash. */
70
+ export declare const RIVAL3_WIRELESS_V2_SAVE_COMMAND: readonly [9];
71
+ export declare const RIVAL3_WIRELESS_V2_POLLING_RATES: readonly [125, 250, 500, 1000];
72
+ export declare const RIVAL3_WIRELESS_V2_DPI_MIN = 100;
73
+ export declare const RIVAL3_WIRELESS_V2_DPI_MAX = 18000;
74
+ export declare const RIVAL3_WIRELESS_V2_DPI_STEP = 100;
75
+ export declare const RIVAL3_WIRELESS_V2_MAX_DPI_PRESETS = 5;
76
+ export declare const RIVAL3_WIRELESS_V2_BATTERY_RESPONSE_LENGTH = 2;
77
+ /** Factory table shared across the modern SteelSeries families. */
78
+ export declare const RIVAL3_WIRELESS_V2_DEFAULT_DPI_PRESETS: readonly [400, 800, 1600, 2400, 3200];
79
+ export declare const RIVAL3_WIRELESS_V2_DEFAULT_POLLING_RATE = 1000;
80
+ export declare class Rival3WirelessV2ProtocolError extends Error {
81
+ }
82
+ /** One DPI preset: independent X/Y sensitivities. */
83
+ export interface Rival3WirelessV2DpiPreset {
84
+ x: number;
85
+ y: number;
86
+ }
87
+ /** Every DPI value the shared TrueMove Air table can express, ascending. */
88
+ export declare function steelseriesRival3WirelessV2DpiOptions(): number[];
89
+ /**
90
+ * `2C <count 1–5> <selected 1-based> <x0…x4> <y0…y4>` — replaces the
91
+ * mouse's whole preset table with five horizontal bytes followed by five
92
+ * vertical bytes. Exactly five presets are required (see the module doc
93
+ * comment); `selectedIndex` is 0-based here and encoded 1-based on the
94
+ * wire — the reverse of the Gen 1 convention, so do not reuse that
95
+ * encoder.
96
+ */
97
+ export declare function steelseriesRival3WirelessV2EncodeDpiPresets(presets: readonly Rival3WirelessV2DpiPreset[], selectedIndex: number): Uint8Array;
98
+ /** `17 <v>` with 1000→0x00, 500→0x01, 250→0x02, 125→0x03. */
99
+ export declare function steelseriesRival3WirelessV2EncodePollingRate(pollingRateHz: number): Uint8Array;
100
+ /** `09` — commit the current settings to onboard flash. */
101
+ export declare function steelseriesRival3WirelessV2SaveCommand(): Uint8Array;
102
+ /** `AA 01` — answered by a two-byte input report. */
103
+ export declare function steelseriesRival3WirelessV2BatteryQuery(): Uint8Array;
104
+ export interface Rival3WirelessV2Battery {
105
+ /** Battery level as reported (0–100 scale per the specification's GG mapping). */
106
+ level: number;
107
+ }
108
+ /**
109
+ * Decode the two-byte battery reply as a little-endian level. Unlike Gen
110
+ * 1's 3-byte reply this packet carries no charging flag, so charging state
111
+ * stays unknown — do not infer it.
112
+ */
113
+ export declare function steelseriesRival3WirelessV2DecodeBattery(payload: Uint8Array): Rival3WirelessV2Battery;
114
+ /** `10` — the mouse answers with major/minor firmware bytes. */
115
+ export declare function steelseriesRival3WirelessV2FirmwareQuery(): Uint8Array;
116
+ export interface Rival3WirelessV2Firmware {
117
+ /** The two raw response bytes, in the order the device sent them. */
118
+ bytes: [number, number];
119
+ /** The bytes joined in read order, e.g. "1.5". */
120
+ display: string;
121
+ }
122
+ /** Decode the two-byte firmware reply, read-order convention as usual. */
123
+ export declare function steelseriesRival3WirelessV2DecodeFirmware(payload: Uint8Array): Rival3WirelessV2Firmware;
124
+ /**
125
+ * 7 button slots. The 7th slot's physical identity is unconfirmed (the GG
126
+ * seed exposes 6 buttons); it is encodable and zero-filled when unmapped —
127
+ * see the module doc comment.
128
+ */
129
+ export declare const RIVAL3_WIRELESS_V2_BUTTONS: {
130
+ readonly button1: {
131
+ readonly id: 1;
132
+ readonly offset: 0;
133
+ };
134
+ readonly button2: {
135
+ readonly id: 2;
136
+ readonly offset: 5;
137
+ };
138
+ readonly button3: {
139
+ readonly id: 3;
140
+ readonly offset: 10;
141
+ };
142
+ readonly button4: {
143
+ readonly id: 4;
144
+ readonly offset: 15;
145
+ };
146
+ readonly button5: {
147
+ readonly id: 5;
148
+ readonly offset: 20;
149
+ };
150
+ readonly button6: {
151
+ readonly id: 6;
152
+ readonly offset: 25;
153
+ };
154
+ readonly button7: {
155
+ readonly id: 7;
156
+ readonly offset: 30;
157
+ };
158
+ };
159
+ export type Rival3WirelessV2ButtonName = keyof typeof RIVAL3_WIRELESS_V2_BUTTONS;
160
+ /** The 2 scroll-wheel slots use the same field shape under command `0x1A`. */
161
+ export declare const RIVAL3_WIRELESS_V2_WHEEL_BUTTONS: {
162
+ readonly scrollUp: {
163
+ readonly id: 49;
164
+ readonly offset: 0;
165
+ };
166
+ readonly scrollDown: {
167
+ readonly id: 50;
168
+ readonly offset: 5;
169
+ };
170
+ };
171
+ export type Rival3WirelessV2WheelName = keyof typeof RIVAL3_WIRELESS_V2_WHEEL_BUTTONS;
172
+ export type Rival3WirelessV2ButtonAction = {
173
+ type: "button";
174
+ target: Rival3WirelessV2ButtonName;
175
+ } | {
176
+ type: "disabled";
177
+ } | {
178
+ type: "dpiSwitch";
179
+ } | {
180
+ type: "scrollUp";
181
+ } | {
182
+ type: "scrollDown";
183
+ } | {
184
+ type: "keyboard";
185
+ code: number;
186
+ } | {
187
+ type: "multimedia";
188
+ code: number;
189
+ };
190
+ export type Rival3WirelessV2WheelAction = {
191
+ type: "button";
192
+ target: Rival3WirelessV2ButtonName | Rival3WirelessV2WheelName;
193
+ } | {
194
+ type: "disabled";
195
+ } | {
196
+ type: "dpiSwitch";
197
+ } | {
198
+ type: "scrollUp";
199
+ } | {
200
+ type: "scrollDown";
201
+ } | {
202
+ type: "keyboard";
203
+ code: number;
204
+ } | {
205
+ type: "multimedia";
206
+ code: number;
207
+ };
208
+ /**
209
+ * `19` + one 35-byte packet (7 slots × 5-byte fields), zero-filled except
210
+ * where a mapping is given. Pass every button explicitly — unmapped buttons
211
+ * stay disabled, matching this package's no-silent-defaults policy.
212
+ */
213
+ export declare function steelseriesRival3WirelessV2EncodeButtonsMapping(mapping: Partial<Record<Rival3WirelessV2ButtonName, Rival3WirelessV2ButtonAction>>): Uint8Array;
214
+ /**
215
+ * `1A` + one 10-byte packet (2 wheel slots × 5-byte fields). The wheel
216
+ * mapping is always written to flash alongside buttons on the real device.
217
+ */
218
+ export declare function steelseriesRival3WirelessV2EncodeWheelMapping(mapping: Partial<Record<Rival3WirelessV2WheelName, Rival3WirelessV2WheelAction>>): Uint8Array;
219
+ //# sourceMappingURL=rival-3-wireless-v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rival-3-wireless-v2.d.ts","sourceRoot":"","sources":["../../src/steelseries/rival-3-wireless-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAIH,eAAO,MAAM,4BAA4B,IAAO,CAAC;AAEjD,sEAAsE;AACtE,eAAO,MAAM,0BAA0B;;;;;;;CAO7B,CAAC;AAEX,uEAAuE;AACvE,eAAO,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AyDzC;;;;GAIG;AACH,wBAAgB,+CAA+C,CAC7D,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,4BAA4B,CAAC,CAAC,GACjF,UAAU,CAeZ;AAED;;;GAGG;AACH,wBAAgB,6CAA6C,CAC3D,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,CAAC,GAC/E,UAAU,CAeZ"}
@@ -0,0 +1,270 @@
1
+ /**
2
+ * SteelSeries Rival 3 Wireless Gen 2 configuration protocol — pure
3
+ * encode/decode helpers.
4
+ *
5
+ * Reconstructed from the vendor's own software, not from a third-party
6
+ * reimplementation: SteelSeries GG 121.0.0 ships
7
+ * `rival-3-wireless-v2.lisp` under
8
+ * `apps/engine/install/deviceSpecifications/`, and this module transcribes
9
+ * it. Those files are OpenPGP-armored ("DESCRIPTOR" armor, SKESK/AES-128);
10
+ * the bytes below are the documented HID report payloads, not guesses.
11
+ * rivalcfg lists a `rival3_wireless_gen2` profile (PID `1038:1872`) but its
12
+ * command set was never readable in this environment, so nothing here is
13
+ * corroborated beyond the vendor file — treat every byte as
14
+ * vendor-documented but not yet hardware-verified.
15
+ *
16
+ * Despite the shared "Rival 3 Wireless" name this is a different command
17
+ * set from Rival 3 Wireless Gen 1 (`./rival3-wireless.ts`: single-byte DPI
18
+ * `0x20`, 6 button slots, single lighting zone, `0xAA` 3-byte battery
19
+ * shape). The Gen 2 uses XY DPI (`0x2C`), 7 button slots plus a separate
20
+ * 2-slot wheel mapping, no lighting at all, and a 2-byte battery reply.
21
+ *
22
+ * Every command is an HID **output report** with report id 0x00 (65-byte
23
+ * reports throughout the specification). The specification frames commands
24
+ * through `write-op`/`read-op` mask helpers; on this 2.4 GHz-mode product
25
+ * id both masks are `0x00`, so the bytes go on the wire as written.
26
+ *
27
+ * DPI uses an XY batch (`0x2C`): `max_level` (0x01–0x05), `index`
28
+ * (0x01–0x05, **1-based** — unlike every other SteelSeries XY family in
29
+ * this package, which are 0-based), then five horizontal bytes followed by
30
+ * five vertical bytes (split arrays, not interleaved). The sensor table is
31
+ * TrueMove Air (100–18000), imported from `./rival3-wireless.ts`'s
32
+ * `TRUEMOVE_AIR_DPI_TO_BYTE` — the vendor file includes the same table
33
+ * (spot-checked `0x04→400`, `0x12→1600`, `0xD6→18000`). The specification
34
+ * always carries all five pairs per axis, so this codec requires exactly
35
+ * five presets rather than guessing at padding for shorter tables.
36
+ *
37
+ * Polling (`0x17`, values 1000→0x00, 500→0x01, 250→0x02, 125→0x03 — the
38
+ * same mapping as Gen 1's identical command byte, confirmed by direct
39
+ * comparison, not assumed) has a read-back, defined but not decoded here.
40
+ * Buttons are one 35-byte packet (7 slots × 5-byte fields: function byte
41
+ * plus 4 key-code bytes), command `0x19`, plus a separate 2-slot wheel
42
+ * mapping, command `0x1A`. The 7th button slot has no confirmed physical
43
+ * identity (the GG seed data exposes 6 buttons); it is encodable as
44
+ * `button7` and zero-filled when unmapped, both flagged here.
45
+ *
46
+ * Known but deliberately not implemented — documented so nobody re-derives
47
+ * them, withheld until there is hardware evidence and a reason to ship them:
48
+ *
49
+ * - `read_polling_rate` — polling read-back.
50
+ * - `power_mode` (`0x2B`, sleep timer only) and `wireless_power_mode`
51
+ * (`0x2E`, no-redundancy / boosted-bluetooth flags).
52
+ * - Accelerometer/deceleration and angle snapping: driver-side (`SSE`)
53
+ * settings, not HID commands, out of scope for this codec.
54
+ *
55
+ * This mouse has no lighting commands at all. Settings apply immediately;
56
+ * the save command (`0x09`, one byte) persists them to onboard flash. None
57
+ * of this has been verified on physical hardware by this project.
58
+ */
59
+ import { TRUEMOVE_AIR_DPI_TO_BYTE } from "./rival3-wireless.js";
60
+ export const RIVAL3_WIRELESS_V2_REPORT_ID = 0x00;
61
+ /** Command prefixes; the payload is the prefix plus its arguments. */
62
+ export const RIVAL3_WIRELESS_V2_COMMAND = {
63
+ dpiPresets: [0x2c],
64
+ pollingRate: [0x17],
65
+ buttonsMapping: [0x19],
66
+ wheelMapping: [0x1a],
67
+ batteryLevel: [0xaa, 0x01],
68
+ firmware: [0x10],
69
+ };
70
+ /** `0x09` — one byte; commit the current settings to onboard flash. */
71
+ export const RIVAL3_WIRELESS_V2_SAVE_COMMAND = [0x09];
72
+ export const RIVAL3_WIRELESS_V2_POLLING_RATES = [125, 250, 500, 1000];
73
+ const POLLING_RATE_TO_BYTE = new Map([
74
+ [1000, 0x00],
75
+ [500, 0x01],
76
+ [250, 0x02],
77
+ [125, 0x03],
78
+ ]);
79
+ export const RIVAL3_WIRELESS_V2_DPI_MIN = 100;
80
+ export const RIVAL3_WIRELESS_V2_DPI_MAX = 18000;
81
+ export const RIVAL3_WIRELESS_V2_DPI_STEP = 100;
82
+ export const RIVAL3_WIRELESS_V2_MAX_DPI_PRESETS = 5;
83
+ export const RIVAL3_WIRELESS_V2_BATTERY_RESPONSE_LENGTH = 2;
84
+ /** Factory table shared across the modern SteelSeries families. */
85
+ export const RIVAL3_WIRELESS_V2_DEFAULT_DPI_PRESETS = [400, 800, 1600, 2400, 3200];
86
+ export const RIVAL3_WIRELESS_V2_DEFAULT_POLLING_RATE = 1000;
87
+ export class Rival3WirelessV2ProtocolError extends Error {
88
+ }
89
+ /** Every DPI value the shared TrueMove Air table can express, ascending. */
90
+ export function steelseriesRival3WirelessV2DpiOptions() {
91
+ return [...TRUEMOVE_AIR_DPI_TO_BYTE.keys()].sort((a, b) => a - b);
92
+ }
93
+ function dpiToByte(dpi) {
94
+ const byte = TRUEMOVE_AIR_DPI_TO_BYTE.get(dpi);
95
+ if (byte === undefined) {
96
+ throw new Rival3WirelessV2ProtocolError(`SteelSeries Rival 3 Wireless Gen 2 DPI must be ${RIVAL3_WIRELESS_V2_DPI_MIN}–${RIVAL3_WIRELESS_V2_DPI_MAX.toLocaleString("en-US")} in ${RIVAL3_WIRELESS_V2_DPI_STEP} DPI steps.`);
97
+ }
98
+ return byte;
99
+ }
100
+ /**
101
+ * `2C <count 1–5> <selected 1-based> <x0…x4> <y0…y4>` — replaces the
102
+ * mouse's whole preset table with five horizontal bytes followed by five
103
+ * vertical bytes. Exactly five presets are required (see the module doc
104
+ * comment); `selectedIndex` is 0-based here and encoded 1-based on the
105
+ * wire — the reverse of the Gen 1 convention, so do not reuse that
106
+ * encoder.
107
+ */
108
+ export function steelseriesRival3WirelessV2EncodeDpiPresets(presets, selectedIndex) {
109
+ if (presets.length !== RIVAL3_WIRELESS_V2_MAX_DPI_PRESETS) {
110
+ throw new Rival3WirelessV2ProtocolError(`SteelSeries Rival 3 Wireless Gen 2 requires exactly ${RIVAL3_WIRELESS_V2_MAX_DPI_PRESETS} DPI presets.`);
111
+ }
112
+ if (!Number.isInteger(selectedIndex) || selectedIndex < 0 || selectedIndex >= presets.length) {
113
+ throw new Rival3WirelessV2ProtocolError(`Selected DPI preset must be an index into the ${presets.length} presets being written.`);
114
+ }
115
+ return new Uint8Array([
116
+ ...RIVAL3_WIRELESS_V2_COMMAND.dpiPresets,
117
+ presets.length,
118
+ selectedIndex + 1,
119
+ ...presets.map((preset) => dpiToByte(preset.x)),
120
+ ...presets.map((preset) => dpiToByte(preset.y)),
121
+ ]);
122
+ }
123
+ /** `17 <v>` with 1000→0x00, 500→0x01, 250→0x02, 125→0x03. */
124
+ export function steelseriesRival3WirelessV2EncodePollingRate(pollingRateHz) {
125
+ const byte = POLLING_RATE_TO_BYTE.get(pollingRateHz);
126
+ if (byte === undefined) {
127
+ throw new Rival3WirelessV2ProtocolError("SteelSeries Rival 3 Wireless Gen 2 supports 125, 250, 500, or 1000 Hz polling.");
128
+ }
129
+ return new Uint8Array([...RIVAL3_WIRELESS_V2_COMMAND.pollingRate, byte]);
130
+ }
131
+ /** `09` — commit the current settings to onboard flash. */
132
+ export function steelseriesRival3WirelessV2SaveCommand() {
133
+ return new Uint8Array(RIVAL3_WIRELESS_V2_SAVE_COMMAND);
134
+ }
135
+ /** `AA 01` — answered by a two-byte input report. */
136
+ export function steelseriesRival3WirelessV2BatteryQuery() {
137
+ return new Uint8Array(RIVAL3_WIRELESS_V2_COMMAND.batteryLevel);
138
+ }
139
+ /**
140
+ * Decode the two-byte battery reply as a little-endian level. Unlike Gen
141
+ * 1's 3-byte reply this packet carries no charging flag, so charging state
142
+ * stays unknown — do not infer it.
143
+ */
144
+ export function steelseriesRival3WirelessV2DecodeBattery(payload) {
145
+ if (payload.length < RIVAL3_WIRELESS_V2_BATTERY_RESPONSE_LENGTH) {
146
+ throw new Rival3WirelessV2ProtocolError("SteelSeries Rival 3 Wireless Gen 2 battery response is shorter than two bytes.");
147
+ }
148
+ return { level: payload[0] | (payload[1] << 8) };
149
+ }
150
+ /** `10` — the mouse answers with major/minor firmware bytes. */
151
+ export function steelseriesRival3WirelessV2FirmwareQuery() {
152
+ return new Uint8Array(RIVAL3_WIRELESS_V2_COMMAND.firmware);
153
+ }
154
+ /** Decode the two-byte firmware reply, read-order convention as usual. */
155
+ export function steelseriesRival3WirelessV2DecodeFirmware(payload) {
156
+ if (payload.length < 2) {
157
+ throw new Rival3WirelessV2ProtocolError("SteelSeries Rival 3 Wireless Gen 2 firmware response is shorter than two bytes.");
158
+ }
159
+ const bytes = [payload[0], payload[1]];
160
+ return { bytes, display: `${bytes[0]}.${bytes[1]}` };
161
+ }
162
+ // -- Button mapping --------------------------------------------------------
163
+ /**
164
+ * 7 button slots. The 7th slot's physical identity is unconfirmed (the GG
165
+ * seed exposes 6 buttons); it is encodable and zero-filled when unmapped —
166
+ * see the module doc comment.
167
+ */
168
+ export const RIVAL3_WIRELESS_V2_BUTTONS = {
169
+ button1: { id: 0x01, offset: 0x00 },
170
+ button2: { id: 0x02, offset: 0x05 },
171
+ button3: { id: 0x03, offset: 0x0a },
172
+ button4: { id: 0x04, offset: 0x0f },
173
+ button5: { id: 0x05, offset: 0x14 },
174
+ button6: { id: 0x06, offset: 0x19 },
175
+ button7: { id: 0x07, offset: 0x1e },
176
+ };
177
+ /** The 2 scroll-wheel slots use the same field shape under command `0x1A`. */
178
+ export const RIVAL3_WIRELESS_V2_WHEEL_BUTTONS = {
179
+ scrollUp: { id: 0x31, offset: 0x00 },
180
+ scrollDown: { id: 0x32, offset: 0x05 },
181
+ };
182
+ const BUTTON_FIELD_LENGTH = 5;
183
+ const BUTTON_DISABLE = 0x00;
184
+ const BUTTON_DPI_SWITCH = 0x30;
185
+ const BUTTON_KEYBOARD = 0x51;
186
+ const BUTTON_MULTIMEDIA = 0x61;
187
+ function encodeKeyCode(code, kind) {
188
+ if (!Number.isInteger(code) || code < 0 || code > 255) {
189
+ throw new Rival3WirelessV2ProtocolError(`${kind} codes must be integers 0–255.`);
190
+ }
191
+ return code;
192
+ }
193
+ function encodeAction(packet, offset, action) {
194
+ switch (action.type) {
195
+ case "button": {
196
+ const target = RIVAL3_WIRELESS_V2_BUTTONS[action.target] ??
197
+ RIVAL3_WIRELESS_V2_WHEEL_BUTTONS[action.target];
198
+ if (!target) {
199
+ throw new Rival3WirelessV2ProtocolError(`Unknown SteelSeries Rival 3 Wireless Gen 2 button "${action.target}".`);
200
+ }
201
+ packet[offset] = target.id;
202
+ break;
203
+ }
204
+ case "disabled": {
205
+ packet[offset] = BUTTON_DISABLE;
206
+ break;
207
+ }
208
+ case "dpiSwitch": {
209
+ packet[offset] = BUTTON_DPI_SWITCH;
210
+ break;
211
+ }
212
+ case "scrollUp": {
213
+ packet[offset] = RIVAL3_WIRELESS_V2_WHEEL_BUTTONS.scrollUp.id;
214
+ break;
215
+ }
216
+ case "scrollDown": {
217
+ packet[offset] = RIVAL3_WIRELESS_V2_WHEEL_BUTTONS.scrollDown.id;
218
+ break;
219
+ }
220
+ case "keyboard": {
221
+ packet[offset] = BUTTON_KEYBOARD;
222
+ packet[offset + 1] = encodeKeyCode(action.code, "Keyboard scan");
223
+ break;
224
+ }
225
+ case "multimedia": {
226
+ packet[offset] = BUTTON_MULTIMEDIA;
227
+ packet[offset + 1] = encodeKeyCode(action.code, "Multimedia key");
228
+ break;
229
+ }
230
+ default: {
231
+ throw new Rival3WirelessV2ProtocolError("Unsupported SteelSeries Rival 3 Wireless Gen 2 button action.");
232
+ }
233
+ }
234
+ }
235
+ /**
236
+ * `19` + one 35-byte packet (7 slots × 5-byte fields), zero-filled except
237
+ * where a mapping is given. Pass every button explicitly — unmapped buttons
238
+ * stay disabled, matching this package's no-silent-defaults policy.
239
+ */
240
+ export function steelseriesRival3WirelessV2EncodeButtonsMapping(mapping) {
241
+ for (const name of Object.keys(mapping)) {
242
+ if (!Object.hasOwn(RIVAL3_WIRELESS_V2_BUTTONS, name)) {
243
+ throw new Rival3WirelessV2ProtocolError(`Unknown SteelSeries Rival 3 Wireless Gen 2 button "${name}".`);
244
+ }
245
+ }
246
+ const names = Object.keys(RIVAL3_WIRELESS_V2_BUTTONS);
247
+ const packet = new Array(names.length * BUTTON_FIELD_LENGTH).fill(0x00);
248
+ for (const [name, action] of Object.entries(mapping)) {
249
+ encodeAction(packet, RIVAL3_WIRELESS_V2_BUTTONS[name].offset, action);
250
+ }
251
+ return new Uint8Array([...RIVAL3_WIRELESS_V2_COMMAND.buttonsMapping, ...packet]);
252
+ }
253
+ /**
254
+ * `1A` + one 10-byte packet (2 wheel slots × 5-byte fields). The wheel
255
+ * mapping is always written to flash alongside buttons on the real device.
256
+ */
257
+ export function steelseriesRival3WirelessV2EncodeWheelMapping(mapping) {
258
+ for (const name of Object.keys(mapping)) {
259
+ if (!Object.hasOwn(RIVAL3_WIRELESS_V2_WHEEL_BUTTONS, name)) {
260
+ throw new Rival3WirelessV2ProtocolError(`Unknown SteelSeries Rival 3 Wireless Gen 2 wheel "${name}".`);
261
+ }
262
+ }
263
+ const names = Object.keys(RIVAL3_WIRELESS_V2_WHEEL_BUTTONS);
264
+ const packet = new Array(names.length * BUTTON_FIELD_LENGTH).fill(0x00);
265
+ for (const [name, action] of Object.entries(mapping)) {
266
+ encodeAction(packet, RIVAL3_WIRELESS_V2_WHEEL_BUTTONS[name].offset, action);
267
+ }
268
+ return new Uint8Array([...RIVAL3_WIRELESS_V2_COMMAND.wheelMapping, ...packet]);
269
+ }
270
+ //# sourceMappingURL=rival-3-wireless-v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rival-3-wireless-v2.js","sourceRoot":"","sources":["../../src/steelseries/rival-3-wireless-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD,sEAAsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,UAAU,EAAE,CAAC,IAAI,CAAC;IAClB,WAAW,EAAE,CAAC,IAAI,CAAC;IACnB,cAAc,EAAE,CAAC,IAAI,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IAC1B,QAAQ,EAAE,CAAC,IAAI,CAAC;CACR,CAAC;AAEX,uEAAuE;AACvE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,IAAI,CAAU,CAAC;AAE/D,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAU,CAAC;AAE/E,MAAM,oBAAoB,GAAgC,IAAI,GAAG,CAAC;IAChE,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;CACZ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAChD,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAC/C,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAC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4
+ * Reconstructed from the vendor's own software, not from a third-party
5
+ * reimplementation: SteelSeries GG 121.0.0 ships `rival_base.lisp` (the
6
+ * shared profile) plus `rival_300.lisp`, `dota2-rival-mouse.lisp`,
7
+ * `predator-mouse.lisp`, `csgo-rival-300.lisp`, `csgo-rival-300-stm32.lisp`,
8
+ * `fallout_4_rival_300.lisp`, `hp_omen_rival_300.lisp`,
9
+ * `csgo-hyperbeast-rival-300.lisp` and `eg-rival-300.lisp`, all of which
10
+ * `include "rival_base"`. This module transcribes that command set. Those
11
+ * files are OpenPGP-armored ("DESCRIPTOR" armor, SKESK/AES-128). rivalcfg's
12
+ * `rival300.py` (which lists the same product ids) independently
13
+ * corroborates every command byte.
14
+ *
15
+ * This is the original Rival / Rival 300 command set, distinct from Rival
16
+ * 100 (`./rival-100.ts`) and Rival 110 (`./rival-110.ts`): the DPI byte is a
17
+ * linear range (not a choice table), the two LED zones have independent
18
+ * color and effect commands, and the six buttons are remappable.
19
+ *
20
+ * Every command is an HID **output report** with report id 0x00 (33-byte
21
+ * reports — `HIDIO 33`).
22
+ *
23
+ * DPI uses two per-level commands (`03 01`/`03 02`) with a linear byte:
24
+ * rivalcfg's `input_range [50, 6500, 50]` against `output_range [0x01,
25
+ * 0x82, 1]`, so `byte = (dpi - 50) / 50 + 1`, range 0x01–0x82
26
+ * (50–6500 DPI in 50 DPI steps). The vendor struct carries a trailing
27
+ * `dcpi` byte (`0x00` or `0xAA`) that rivalcfg leaves at 0; this codec
28
+ * matches rivalcfg and does not emit it. Off-grid values are rejected.
29
+ *
30
+ * Polling (`04 00`) is write-only (1000→0x01, 500→0x02, 250→0x03,
31
+ * 125→0x04). Lighting is two zones — logo (`08 01`) and wheel (`08 02`) —
32
+ * each with its own color and effect (`07 01`/`07 02`, steady 0x01 / breath
33
+ * 0x03). Buttons are one 30-byte packet (6 slots × 5-byte fields),
34
+ * command `31 00`, as an output report.
35
+ *
36
+ * The two readable values are the firmware version (`10 00`, two bytes,
37
+ * `fw_minor` then `fw_major`) and the active preset index (`16 00`).
38
+ * Settings apply immediately; the save command (`09 00`) persists them to
39
+ * onboard flash. None of this has been verified on physical hardware by this
40
+ * project.
41
+ */
42
+ export declare const RIVAL300_REPORT_ID = 0;
43
+ /** Command prefixes; the payload is the prefix plus its arguments. */
44
+ export declare const RIVAL300_COMMAND: {
45
+ readonly sensitivity1: readonly [3, 1];
46
+ readonly sensitivity2: readonly [3, 2];
47
+ readonly pollingRate: readonly [4, 0];
48
+ readonly logoColor: readonly [8, 1];
49
+ readonly wheelColor: readonly [8, 2];
50
+ readonly logoEffect: readonly [7, 1];
51
+ readonly wheelEffect: readonly [7, 2];
52
+ readonly buttonsMapping: readonly [49, 0];
53
+ readonly save: readonly [9, 0];
54
+ readonly firmware: readonly [16, 0];
55
+ readonly activeCpiIndex: readonly [22, 0];
56
+ };
57
+ /** `09 00` — commit the current settings to onboard flash. */
58
+ export declare const RIVAL300_SAVE_COMMAND: readonly [9, 0];
59
+ export declare const RIVAL300_FIRMWARE_RESPONSE_LENGTH = 2;
60
+ export declare const RIVAL300_POLLING_RATES: readonly [125, 250, 500, 1000];
61
+ export declare const RIVAL300_DPI_MIN = 50;
62
+ export declare const RIVAL300_DPI_MAX = 6500;
63
+ export declare const RIVAL300_DPI_STEP = 50;
64
+ /** rivalcfg `rival300.py` defaults for the two presets. */
65
+ export declare const RIVAL300_DEFAULT_DPI_PRESET_1 = 800;
66
+ export declare const RIVAL300_DEFAULT_DPI_PRESET_2 = 1600;
67
+ export declare const RIVAL300_DEFAULT_POLLING_RATE = 1000;
68
+ export declare class Rival300ProtocolError extends Error {
69
+ }
70
+ /** The 130 DPI values the linear encoding can express, ascending. */
71
+ export declare function steelseriesRival300DpiOptions(): number[];
72
+ /** `03 01 <byte>` — sensitivity preset 1. */
73
+ export declare function steelseriesRival300EncodeSensitivity1(dpi: number): Uint8Array;
74
+ /** `03 02 <byte>` — sensitivity preset 2. */
75
+ export declare function steelseriesRival300EncodeSensitivity2(dpi: number): Uint8Array;
76
+ /** `04 00 <v>` with 1000→0x01, 500→0x02, 250→0x03, 125→0x04. */
77
+ export declare function steelseriesRival300EncodePollingRate(pollingRateHz: number): Uint8Array;
78
+ /** `09 00` — commit the current settings to onboard flash. */
79
+ export declare function steelseriesRival300SaveCommand(): Uint8Array;
80
+ /** `10 00` — the device answers with minor then major firmware bytes. */
81
+ export declare function steelseriesRival300FirmwareQuery(): Uint8Array;
82
+ /** `16 00` — read the active preset index. */
83
+ export declare function steelseriesRival300ActiveCpiQuery(): Uint8Array;
84
+ /**
85
+ * Decode the active-preset reply. The specification's `resolution_level`
86
+ * incoming struct is `report_id` then `level`, and the reply's report id is
87
+ * not surfaced by WebHID, so the level is the first byte. The device reports
88
+ * it 1-based (values 0x01/0x02); anything else is rejected rather than
89
+ * guessed at.
90
+ */
91
+ export declare function steelseriesRival300DecodeActivePreset(payload: Uint8Array): 1 | 2;
92
+ export interface SteelSeriesRival300Firmware {
93
+ /** The two raw response bytes, in the order the device sent them (minor, major). */
94
+ bytes: [number, number];
95
+ /** The version the two bytes describe, major first, e.g. "1.3". */
96
+ display: string;
97
+ }
98
+ /** Decode the two-byte firmware response (`fw_minor`, `fw_major`). */
99
+ export declare function steelseriesRival300DecodeFirmware(payload: Uint8Array): SteelSeriesRival300Firmware;
100
+ /** The two independently controlled LED zones. */
101
+ export type Rival300Led = "logo" | "wheel";
102
+ /** `08 <zone> <r> <g> <b>` — one LED zone's color (`logo` = 0x01, `wheel` = 0x02). */
103
+ export declare function steelseriesRival300EncodeLedColor(led: Rival300Led, r: number, g: number, b: number): Uint8Array;
104
+ export declare const RIVAL300_LIGHT_EFFECT_TO_BYTE: {
105
+ readonly steady: 1;
106
+ readonly breath: 3;
107
+ };
108
+ export type Rival300LightEffect = keyof typeof RIVAL300_LIGHT_EFFECT_TO_BYTE;
109
+ /** `07 <zone> <mode>` — one LED zone's effect (steady/breath). */
110
+ export declare function steelseriesRival300EncodeLedEffect(led: Rival300Led, effect: Rival300LightEffect): Uint8Array;
111
+ /** 6 button slots, 5-byte fields. */
112
+ export declare const RIVAL300_BUTTONS: {
113
+ readonly button1: {
114
+ readonly id: 1;
115
+ readonly offset: 0;
116
+ };
117
+ readonly button2: {
118
+ readonly id: 2;
119
+ readonly offset: 5;
120
+ };
121
+ readonly button3: {
122
+ readonly id: 3;
123
+ readonly offset: 10;
124
+ };
125
+ readonly button4: {
126
+ readonly id: 4;
127
+ readonly offset: 15;
128
+ };
129
+ readonly button5: {
130
+ readonly id: 5;
131
+ readonly offset: 20;
132
+ };
133
+ readonly button6: {
134
+ readonly id: 6;
135
+ readonly offset: 25;
136
+ };
137
+ };
138
+ export type Rival300ButtonName = keyof typeof RIVAL300_BUTTONS;
139
+ export type Rival300ButtonAction = {
140
+ type: "button";
141
+ target: Rival300ButtonName;
142
+ } | {
143
+ type: "disabled";
144
+ } | {
145
+ type: "dpiSwitch";
146
+ } | {
147
+ type: "scrollUp";
148
+ } | {
149
+ type: "scrollDown";
150
+ } | {
151
+ type: "keyboard";
152
+ code: number;
153
+ } | {
154
+ type: "multimedia";
155
+ code: number;
156
+ };
157
+ /**
158
+ * `31 00` + one 30-byte packet (6 slots × 5-byte fields), zero-filled
159
+ * except where a mapping is given. Pass every button explicitly — unmapped
160
+ * buttons stay disabled, matching this package's no-silent-defaults policy.
161
+ */
162
+ export declare function steelseriesRival300EncodeButtonsMapping(mapping: Partial<Record<Rival300ButtonName, Rival300ButtonAction>>): Uint8Array;
163
+ //# sourceMappingURL=rival-300.d.ts.map