@openmouse/protocol 0.42.3 → 0.44.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.
- package/dist/drivers/endgame/egg-ot-hid.d.ts +4 -0
- package/dist/drivers/endgame/egg-ot-hid.d.ts.map +1 -1
- package/dist/drivers/endgame/egg-ot-hid.js +48 -4
- package/dist/drivers/endgame/egg-ot-hid.js.map +1 -1
- package/dist/drivers/registry.d.ts +13 -1
- package/dist/drivers/registry.d.ts.map +1 -1
- package/dist/drivers/registry.js +24 -0
- package/dist/drivers/registry.js.map +1 -1
- package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.d.ts +65 -0
- package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.js +205 -0
- package/dist/drivers/steelseries/aerox-3-wireless-gen2-hid.js.map +1 -0
- package/dist/drivers/steelseries/prime-mini-hid.d.ts +59 -0
- package/dist/drivers/steelseries/prime-mini-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/prime-mini-hid.js +183 -0
- package/dist/drivers/steelseries/prime-mini-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival-100-hid.d.ts +57 -0
- package/dist/drivers/steelseries/rival-100-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival-100-hid.js +181 -0
- package/dist/drivers/steelseries/rival-100-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival-110-hid.d.ts +78 -0
- package/dist/drivers/steelseries/rival-110-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival-110-hid.js +206 -0
- package/dist/drivers/steelseries/rival-110-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival-3-v2-hid.d.ts +59 -0
- package/dist/drivers/steelseries/rival-3-v2-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival-3-v2-hid.js +183 -0
- package/dist/drivers/steelseries/rival-3-v2-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival-3-wireless-v2-hid.d.ts +64 -0
- package/dist/drivers/steelseries/rival-3-wireless-v2-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival-3-wireless-v2-hid.js +199 -0
- package/dist/drivers/steelseries/rival-3-wireless-v2-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival-300-hid.d.ts +78 -0
- package/dist/drivers/steelseries/rival-300-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival-300-hid.js +206 -0
- package/dist/drivers/steelseries/rival-300-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival-5-hid.d.ts +55 -0
- package/dist/drivers/steelseries/rival-5-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival-5-hid.js +177 -0
- package/dist/drivers/steelseries/rival-5-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival-600-hid.d.ts +65 -0
- package/dist/drivers/steelseries/rival-600-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival-600-hid.js +184 -0
- package/dist/drivers/steelseries/rival-600-hid.js.map +1 -0
- package/dist/drivers/steelseries/sensei-310-hid.d.ts +54 -0
- package/dist/drivers/steelseries/sensei-310-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/sensei-310-hid.js +177 -0
- package/dist/drivers/steelseries/sensei-310-hid.js.map +1 -0
- package/dist/drivers/steelseries/sensei-raw-hid.d.ts +75 -0
- package/dist/drivers/steelseries/sensei-raw-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/sensei-raw-hid.js +199 -0
- package/dist/drivers/steelseries/sensei-raw-hid.js.map +1 -0
- package/dist/drivers/steelseries/sensei-rival-pro-hid.d.ts +42 -0
- package/dist/drivers/steelseries/sensei-rival-pro-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/sensei-rival-pro-hid.js +132 -0
- package/dist/drivers/steelseries/sensei-rival-pro-hid.js.map +1 -0
- package/dist/steelseries/aerox-3-wireless-gen2.d.ts +204 -0
- package/dist/steelseries/aerox-3-wireless-gen2.d.ts.map +1 -0
- package/dist/steelseries/aerox-3-wireless-gen2.js +301 -0
- package/dist/steelseries/aerox-3-wireless-gen2.js.map +1 -0
- package/dist/steelseries/aerox3.d.ts +3 -3
- package/dist/steelseries/aerox3.js +3 -3
- package/dist/steelseries/devices.d.ts +31 -14
- package/dist/steelseries/devices.d.ts.map +1 -1
- package/dist/steelseries/devices.js +417 -13
- package/dist/steelseries/devices.js.map +1 -1
- package/dist/steelseries/index.d.ts +12 -0
- package/dist/steelseries/index.d.ts.map +1 -1
- package/dist/steelseries/index.js +12 -0
- package/dist/steelseries/index.js.map +1 -1
- package/dist/steelseries/prime-mini-wireless.d.ts +9 -14
- package/dist/steelseries/prime-mini-wireless.d.ts.map +1 -1
- package/dist/steelseries/prime-mini-wireless.js +9 -14
- package/dist/steelseries/prime-mini-wireless.js.map +1 -1
- package/dist/steelseries/prime-mini.d.ts +173 -0
- package/dist/steelseries/prime-mini.d.ts.map +1 -0
- package/dist/steelseries/prime-mini.js +273 -0
- package/dist/steelseries/prime-mini.js.map +1 -0
- package/dist/steelseries/prime-plus.d.ts +5 -4
- package/dist/steelseries/prime-plus.d.ts.map +1 -1
- package/dist/steelseries/prime-plus.js +5 -4
- package/dist/steelseries/prime-plus.js.map +1 -1
- package/dist/steelseries/rival-100.d.ts +134 -0
- package/dist/steelseries/rival-100.d.ts.map +1 -0
- package/dist/steelseries/rival-100.js +195 -0
- package/dist/steelseries/rival-100.js.map +1 -0
- package/dist/steelseries/rival-110.d.ts +134 -0
- package/dist/steelseries/rival-110.d.ts.map +1 -0
- package/dist/steelseries/rival-110.js +205 -0
- package/dist/steelseries/rival-110.js.map +1 -0
- package/dist/steelseries/rival-3-v2.d.ts +168 -0
- package/dist/steelseries/rival-3-v2.d.ts.map +1 -0
- package/dist/steelseries/rival-3-v2.js +242 -0
- package/dist/steelseries/rival-3-v2.js.map +1 -0
- package/dist/steelseries/rival-3-wireless-v2.d.ts +219 -0
- package/dist/steelseries/rival-3-wireless-v2.d.ts.map +1 -0
- package/dist/steelseries/rival-3-wireless-v2.js +270 -0
- package/dist/steelseries/rival-3-wireless-v2.js.map +1 -0
- package/dist/steelseries/rival-300.d.ts +163 -0
- package/dist/steelseries/rival-300.d.ts.map +1 -0
- package/dist/steelseries/rival-300.js +266 -0
- package/dist/steelseries/rival-300.js.map +1 -0
- package/dist/steelseries/rival-5.d.ts +165 -0
- package/dist/steelseries/rival-5.d.ts.map +1 -0
- package/dist/steelseries/rival-5.js +212 -0
- package/dist/steelseries/rival-5.js.map +1 -0
- package/dist/steelseries/rival-600.d.ts +194 -0
- package/dist/steelseries/rival-600.d.ts.map +1 -0
- package/dist/steelseries/rival-600.js +262 -0
- package/dist/steelseries/rival-600.js.map +1 -0
- package/dist/steelseries/sensei-310.d.ts +162 -0
- package/dist/steelseries/sensei-310.d.ts.map +1 -0
- package/dist/steelseries/sensei-310.js +250 -0
- package/dist/steelseries/sensei-310.js.map +1 -0
- package/dist/steelseries/sensei-raw.d.ts +169 -0
- package/dist/steelseries/sensei-raw.d.ts.map +1 -0
- package/dist/steelseries/sensei-raw.js +233 -0
- package/dist/steelseries/sensei-raw.js.map +1 -0
- package/dist/steelseries/sensei-rival-pro.d.ts +214 -0
- package/dist/steelseries/sensei-rival-pro.d.ts.map +1 -0
- package/dist/steelseries/sensei-rival-pro.js +298 -0
- package/dist/steelseries/sensei-rival-pro.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SteelSeries Rival 110 configuration protocol — pure encode/decode helpers.
|
|
3
|
+
*
|
|
4
|
+
* Reconstructed from the vendor's own software, not from a third-party
|
|
5
|
+
* reimplementation: SteelSeries GG 121.0.0 ships `rival-110.lisp`,
|
|
6
|
+
* `rival-106.lisp` and `rival-300s.lisp`, each of which `include "rival-100"`
|
|
7
|
+
* (so the command bytes are Rival 100's) and override only the firmware
|
|
8
|
+
* struct. This module transcribes that command set. Those vendor files are
|
|
9
|
+
* OpenPGP-armored ("DESCRIPTOR" armor, SKESK/AES-128). rivalcfg groups these
|
|
10
|
+
* three product ids under `rival110.py` (with `rival300s.py` reusing it) and
|
|
11
|
+
* independently corroborates every command byte.
|
|
12
|
+
*
|
|
13
|
+
* ## Why this is a separate family from `./rival-100.ts`
|
|
14
|
+
*
|
|
15
|
+
* The Rival 110/106/300S share the Rival 100's command bytes but use the
|
|
16
|
+
* **PixArt PMW3326** sensor, not the Rival 100's eight-step sensor. The
|
|
17
|
+
* vendor files state the DPI byte but no table, so rivalcfg's
|
|
18
|
+
* `dpi/pmw3326.py` supplies it (200–7200 in 100 DPI steps, the "linear-like"
|
|
19
|
+
* sensor curve — notably `0x49`→3200, matching the vendor TrueMove Core
|
|
20
|
+
* table in `./rival-3-v2.ts`). Off-table values are rejected. The Rival 100
|
|
21
|
+
* module's eight-value choice table does not apply here and vice versa,
|
|
22
|
+
* which is exactly why these are two modules.
|
|
23
|
+
*
|
|
24
|
+
* ## Protocol
|
|
25
|
+
*
|
|
26
|
+
* Every command is an HID **output report** with report id 0x00. The vendor
|
|
27
|
+
* file says 33-byte reports (`HIDIO 33`); rivalcfg sets a 32-byte
|
|
28
|
+
* `packet_length` for these models. That padding difference is a transport
|
|
29
|
+
* detail (the driver sends the command bytes), noted here rather than
|
|
30
|
+
* encoded.
|
|
31
|
+
*
|
|
32
|
+
* DPI uses two per-level commands (`03 01`/`03 02`). Polling (`04 00`) is
|
|
33
|
+
* write-only (1000→0x01, 500→0x02, 250→0x03, 125→0x04). Lighting is a single
|
|
34
|
+
* zone: color (`05 00` + RGB) and effect (`07 00` + steady/breath), with the
|
|
35
|
+
* color-sequencing template leaving the brightness byte zero. Button 6 (the
|
|
36
|
+
* CPI button under the wheel) has a mode toggle (`0B`): hardware DPI switch
|
|
37
|
+
* or an OS-bound button. There is **no button remapping** on this family.
|
|
38
|
+
*
|
|
39
|
+
* The two readable values are the firmware version (`10 00`, two bytes,
|
|
40
|
+
* `fw_minor` then `fw_major`) and the active preset index (`16 00`).
|
|
41
|
+
*
|
|
42
|
+
* Settings apply immediately; the save command (`09 00`) persists them to
|
|
43
|
+
* onboard flash. None of this has been verified on physical hardware by this
|
|
44
|
+
* project.
|
|
45
|
+
*/
|
|
46
|
+
export const RIVAL110_REPORT_ID = 0x00;
|
|
47
|
+
/** Command prefixes; the payload is the prefix plus its arguments. */
|
|
48
|
+
export const RIVAL110_COMMAND = {
|
|
49
|
+
sensitivity1: [0x03, 0x01],
|
|
50
|
+
sensitivity2: [0x03, 0x02],
|
|
51
|
+
pollingRate: [0x04, 0x00],
|
|
52
|
+
ledColor: [0x05, 0x00],
|
|
53
|
+
ledPulsation: [0x07, 0x00],
|
|
54
|
+
button6Mode: [0x0b],
|
|
55
|
+
save: [0x09, 0x00],
|
|
56
|
+
firmware: [0x10, 0x00],
|
|
57
|
+
activeCpiIndex: [0x16, 0x00],
|
|
58
|
+
};
|
|
59
|
+
/** `09 00` — commit the current settings to onboard flash. */
|
|
60
|
+
export const RIVAL110_SAVE_COMMAND = [0x09, 0x00];
|
|
61
|
+
export const RIVAL110_FIRMWARE_RESPONSE_LENGTH = 2;
|
|
62
|
+
export const RIVAL110_POLLING_RATES = [125, 250, 500, 1000];
|
|
63
|
+
const POLLING_RATE_TO_BYTE = new Map([
|
|
64
|
+
[1000, 0x01],
|
|
65
|
+
[500, 0x02],
|
|
66
|
+
[250, 0x03],
|
|
67
|
+
[125, 0x04],
|
|
68
|
+
]);
|
|
69
|
+
/**
|
|
70
|
+
* The PixArt PMW3326 DPI curve, from rivalcfg's `dpi/pmw3326.py` (the vendor
|
|
71
|
+
* files give no table). 200–7200 in 100 DPI steps.
|
|
72
|
+
*/
|
|
73
|
+
export const RIVAL110_DPI_TO_BYTE = new Map([
|
|
74
|
+
[200, 0x04], [300, 0x06], [400, 0x08], [500, 0x0b], [600, 0x0d], [700, 0x0f],
|
|
75
|
+
[800, 0x12], [900, 0x14], [1000, 0x16], [1100, 0x19], [1200, 0x1b], [1300, 0x1d],
|
|
76
|
+
[1400, 0x20], [1500, 0x22], [1600, 0x24], [1700, 0x27], [1800, 0x29], [1900, 0x2b],
|
|
77
|
+
[2000, 0x2e], [2100, 0x30], [2200, 0x32], [2300, 0x34], [2400, 0x37], [2500, 0x39],
|
|
78
|
+
[2600, 0x3b], [2700, 0x3e], [2800, 0x40], [2900, 0x42], [3000, 0x45], [3100, 0x47],
|
|
79
|
+
[3200, 0x49], [3300, 0x4c], [3400, 0x4e], [3500, 0x50], [3600, 0x53], [3700, 0x55],
|
|
80
|
+
[3800, 0x57], [3900, 0x5a], [4000, 0x5c], [4100, 0x5e], [4200, 0x61], [4300, 0x63],
|
|
81
|
+
[4400, 0x65], [4500, 0x68], [4600, 0x6a], [4700, 0x6c], [4800, 0x6f], [4900, 0x71],
|
|
82
|
+
[5000, 0x73], [5100, 0x76], [5200, 0x78], [5300, 0x7a], [5400, 0x7d], [5500, 0x7f],
|
|
83
|
+
[5600, 0x81], [5700, 0x84], [5800, 0x86], [5900, 0x88], [6000, 0x8b], [6100, 0x8d],
|
|
84
|
+
[6200, 0x8f], [6300, 0x92], [6400, 0x94], [6500, 0x96], [6600, 0x99], [6700, 0x9b],
|
|
85
|
+
[6800, 0x9d], [6900, 0xa0], [7000, 0xa2], [7100, 0xa4], [7200, 0xa7],
|
|
86
|
+
]);
|
|
87
|
+
/** rivalcfg `rival110.py` defaults for the two presets. */
|
|
88
|
+
export const RIVAL110_DEFAULT_DPI_PRESET_1 = 800;
|
|
89
|
+
export const RIVAL110_DEFAULT_DPI_PRESET_2 = 1600;
|
|
90
|
+
export const RIVAL110_DEFAULT_POLLING_RATE = 1000;
|
|
91
|
+
export class Rival110ProtocolError extends Error {
|
|
92
|
+
}
|
|
93
|
+
/** The PMW3326 DPI curve supports 200–7200 in 100 DPI steps. */
|
|
94
|
+
export const RIVAL110_DPI_MIN = 200;
|
|
95
|
+
export const RIVAL110_DPI_MAX = 7200;
|
|
96
|
+
/** The 72 supported DPI values, ascending. */
|
|
97
|
+
export function steelseriesRival110DpiOptions() {
|
|
98
|
+
return [...RIVAL110_DPI_TO_BYTE.keys()].sort((a, b) => a - b);
|
|
99
|
+
}
|
|
100
|
+
function encodeDpiByte(dpi) {
|
|
101
|
+
const byte = RIVAL110_DPI_TO_BYTE.get(dpi);
|
|
102
|
+
if (byte === undefined) {
|
|
103
|
+
throw new Rival110ProtocolError(`SteelSeries Rival 110 DPI must be ${RIVAL110_DPI_MIN}–${RIVAL110_DPI_MAX.toLocaleString("en-US")} in 100 DPI steps.`);
|
|
104
|
+
}
|
|
105
|
+
return byte;
|
|
106
|
+
}
|
|
107
|
+
/** `03 01 <byte>` — sensitivity preset 1. */
|
|
108
|
+
export function steelseriesRival110EncodeSensitivity1(dpi) {
|
|
109
|
+
return new Uint8Array([...RIVAL110_COMMAND.sensitivity1, encodeDpiByte(dpi)]);
|
|
110
|
+
}
|
|
111
|
+
/** `03 02 <byte>` — sensitivity preset 2. */
|
|
112
|
+
export function steelseriesRival110EncodeSensitivity2(dpi) {
|
|
113
|
+
return new Uint8Array([...RIVAL110_COMMAND.sensitivity2, encodeDpiByte(dpi)]);
|
|
114
|
+
}
|
|
115
|
+
/** `04 00 <v>` with 1000→0x01, 500→0x02, 250→0x03, 125→0x04. */
|
|
116
|
+
export function steelseriesRival110EncodePollingRate(pollingRateHz) {
|
|
117
|
+
const byte = POLLING_RATE_TO_BYTE.get(pollingRateHz);
|
|
118
|
+
if (byte === undefined) {
|
|
119
|
+
throw new Rival110ProtocolError("SteelSeries Rival 110 supports 125, 250, 500, or 1000 Hz polling.");
|
|
120
|
+
}
|
|
121
|
+
return new Uint8Array([...RIVAL110_COMMAND.pollingRate, byte]);
|
|
122
|
+
}
|
|
123
|
+
/** `09 00` — commit the current settings to onboard flash. */
|
|
124
|
+
export function steelseriesRival110SaveCommand() {
|
|
125
|
+
return new Uint8Array(RIVAL110_SAVE_COMMAND);
|
|
126
|
+
}
|
|
127
|
+
/** `10 00` — the device answers with minor then major firmware bytes. */
|
|
128
|
+
export function steelseriesRival110FirmwareQuery() {
|
|
129
|
+
return new Uint8Array(RIVAL110_COMMAND.firmware);
|
|
130
|
+
}
|
|
131
|
+
/** `16 00` — read the active preset index. */
|
|
132
|
+
export function steelseriesRival110ActiveCpiQuery() {
|
|
133
|
+
return new Uint8Array(RIVAL110_COMMAND.activeCpiIndex);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Decode the active-preset reply. The specification's `resolution_level`
|
|
137
|
+
* incoming struct is `report_id` then `level`, and the reply's report id is
|
|
138
|
+
* not surfaced by WebHID, so the level is the first byte. The device reports
|
|
139
|
+
* it 1-based (values 0x01/0x02); anything else is rejected rather than
|
|
140
|
+
* guessed at.
|
|
141
|
+
*/
|
|
142
|
+
export function steelseriesRival110DecodeActivePreset(payload) {
|
|
143
|
+
const level = payload[0];
|
|
144
|
+
if (level !== 0x01 && level !== 0x02) {
|
|
145
|
+
throw new Rival110ProtocolError(`SteelSeries Rival 110 active preset reply was not 1 or 2 (got ${level === undefined ? "nothing" : `0x${level.toString(16)}`}).`);
|
|
146
|
+
}
|
|
147
|
+
return level;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Decode the two-byte firmware response. The specification's incoming
|
|
151
|
+
* struct orders the fields `fw_minor` then `fw_major`, so the display string
|
|
152
|
+
* puts them back in major.minor order.
|
|
153
|
+
*/
|
|
154
|
+
export function steelseriesRival110DecodeFirmware(payload) {
|
|
155
|
+
if (payload.length < RIVAL110_FIRMWARE_RESPONSE_LENGTH) {
|
|
156
|
+
throw new Rival110ProtocolError("SteelSeries Rival 110 firmware response is shorter than two bytes.");
|
|
157
|
+
}
|
|
158
|
+
const bytes = [payload[0], payload[1]];
|
|
159
|
+
return { bytes, display: `${bytes[1]}.${bytes[0]}` };
|
|
160
|
+
}
|
|
161
|
+
// -- LED -------------------------------------------------------------------
|
|
162
|
+
function encodeRgb(r, g, b) {
|
|
163
|
+
for (const channel of [r, g, b]) {
|
|
164
|
+
if (!Number.isInteger(channel) || channel < 0 || channel > 255) {
|
|
165
|
+
throw new Rival110ProtocolError("RGB channels must be integers 0–255.");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return [r, g, b];
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* `05 00 <r> <g> <b>` — the single LED zone color. The vendor struct also
|
|
172
|
+
* carries a `brightness` byte, but both the vendor's own color-sequencing
|
|
173
|
+
* template and rivalcfg's `rgbcolor` leave it zero, so this codec matches
|
|
174
|
+
* them rather than inventing a brightness semantic.
|
|
175
|
+
*/
|
|
176
|
+
export function steelseriesRival110EncodeLedColor(r, g, b) {
|
|
177
|
+
return new Uint8Array([...RIVAL110_COMMAND.ledColor, ...encodeRgb(r, g, b)]);
|
|
178
|
+
}
|
|
179
|
+
/** `07 00 <mode>` — lighting effect. */
|
|
180
|
+
export const RIVAL110_LIGHT_EFFECT_TO_BYTE = {
|
|
181
|
+
steady: 0x01,
|
|
182
|
+
breath: 0x03,
|
|
183
|
+
};
|
|
184
|
+
/** `07 00 <mode>` — steady or breath. */
|
|
185
|
+
export function steelseriesRival110EncodeLightEffect(effect) {
|
|
186
|
+
const byte = RIVAL110_LIGHT_EFFECT_TO_BYTE[effect];
|
|
187
|
+
if (byte === undefined) {
|
|
188
|
+
throw new Rival110ProtocolError(`SteelSeries Rival 110 light effect must be one of: ${Object.keys(RIVAL110_LIGHT_EFFECT_TO_BYTE).join(", ")}.`);
|
|
189
|
+
}
|
|
190
|
+
return new Uint8Array([...RIVAL110_COMMAND.ledPulsation, byte]);
|
|
191
|
+
}
|
|
192
|
+
/** `0B <mode>` — the button-6 (CPI) button mode. */
|
|
193
|
+
export const RIVAL110_BUTTON6_MODE_TO_BYTE = {
|
|
194
|
+
dpi: 0x00,
|
|
195
|
+
os: 0x01,
|
|
196
|
+
};
|
|
197
|
+
/** `0B <mode>` — dpi or os. */
|
|
198
|
+
export function steelseriesRival110EncodeButton6Mode(mode) {
|
|
199
|
+
const byte = RIVAL110_BUTTON6_MODE_TO_BYTE[mode];
|
|
200
|
+
if (byte === undefined) {
|
|
201
|
+
throw new Rival110ProtocolError(`SteelSeries Rival 110 button-6 mode must be one of: ${Object.keys(RIVAL110_BUTTON6_MODE_TO_BYTE).join(", ")}.`);
|
|
202
|
+
}
|
|
203
|
+
return new Uint8Array([...RIVAL110_COMMAND.button6Mode, byte]);
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=rival-110.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rival-110.js","sourceRoot":"","sources":["../../src/steelseries/rival-110.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,sEAAsE;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IAC1B,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IAC1B,WAAW,EAAE,CAAC,IAAI,CAAC;IACnB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IACtB,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;CACpB,CAAC;AAEX,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AAE3D,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAU,CAAC;AAErE,M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wCAAwC;AACxC,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;CACJ,CAAC;AAIX,yCAAyC;AACzC,MAAM,UAAU,oCAAoC,CAAC,MAA2B;IAC9E,MAAM,IAAI,GAAG,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACnD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,qBAAqB,CAC7B,sDAAsD,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC/G,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,CAAC,GAAG,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,GAAG,EAAE,IAAI;IACT,EAAE,EAAE,IAAI;CACA,CAAC;AAIX,+BAA+B;AAC/B,MAAM,UAAU,oCAAoC,CAAC,IAAyB;IAC5E,MAAM,IAAI,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,qBAAqB,CAC7B,uDAAuD,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAChH,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,CAAC,GAAG,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SteelSeries Rival 3 Gen 2 configuration protocol — pure encode/decode helpers.
|
|
3
|
+
*
|
|
4
|
+
* Reconstructed from the vendor's own software, not from a third-party
|
|
5
|
+
* reimplementation: SteelSeries GG 121.0.0 ships `rival-3-v2.lisp` under
|
|
6
|
+
* `apps/engine/install/deviceSpecifications/`, and this module transcribes
|
|
7
|
+
* it. Those files are OpenPGP-armored ("DESCRIPTOR" armor, SKESK/AES-128);
|
|
8
|
+
* the bytes below are the documented HID report payloads, not guesses.
|
|
9
|
+
* rivalcfg's mainline `rival3_gen2.py` corroborates the product id, the
|
|
10
|
+
* `0x34` XY-DPI command shape, and most other command bytes — but see the
|
|
11
|
+
* DPI table note below, where the two sources disagree.
|
|
12
|
+
*
|
|
13
|
+
* Despite the shared "Rival 3" name this is a different command set from
|
|
14
|
+
* Rival 3 Gen 1 (`./rival3.ts`: two-byte `0x0B 0x00` DPI, `0x04 0x00`
|
|
15
|
+
* polling, `0x09 0x00` save) and from Aerox 3 (`./aerox3.ts`). Command
|
|
16
|
+
* bytes here are single-byte prefixes with a `write-op`/`read-op` framing
|
|
17
|
+
* convention; on this wired-only mouse both masks are `0x00`, so the bytes
|
|
18
|
+
* go on the wire as written.
|
|
19
|
+
*
|
|
20
|
+
* Every command is an HID **output report** with report id 0x00 (65-byte
|
|
21
|
+
* reports throughout the specification).
|
|
22
|
+
*
|
|
23
|
+
* DPI uses an XY batch (`0x34`): `num_cpi_levels` (1–5), `index` (0–4,
|
|
24
|
+
* 0-based), then a 10-byte interleaved table (x0, y0, x1, y1, …), one
|
|
25
|
+
* sensor byte per axis value. The sensor table is TrueMove Core shaped
|
|
26
|
+
* (200–8500), transcribed here from the vendor file's own
|
|
27
|
+
* `convert_cpi_fw_to_driver` case table — **not** imported from
|
|
28
|
+
* `./rival3.ts`'s `TRUEMOVE_CORE_DPI_TO_BYTE`, because the two disagree on
|
|
29
|
+
* 23 entries: the vendor file says `0x49→3200` where rivalcfg says
|
|
30
|
+
* `0x4A→3200`, and similarly one byte lower at 22 other DPI steps (2300,
|
|
31
|
+
* 2600, 2900, 3500, 3800, …). The vendor table is self-consistent with the
|
|
32
|
+
* vendor's own factory defaults (Aerox 3's default preset bytes
|
|
33
|
+
* 8/18/27/55/73 decode to exactly 400/800/1200/2400/3200 under it, while
|
|
34
|
+
* `0x49` is absent from rivalcfg's table), so this module follows the
|
|
35
|
+
* vendor file and flags the divergence for the shared table to be
|
|
36
|
+
* reconciled separately. Off-grid DPI values are rejected rather than
|
|
37
|
+
* rounded.
|
|
38
|
+
*
|
|
39
|
+
* The specification always carries all five XY pairs, so this codec
|
|
40
|
+
* requires exactly five presets rather than guessing at padding for
|
|
41
|
+
* shorter tables.
|
|
42
|
+
*
|
|
43
|
+
* Polling (`0x2B`, values 1000→0x01, 500→0x02, 250→0x03, 125→0x04) has a
|
|
44
|
+
* read-back (same values), defined but not decoded here. Buttons are one
|
|
45
|
+
* 40-byte packet (8 slots × 5-byte fields: 6 physical buttons plus scroll
|
|
46
|
+
* up/down), command `0x2A`.
|
|
47
|
+
*
|
|
48
|
+
* Known but deliberately not implemented — documented so nobody re-derives
|
|
49
|
+
* them, withheld until there is hardware evidence and a reason to ship them:
|
|
50
|
+
*
|
|
51
|
+
* - The 3-zone RGB commands (`0x21`, per-zone bitmasks), reactive color
|
|
52
|
+
* (`0x26`), lighting enable (`0x27`), and reset (`0x22`, mask `0x07`).
|
|
53
|
+
* - `read_polling_rate` and the unique-id read.
|
|
54
|
+
* - Angle snapping: driver-side (`SSE`) settings, not HID commands.
|
|
55
|
+
*
|
|
56
|
+
* Settings apply immediately; the save command (`0x11`, one byte) persists
|
|
57
|
+
* them to onboard flash. None of this has been verified on physical
|
|
58
|
+
* hardware by this project.
|
|
59
|
+
*/
|
|
60
|
+
/** Vendor TrueMove Core table, transcribed from the specification's own conversion table. */
|
|
61
|
+
export declare const RIVAL3_GEN2_DPI_TO_BYTE: ReadonlyMap<number, number>;
|
|
62
|
+
export declare const RIVAL3_GEN2_REPORT_ID = 0;
|
|
63
|
+
/** Command prefixes; the payload is the prefix plus its arguments. */
|
|
64
|
+
export declare const RIVAL3_GEN2_COMMAND: {
|
|
65
|
+
readonly dpiPresets: readonly [52];
|
|
66
|
+
readonly pollingRate: readonly [43];
|
|
67
|
+
readonly buttonsMapping: readonly [42];
|
|
68
|
+
readonly firmware: readonly [144];
|
|
69
|
+
};
|
|
70
|
+
/** `0x11` — one byte; commit the current settings to onboard flash. */
|
|
71
|
+
export declare const RIVAL3_GEN2_SAVE_COMMAND: readonly [17];
|
|
72
|
+
export declare const RIVAL3_GEN2_POLLING_RATES: readonly [125, 250, 500, 1000];
|
|
73
|
+
export declare const RIVAL3_GEN2_DPI_MIN = 200;
|
|
74
|
+
export declare const RIVAL3_GEN2_DPI_MAX = 8500;
|
|
75
|
+
export declare const RIVAL3_GEN2_DPI_STEP = 100;
|
|
76
|
+
export declare const RIVAL3_GEN2_MAX_DPI_PRESETS = 5;
|
|
77
|
+
export declare const RIVAL3_GEN2_FIRMWARE_RESPONSE_LENGTH = 15;
|
|
78
|
+
/** Common factory table shared across the modern SteelSeries families. */
|
|
79
|
+
export declare const RIVAL3_GEN2_DEFAULT_DPI_PRESETS: readonly [400, 800, 1600, 2400, 3200];
|
|
80
|
+
export declare const RIVAL3_GEN2_DEFAULT_POLLING_RATE = 1000;
|
|
81
|
+
export declare class Rival3Gen2ProtocolError extends Error {
|
|
82
|
+
}
|
|
83
|
+
/** One DPI preset: independent X/Y sensitivities. */
|
|
84
|
+
export interface Rival3Gen2DpiPreset {
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
}
|
|
88
|
+
/** The 84 DPI values the vendor sensor table can express, ascending. */
|
|
89
|
+
export declare function steelseriesRival3Gen2DpiOptions(): number[];
|
|
90
|
+
/**
|
|
91
|
+
* `34 <count 1–5> <selected 0-based> <x0 y0 x1 y1 … x4 y4>` — replaces the
|
|
92
|
+
* mouse's whole preset table with five interleaved XY pairs. Exactly five
|
|
93
|
+
* presets are required (see the module doc comment).
|
|
94
|
+
*/
|
|
95
|
+
export declare function steelseriesRival3Gen2EncodeDpiPresets(presets: readonly Rival3Gen2DpiPreset[], selectedIndex: number): Uint8Array;
|
|
96
|
+
/** `2B <v>` with 1000→0x01, 500→0x02, 250→0x03, 125→0x04. */
|
|
97
|
+
export declare function steelseriesRival3Gen2EncodePollingRate(pollingRateHz: number): Uint8Array;
|
|
98
|
+
/** `11` — commit the current settings to onboard flash. */
|
|
99
|
+
export declare function steelseriesRival3Gen2SaveCommand(): Uint8Array;
|
|
100
|
+
/** `90` — the device answers with a 15-byte version string. */
|
|
101
|
+
export declare function steelseriesRival3Gen2FirmwareQuery(): Uint8Array;
|
|
102
|
+
/**
|
|
103
|
+
* Decode the 15-byte firmware version reply as ASCII, stopping at the
|
|
104
|
+
* first NUL. Same shape as the Prime Mini's reply; trailing padding is not
|
|
105
|
+
* part of the version.
|
|
106
|
+
*/
|
|
107
|
+
export declare function steelseriesRival3Gen2DecodeFirmware(payload: Uint8Array): string;
|
|
108
|
+
/** 6 physical buttons plus scroll up/down (8 slots). */
|
|
109
|
+
export declare const RIVAL3_GEN2_BUTTONS: {
|
|
110
|
+
readonly button1: {
|
|
111
|
+
readonly id: 1;
|
|
112
|
+
readonly offset: 0;
|
|
113
|
+
};
|
|
114
|
+
readonly button2: {
|
|
115
|
+
readonly id: 2;
|
|
116
|
+
readonly offset: 5;
|
|
117
|
+
};
|
|
118
|
+
readonly button3: {
|
|
119
|
+
readonly id: 3;
|
|
120
|
+
readonly offset: 10;
|
|
121
|
+
};
|
|
122
|
+
readonly button4: {
|
|
123
|
+
readonly id: 4;
|
|
124
|
+
readonly offset: 15;
|
|
125
|
+
};
|
|
126
|
+
readonly button5: {
|
|
127
|
+
readonly id: 5;
|
|
128
|
+
readonly offset: 20;
|
|
129
|
+
};
|
|
130
|
+
readonly button6: {
|
|
131
|
+
readonly id: 6;
|
|
132
|
+
readonly offset: 25;
|
|
133
|
+
};
|
|
134
|
+
readonly scrollUp: {
|
|
135
|
+
readonly id: 49;
|
|
136
|
+
readonly offset: 30;
|
|
137
|
+
};
|
|
138
|
+
readonly scrollDown: {
|
|
139
|
+
readonly id: 50;
|
|
140
|
+
readonly offset: 35;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
export type Rival3Gen2ButtonName = keyof typeof RIVAL3_GEN2_BUTTONS;
|
|
144
|
+
export type Rival3Gen2ButtonAction = {
|
|
145
|
+
type: "button";
|
|
146
|
+
target: Rival3Gen2ButtonName;
|
|
147
|
+
} | {
|
|
148
|
+
type: "disabled";
|
|
149
|
+
} | {
|
|
150
|
+
type: "dpiSwitch";
|
|
151
|
+
} | {
|
|
152
|
+
type: "scrollUp";
|
|
153
|
+
} | {
|
|
154
|
+
type: "scrollDown";
|
|
155
|
+
} | {
|
|
156
|
+
type: "keyboard";
|
|
157
|
+
code: number;
|
|
158
|
+
} | {
|
|
159
|
+
type: "multimedia";
|
|
160
|
+
code: number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* `2A` + one 40-byte packet (8 slots × 5-byte fields), zero-filled except
|
|
164
|
+
* where a mapping is given. Pass every button explicitly — unmapped buttons
|
|
165
|
+
* stay disabled, matching this package's no-silent-defaults policy.
|
|
166
|
+
*/
|
|
167
|
+
export declare function steelseriesRival3Gen2EncodeButtonsMapping(mapping: Partial<Record<Rival3Gen2ButtonName, Rival3Gen2ButtonAction>>): Uint8Array;
|
|
168
|
+
//# sourceMappingURL=rival-3-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rival-3-v2.d.ts","sourceRoot":"","sources":["../../src/steelseries/rival-3-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,6FAA6F;AAC7F,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAe9D,CAAC;AAEH,eAAO,MAAM,qBAAqB,IAAO,CAAC;AAE1C,sEAAsE;AACtE,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAEX,uEAAuE;AACvE,eAAO,MAAM,wBAAwB,eAAkB,CAAC;AAExD,eAAO,MAAM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AE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AASzC;;;;GAIG;AACH,wBAAgB,yCAAyC,CACvD,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC,GACrE,UAAU,CAqDZ"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SteelSeries Rival 3 Gen 2 configuration protocol — pure encode/decode helpers.
|
|
3
|
+
*
|
|
4
|
+
* Reconstructed from the vendor's own software, not from a third-party
|
|
5
|
+
* reimplementation: SteelSeries GG 121.0.0 ships `rival-3-v2.lisp` under
|
|
6
|
+
* `apps/engine/install/deviceSpecifications/`, and this module transcribes
|
|
7
|
+
* it. Those files are OpenPGP-armored ("DESCRIPTOR" armor, SKESK/AES-128);
|
|
8
|
+
* the bytes below are the documented HID report payloads, not guesses.
|
|
9
|
+
* rivalcfg's mainline `rival3_gen2.py` corroborates the product id, the
|
|
10
|
+
* `0x34` XY-DPI command shape, and most other command bytes — but see the
|
|
11
|
+
* DPI table note below, where the two sources disagree.
|
|
12
|
+
*
|
|
13
|
+
* Despite the shared "Rival 3" name this is a different command set from
|
|
14
|
+
* Rival 3 Gen 1 (`./rival3.ts`: two-byte `0x0B 0x00` DPI, `0x04 0x00`
|
|
15
|
+
* polling, `0x09 0x00` save) and from Aerox 3 (`./aerox3.ts`). Command
|
|
16
|
+
* bytes here are single-byte prefixes with a `write-op`/`read-op` framing
|
|
17
|
+
* convention; on this wired-only mouse both masks are `0x00`, so the bytes
|
|
18
|
+
* go on the wire as written.
|
|
19
|
+
*
|
|
20
|
+
* Every command is an HID **output report** with report id 0x00 (65-byte
|
|
21
|
+
* reports throughout the specification).
|
|
22
|
+
*
|
|
23
|
+
* DPI uses an XY batch (`0x34`): `num_cpi_levels` (1–5), `index` (0–4,
|
|
24
|
+
* 0-based), then a 10-byte interleaved table (x0, y0, x1, y1, …), one
|
|
25
|
+
* sensor byte per axis value. The sensor table is TrueMove Core shaped
|
|
26
|
+
* (200–8500), transcribed here from the vendor file's own
|
|
27
|
+
* `convert_cpi_fw_to_driver` case table — **not** imported from
|
|
28
|
+
* `./rival3.ts`'s `TRUEMOVE_CORE_DPI_TO_BYTE`, because the two disagree on
|
|
29
|
+
* 23 entries: the vendor file says `0x49→3200` where rivalcfg says
|
|
30
|
+
* `0x4A→3200`, and similarly one byte lower at 22 other DPI steps (2300,
|
|
31
|
+
* 2600, 2900, 3500, 3800, …). The vendor table is self-consistent with the
|
|
32
|
+
* vendor's own factory defaults (Aerox 3's default preset bytes
|
|
33
|
+
* 8/18/27/55/73 decode to exactly 400/800/1200/2400/3200 under it, while
|
|
34
|
+
* `0x49` is absent from rivalcfg's table), so this module follows the
|
|
35
|
+
* vendor file and flags the divergence for the shared table to be
|
|
36
|
+
* reconciled separately. Off-grid DPI values are rejected rather than
|
|
37
|
+
* rounded.
|
|
38
|
+
*
|
|
39
|
+
* The specification always carries all five XY pairs, so this codec
|
|
40
|
+
* requires exactly five presets rather than guessing at padding for
|
|
41
|
+
* shorter tables.
|
|
42
|
+
*
|
|
43
|
+
* Polling (`0x2B`, values 1000→0x01, 500→0x02, 250→0x03, 125→0x04) has a
|
|
44
|
+
* read-back (same values), defined but not decoded here. Buttons are one
|
|
45
|
+
* 40-byte packet (8 slots × 5-byte fields: 6 physical buttons plus scroll
|
|
46
|
+
* up/down), command `0x2A`.
|
|
47
|
+
*
|
|
48
|
+
* Known but deliberately not implemented — documented so nobody re-derives
|
|
49
|
+
* them, withheld until there is hardware evidence and a reason to ship them:
|
|
50
|
+
*
|
|
51
|
+
* - The 3-zone RGB commands (`0x21`, per-zone bitmasks), reactive color
|
|
52
|
+
* (`0x26`), lighting enable (`0x27`), and reset (`0x22`, mask `0x07`).
|
|
53
|
+
* - `read_polling_rate` and the unique-id read.
|
|
54
|
+
* - Angle snapping: driver-side (`SSE`) settings, not HID commands.
|
|
55
|
+
*
|
|
56
|
+
* Settings apply immediately; the save command (`0x11`, one byte) persists
|
|
57
|
+
* them to onboard flash. None of this has been verified on physical
|
|
58
|
+
* hardware by this project.
|
|
59
|
+
*/
|
|
60
|
+
/** Vendor TrueMove Core table, transcribed from the specification's own conversion table. */
|
|
61
|
+
export const RIVAL3_GEN2_DPI_TO_BYTE = new Map([
|
|
62
|
+
[200, 0x04], [300, 0x06], [400, 0x08], [500, 0x0b], [600, 0x0d], [700, 0x0f],
|
|
63
|
+
[800, 0x12], [900, 0x14], [1000, 0x16], [1100, 0x19], [1200, 0x1b], [1300, 0x1d],
|
|
64
|
+
[1400, 0x20], [1500, 0x22], [1600, 0x24], [1700, 0x27], [1800, 0x29], [1900, 0x2b],
|
|
65
|
+
[2000, 0x2e], [2100, 0x30], [2200, 0x32], [2300, 0x34], [2400, 0x37], [2500, 0x39],
|
|
66
|
+
[2600, 0x3b], [2700, 0x3e], [2800, 0x40], [2900, 0x42], [3000, 0x45], [3100, 0x47],
|
|
67
|
+
[3200, 0x49], [3300, 0x4c], [3400, 0x4e], [3500, 0x50], [3600, 0x53], [3700, 0x55],
|
|
68
|
+
[3800, 0x57], [3900, 0x5a], [4000, 0x5c], [4100, 0x5e], [4200, 0x61], [4300, 0x63],
|
|
69
|
+
[4400, 0x65], [4500, 0x68], [4600, 0x6a], [4700, 0x6c], [4800, 0x6f], [4900, 0x71],
|
|
70
|
+
[5000, 0x73], [5100, 0x76], [5200, 0x78], [5300, 0x7a], [5400, 0x7d], [5500, 0x7f],
|
|
71
|
+
[5600, 0x81], [5700, 0x84], [5800, 0x86], [5900, 0x88], [6000, 0x8b], [6100, 0x8d],
|
|
72
|
+
[6200, 0x8f], [6300, 0x92], [6400, 0x94], [6500, 0x96], [6600, 0x99], [6700, 0x9b],
|
|
73
|
+
[6800, 0x9d], [6900, 0xa0], [7000, 0xa2], [7100, 0xa4], [7200, 0xa7], [7300, 0xa9],
|
|
74
|
+
[7400, 0xab], [7500, 0xad], [7600, 0xb0], [7700, 0xb2], [7800, 0xb4], [7900, 0xb7],
|
|
75
|
+
[8000, 0xb9], [8100, 0xbc], [8200, 0xbe], [8300, 0xc0], [8400, 0xc3], [8500, 0xc5],
|
|
76
|
+
]);
|
|
77
|
+
export const RIVAL3_GEN2_REPORT_ID = 0x00;
|
|
78
|
+
/** Command prefixes; the payload is the prefix plus its arguments. */
|
|
79
|
+
export const RIVAL3_GEN2_COMMAND = {
|
|
80
|
+
dpiPresets: [0x34],
|
|
81
|
+
pollingRate: [0x2b],
|
|
82
|
+
buttonsMapping: [0x2a],
|
|
83
|
+
firmware: [0x90],
|
|
84
|
+
};
|
|
85
|
+
/** `0x11` — one byte; commit the current settings to onboard flash. */
|
|
86
|
+
export const RIVAL3_GEN2_SAVE_COMMAND = [0x11];
|
|
87
|
+
export const RIVAL3_GEN2_POLLING_RATES = [125, 250, 500, 1000];
|
|
88
|
+
const POLLING_RATE_TO_BYTE = new Map([
|
|
89
|
+
[1000, 0x01],
|
|
90
|
+
[500, 0x02],
|
|
91
|
+
[250, 0x03],
|
|
92
|
+
[125, 0x04],
|
|
93
|
+
]);
|
|
94
|
+
export const RIVAL3_GEN2_DPI_MIN = 200;
|
|
95
|
+
export const RIVAL3_GEN2_DPI_MAX = 8500;
|
|
96
|
+
export const RIVAL3_GEN2_DPI_STEP = 100;
|
|
97
|
+
export const RIVAL3_GEN2_MAX_DPI_PRESETS = 5;
|
|
98
|
+
export const RIVAL3_GEN2_FIRMWARE_RESPONSE_LENGTH = 15;
|
|
99
|
+
/** Common factory table shared across the modern SteelSeries families. */
|
|
100
|
+
export const RIVAL3_GEN2_DEFAULT_DPI_PRESETS = [400, 800, 1600, 2400, 3200];
|
|
101
|
+
export const RIVAL3_GEN2_DEFAULT_POLLING_RATE = 1000;
|
|
102
|
+
export class Rival3Gen2ProtocolError extends Error {
|
|
103
|
+
}
|
|
104
|
+
/** The 84 DPI values the vendor sensor table can express, ascending. */
|
|
105
|
+
export function steelseriesRival3Gen2DpiOptions() {
|
|
106
|
+
return [...RIVAL3_GEN2_DPI_TO_BYTE.keys()].sort((a, b) => a - b);
|
|
107
|
+
}
|
|
108
|
+
function dpiToByte(dpi) {
|
|
109
|
+
const byte = RIVAL3_GEN2_DPI_TO_BYTE.get(dpi);
|
|
110
|
+
if (byte === undefined) {
|
|
111
|
+
throw new Rival3Gen2ProtocolError(`SteelSeries Rival 3 Gen 2 DPI must be ${RIVAL3_GEN2_DPI_MIN}–${RIVAL3_GEN2_DPI_MAX.toLocaleString("en-US")} in ${RIVAL3_GEN2_DPI_STEP} DPI steps.`);
|
|
112
|
+
}
|
|
113
|
+
return byte;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* `34 <count 1–5> <selected 0-based> <x0 y0 x1 y1 … x4 y4>` — replaces the
|
|
117
|
+
* mouse's whole preset table with five interleaved XY pairs. Exactly five
|
|
118
|
+
* presets are required (see the module doc comment).
|
|
119
|
+
*/
|
|
120
|
+
export function steelseriesRival3Gen2EncodeDpiPresets(presets, selectedIndex) {
|
|
121
|
+
if (presets.length !== RIVAL3_GEN2_MAX_DPI_PRESETS) {
|
|
122
|
+
throw new Rival3Gen2ProtocolError(`SteelSeries Rival 3 Gen 2 requires exactly ${RIVAL3_GEN2_MAX_DPI_PRESETS} DPI presets.`);
|
|
123
|
+
}
|
|
124
|
+
if (!Number.isInteger(selectedIndex) || selectedIndex < 0 || selectedIndex >= presets.length) {
|
|
125
|
+
throw new Rival3Gen2ProtocolError(`Selected DPI preset must be an index into the ${presets.length} presets being written.`);
|
|
126
|
+
}
|
|
127
|
+
return new Uint8Array([
|
|
128
|
+
...RIVAL3_GEN2_COMMAND.dpiPresets,
|
|
129
|
+
presets.length,
|
|
130
|
+
selectedIndex,
|
|
131
|
+
...presets.flatMap((preset) => [dpiToByte(preset.x), dpiToByte(preset.y)]),
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
/** `2B <v>` with 1000→0x01, 500→0x02, 250→0x03, 125→0x04. */
|
|
135
|
+
export function steelseriesRival3Gen2EncodePollingRate(pollingRateHz) {
|
|
136
|
+
const byte = POLLING_RATE_TO_BYTE.get(pollingRateHz);
|
|
137
|
+
if (byte === undefined) {
|
|
138
|
+
throw new Rival3Gen2ProtocolError("SteelSeries Rival 3 Gen 2 supports 125, 250, 500, or 1000 Hz polling.");
|
|
139
|
+
}
|
|
140
|
+
return new Uint8Array([...RIVAL3_GEN2_COMMAND.pollingRate, byte]);
|
|
141
|
+
}
|
|
142
|
+
/** `11` — commit the current settings to onboard flash. */
|
|
143
|
+
export function steelseriesRival3Gen2SaveCommand() {
|
|
144
|
+
return new Uint8Array(RIVAL3_GEN2_SAVE_COMMAND);
|
|
145
|
+
}
|
|
146
|
+
/** `90` — the device answers with a 15-byte version string. */
|
|
147
|
+
export function steelseriesRival3Gen2FirmwareQuery() {
|
|
148
|
+
return new Uint8Array(RIVAL3_GEN2_COMMAND.firmware);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Decode the 15-byte firmware version reply as ASCII, stopping at the
|
|
152
|
+
* first NUL. Same shape as the Prime Mini's reply; trailing padding is not
|
|
153
|
+
* part of the version.
|
|
154
|
+
*/
|
|
155
|
+
export function steelseriesRival3Gen2DecodeFirmware(payload) {
|
|
156
|
+
if (payload.length < RIVAL3_GEN2_FIRMWARE_RESPONSE_LENGTH) {
|
|
157
|
+
throw new Rival3Gen2ProtocolError("SteelSeries Rival 3 Gen 2 firmware response is shorter than 15 bytes.");
|
|
158
|
+
}
|
|
159
|
+
const bytes = payload.slice(0, RIVAL3_GEN2_FIRMWARE_RESPONSE_LENGTH);
|
|
160
|
+
const nul = bytes.indexOf(0x00);
|
|
161
|
+
return new TextDecoder("ascii").decode(nul === -1 ? bytes : bytes.slice(0, nul));
|
|
162
|
+
}
|
|
163
|
+
// -- Button mapping --------------------------------------------------------
|
|
164
|
+
/** 6 physical buttons plus scroll up/down (8 slots). */
|
|
165
|
+
export const RIVAL3_GEN2_BUTTONS = {
|
|
166
|
+
button1: { id: 0x01, offset: 0x00 },
|
|
167
|
+
button2: { id: 0x02, offset: 0x05 },
|
|
168
|
+
button3: { id: 0x03, offset: 0x0a },
|
|
169
|
+
button4: { id: 0x04, offset: 0x0f },
|
|
170
|
+
button5: { id: 0x05, offset: 0x14 },
|
|
171
|
+
button6: { id: 0x06, offset: 0x19 },
|
|
172
|
+
scrollUp: { id: 0x31, offset: 0x1e },
|
|
173
|
+
scrollDown: { id: 0x32, offset: 0x23 },
|
|
174
|
+
};
|
|
175
|
+
const BUTTON_FIELD_LENGTH = 5;
|
|
176
|
+
const BUTTON_DISABLE = 0x00;
|
|
177
|
+
const BUTTON_DPI_SWITCH = 0x30;
|
|
178
|
+
const BUTTON_KEYBOARD = 0x51;
|
|
179
|
+
const BUTTON_MULTIMEDIA = 0x61;
|
|
180
|
+
function encodeKeyCode(code, kind) {
|
|
181
|
+
if (!Number.isInteger(code) || code < 0 || code > 255) {
|
|
182
|
+
throw new Rival3Gen2ProtocolError(`${kind} codes must be integers 0–255.`);
|
|
183
|
+
}
|
|
184
|
+
return code;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* `2A` + one 40-byte packet (8 slots × 5-byte fields), zero-filled except
|
|
188
|
+
* where a mapping is given. Pass every button explicitly — unmapped buttons
|
|
189
|
+
* stay disabled, matching this package's no-silent-defaults policy.
|
|
190
|
+
*/
|
|
191
|
+
export function steelseriesRival3Gen2EncodeButtonsMapping(mapping) {
|
|
192
|
+
for (const name of Object.keys(mapping)) {
|
|
193
|
+
if (!Object.hasOwn(RIVAL3_GEN2_BUTTONS, name)) {
|
|
194
|
+
throw new Rival3Gen2ProtocolError(`Unknown SteelSeries Rival 3 Gen 2 button "${name}".`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const names = Object.keys(RIVAL3_GEN2_BUTTONS);
|
|
198
|
+
const packet = new Array(names.length * BUTTON_FIELD_LENGTH).fill(0x00);
|
|
199
|
+
for (const [name, action] of Object.entries(mapping)) {
|
|
200
|
+
const { offset } = RIVAL3_GEN2_BUTTONS[name];
|
|
201
|
+
switch (action.type) {
|
|
202
|
+
case "button": {
|
|
203
|
+
if (!Object.hasOwn(RIVAL3_GEN2_BUTTONS, action.target)) {
|
|
204
|
+
throw new Rival3Gen2ProtocolError(`Unknown SteelSeries Rival 3 Gen 2 button "${action.target}".`);
|
|
205
|
+
}
|
|
206
|
+
packet[offset] = RIVAL3_GEN2_BUTTONS[action.target].id;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case "disabled": {
|
|
210
|
+
packet[offset] = BUTTON_DISABLE;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
case "dpiSwitch": {
|
|
214
|
+
packet[offset] = BUTTON_DPI_SWITCH;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case "scrollUp": {
|
|
218
|
+
packet[offset] = RIVAL3_GEN2_BUTTONS.scrollUp.id;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case "scrollDown": {
|
|
222
|
+
packet[offset] = RIVAL3_GEN2_BUTTONS.scrollDown.id;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
case "keyboard": {
|
|
226
|
+
packet[offset] = BUTTON_KEYBOARD;
|
|
227
|
+
packet[offset + 1] = encodeKeyCode(action.code, "Keyboard scan");
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case "multimedia": {
|
|
231
|
+
packet[offset] = BUTTON_MULTIMEDIA;
|
|
232
|
+
packet[offset + 1] = encodeKeyCode(action.code, "Multimedia key");
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
default: {
|
|
236
|
+
throw new Rival3Gen2ProtocolError("Unsupported SteelSeries Rival 3 Gen 2 button action.");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return new Uint8Array([...RIVAL3_GEN2_COMMAND.buttonsMapping, ...packet]);
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=rival-3-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rival-3-v2.js","sourceRoot":"","sources":["../../src/steelseries/rival-3-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,uBAAuB,GAAgC,IAAI,GAAG,CAAC;IAC1E,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC;IAC5E,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IAChF,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IAClF,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IA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