@openmouse/protocol 0.23.1 → 0.25.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/README.md +7 -1
- package/dist/drivers/gearhub/hid.d.ts +21 -12
- package/dist/drivers/gearhub/hid.d.ts.map +1 -1
- package/dist/drivers/gearhub/hid.js +136 -23
- package/dist/drivers/gearhub/hid.js.map +1 -1
- package/dist/drivers/lamzu/hid.d.ts +10 -1
- package/dist/drivers/lamzu/hid.d.ts.map +1 -1
- package/dist/drivers/lamzu/hid.js +88 -7
- package/dist/drivers/lamzu/hid.js.map +1 -1
- package/dist/drivers/mouse-types.d.ts +3 -1
- package/dist/drivers/mouse-types.d.ts.map +1 -1
- package/dist/drivers/redragon/m690-pro-hid.d.ts +116 -0
- package/dist/drivers/redragon/m690-pro-hid.d.ts.map +1 -0
- package/dist/drivers/redragon/m690-pro-hid.js +482 -0
- package/dist/drivers/redragon/m690-pro-hid.js.map +1 -0
- package/dist/drivers/registry.d.ts +3 -1
- package/dist/drivers/registry.d.ts.map +1 -1
- package/dist/drivers/registry.js +7 -0
- package/dist/drivers/registry.js.map +1 -1
- package/dist/drivers/steelseries/aerox3-wireless-hid.d.ts +79 -0
- package/dist/drivers/steelseries/aerox3-wireless-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/aerox3-wireless-hid.js +416 -0
- package/dist/drivers/steelseries/aerox3-wireless-hid.js.map +1 -0
- package/dist/drivers/vendors.d.ts +7 -0
- package/dist/drivers/vendors.d.ts.map +1 -1
- package/dist/drivers/vendors.js +26 -6
- package/dist/drivers/vendors.js.map +1 -1
- package/dist/gearhub/index.d.ts +26 -6
- package/dist/gearhub/index.d.ts.map +1 -1
- package/dist/gearhub/index.js +43 -4
- package/dist/gearhub/index.js.map +1 -1
- package/dist/lamzu/index.d.ts +4 -1
- package/dist/lamzu/index.d.ts.map +1 -1
- package/dist/lamzu/index.js +24 -0
- package/dist/lamzu/index.js.map +1 -1
- package/dist/lamzu/lunafury.d.ts +82 -0
- package/dist/lamzu/lunafury.d.ts.map +1 -0
- package/dist/lamzu/lunafury.js +76 -0
- package/dist/lamzu/lunafury.js.map +1 -0
- package/dist/redragon/index.d.ts +1 -0
- package/dist/redragon/index.d.ts.map +1 -1
- package/dist/redragon/index.js +2 -27
- package/dist/redragon/index.js.map +1 -1
- package/dist/redragon/keys.d.ts +15 -0
- package/dist/redragon/keys.d.ts.map +1 -0
- package/dist/redragon/keys.js +42 -0
- package/dist/redragon/keys.js.map +1 -0
- package/dist/redragon/m690-pro.d.ts +210 -0
- package/dist/redragon/m690-pro.d.ts.map +1 -0
- package/dist/redragon/m690-pro.js +416 -0
- package/dist/redragon/m690-pro.js.map +1 -0
- package/dist/steelseries/aerox3-wireless.d.ts +178 -0
- package/dist/steelseries/aerox3-wireless.d.ts.map +1 -0
- package/dist/steelseries/aerox3-wireless.js +283 -0
- package/dist/steelseries/aerox3-wireless.js.map +1 -0
- package/dist/steelseries/devices.d.ts +6 -1
- package/dist/steelseries/devices.d.ts.map +1 -1
- package/dist/steelseries/devices.js +41 -0
- package/dist/steelseries/devices.js.map +1 -1
- package/dist/steelseries/index.d.ts +1 -0
- package/dist/steelseries/index.d.ts.map +1 -1
- package/dist/steelseries/index.js +1 -0
- package/dist/steelseries/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { KEY_USAGES, NUMPAD_USAGES, SHORTCUTS, keyName } from "./keys.js";
|
|
2
|
+
export const REDRAGON_M690_PRO_VENDOR_ID = 0x258a; // SinoWealth
|
|
3
|
+
export const REDRAGON_M690_PRO_WIRED_PRODUCT_ID = 0x002e;
|
|
4
|
+
export const REDRAGON_M690_PRO_RECEIVER_PRODUCT_ID = 0x002f;
|
|
5
|
+
/**
|
|
6
|
+
* The cable and the receiver each keep their own settings bank; the vendor
|
|
7
|
+
* app reads and writes the bank of whichever PID it is connected to.
|
|
8
|
+
*
|
|
9
|
+
* Verified on mouse firmware 2.95 and 2.97 (receiver 6.05), over the cable
|
|
10
|
+
* and through the receiver: in Chrome on Windows (and on macOS through the
|
|
11
|
+
* receiver), every setting read, written and read back; through OpenMouse
|
|
12
|
+
* Bridge on Windows, also the battery (receiver), charging status (cable)
|
|
13
|
+
* and the receiver's link check, which a browser cannot read. OpenMouse's
|
|
14
|
+
* hardware test passed on all four paths; its polling sampler saw dropouts
|
|
15
|
+
* through Bridge, so there the rate was read back but not measured.
|
|
16
|
+
*/
|
|
17
|
+
export const REDRAGON_M690_PRO_PRODUCTS = new Map([
|
|
18
|
+
[REDRAGON_M690_PRO_WIRED_PRODUCT_ID, {
|
|
19
|
+
name: "M690 PRO",
|
|
20
|
+
connection: "Wired",
|
|
21
|
+
configCommand: 0x11,
|
|
22
|
+
buttonsCommand: 0x12,
|
|
23
|
+
verified: true,
|
|
24
|
+
}],
|
|
25
|
+
[REDRAGON_M690_PRO_RECEIVER_PRODUCT_ID, {
|
|
26
|
+
name: "M690 PRO",
|
|
27
|
+
connection: "Wireless",
|
|
28
|
+
configCommand: 0x21,
|
|
29
|
+
buttonsCommand: 0x22,
|
|
30
|
+
verified: true,
|
|
31
|
+
}],
|
|
32
|
+
]);
|
|
33
|
+
export const REDRAGON_M690_PRO_PRODUCT_IDS = [...REDRAGON_M690_PRO_PRODUCTS.keys()];
|
|
34
|
+
/** Vendor collection on USB interface 1 carrying reports 5, 7 and 8. */
|
|
35
|
+
export const REDRAGON_M690_PRO_USAGE_PAGE = 0xff00;
|
|
36
|
+
export const REDRAGON_M690_PRO_USAGE = 0x01;
|
|
37
|
+
/** 7-byte feature report: commands and their short answers. */
|
|
38
|
+
export const REDRAGON_M690_PRO_COMMAND_REPORT_ID = 5;
|
|
39
|
+
export const REDRAGON_M690_PRO_COMMAND_LENGTH = 8;
|
|
40
|
+
/** 519-byte feature report: settings and button blocks. */
|
|
41
|
+
export const REDRAGON_M690_PRO_BLOCK_REPORT_ID = 8;
|
|
42
|
+
export const REDRAGON_M690_PRO_BLOCK_LENGTH = 520;
|
|
43
|
+
/** 7-byte input report the mouse sends when its DPI button changes stage. */
|
|
44
|
+
export const REDRAGON_M690_PRO_EVENT_REPORT_ID = 7;
|
|
45
|
+
export const REDRAGON_M690_PRO_CMD_IDENTIFY = 0x01;
|
|
46
|
+
/** Receiver only: whether the mouse is linked (`[05 80 01 ..]`) or off/asleep (`[05 80 00 ..]`). */
|
|
47
|
+
export const REDRAGON_M690_PRO_CMD_LINK = 0x80;
|
|
48
|
+
/** Polled every 30 s by the vendor app: connection and battery. */
|
|
49
|
+
export const REDRAGON_M690_PRO_CMD_STATUS = 0x90;
|
|
50
|
+
/** ASCII model id the identify command answers on both firmware revisions seen (2.95, 2.97). */
|
|
51
|
+
export const REDRAGON_M690_PRO_DEVICE_ID = "2945";
|
|
52
|
+
/**
|
|
53
|
+
* Byte 9 of every settings block captured (every unit and firmware
|
|
54
|
+
* revision, cable and receiver banks); libratbag's layout puts the sensor
|
|
55
|
+
* type there. Browsers cannot read the identify answer (see
|
|
56
|
+
* `redragonM690ProIsModelBlock`), so this byte stands in for it.
|
|
57
|
+
*/
|
|
58
|
+
export const REDRAGON_M690_PRO_MODEL_BYTE = 0x13;
|
|
59
|
+
const OFFSET_MODEL = 0x09;
|
|
60
|
+
/** Bytes of each block that are meaningful, report id included; the rest of a 520-byte write is zero. */
|
|
61
|
+
export const REDRAGON_M690_PRO_CONFIG_LENGTH = 154;
|
|
62
|
+
export const REDRAGON_M690_PRO_BUTTONS_LENGTH = 88;
|
|
63
|
+
/** Byte [3] of a block write carries the block length minus 8 (0x92 settings, 0x50 buttons). */
|
|
64
|
+
const WRITE_LENGTH_OFFSET = 3;
|
|
65
|
+
/** The vendor app appends 0xa5 after the button block when it writes it. */
|
|
66
|
+
export const REDRAGON_M690_PRO_BUTTONS_TRAILER = 0xa5;
|
|
67
|
+
const OFFSET_POLLING = 0x0a;
|
|
68
|
+
const OFFSET_STAGES = 0x0b;
|
|
69
|
+
const OFFSET_STAGE_DPI = 0x0d;
|
|
70
|
+
const OFFSET_STAGE_COLORS = 0x2d;
|
|
71
|
+
const OFFSET_EFFECT = 0x45;
|
|
72
|
+
const OFFSET_STREAMING = 0x46;
|
|
73
|
+
const OFFSET_STEADY = 0x48;
|
|
74
|
+
const OFFSET_BREATHING = 0x4c;
|
|
75
|
+
const OFFSET_STEADY_COLORS = 0x66;
|
|
76
|
+
export const REDRAGON_M690_PRO_STAGE_COUNT = 5;
|
|
77
|
+
export const REDRAGON_M690_PRO_STEADY_COLOR_SLOTS = 7;
|
|
78
|
+
/**
|
|
79
|
+
* The vendor app's DPI choices (its Cfg.ini `DPISET`). Each stage stores the
|
|
80
|
+
* 1-based position in this list, not a DPI: 250 -> 0x01, 500 -> 0x02,
|
|
81
|
+
* 3000 -> 0x0c, 8000 -> 0x18 were all captured.
|
|
82
|
+
*/
|
|
83
|
+
export const REDRAGON_M690_PRO_DPI_LABELS = [
|
|
84
|
+
250, 500, 800, 1000, 1200, 1500, 1750, 2000, 2250, 2400, 2750, 3000,
|
|
85
|
+
3200, 3500, 3750, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000,
|
|
86
|
+
];
|
|
87
|
+
/**
|
|
88
|
+
* Polling code in the low nibble of byte 0x0a, as in libratbag's map for
|
|
89
|
+
* this framing. Each rate was confirmed by the mouse's report interval after
|
|
90
|
+
* a write (125/250/500 from the vendor app, 1000 from this driver).
|
|
91
|
+
*/
|
|
92
|
+
export const REDRAGON_M690_PRO_POLLING_CODES = {
|
|
93
|
+
125: 0x01,
|
|
94
|
+
250: 0x02,
|
|
95
|
+
500: 0x03,
|
|
96
|
+
1000: 0x04,
|
|
97
|
+
};
|
|
98
|
+
export const REDRAGON_M690_PRO_POLLING_RATES = [125, 250, 500, 1000];
|
|
99
|
+
/** Effect codes at byte 0x45, named as in the vendor app's text table. */
|
|
100
|
+
export const REDRAGON_M690_PRO_EFFECTS = {
|
|
101
|
+
0x01: "Colorful Streaming",
|
|
102
|
+
0x02: "Steady",
|
|
103
|
+
0x03: "Breathing",
|
|
104
|
+
};
|
|
105
|
+
export const REDRAGON_M690_PRO_EFFECT_STREAMING = 0x01;
|
|
106
|
+
export const REDRAGON_M690_PRO_EFFECT_STEADY = 0x02;
|
|
107
|
+
export const REDRAGON_M690_PRO_EFFECT_BREATHING = 0x03;
|
|
108
|
+
/** Brightness the vendor app's slider offers (0 is dark). */
|
|
109
|
+
export const REDRAGON_M690_PRO_MAX_BRIGHTNESS = 4;
|
|
110
|
+
/** A 7-byte command frame, report id first: `[05 cmd 00 00 00 00 00 00]`. */
|
|
111
|
+
export function redragonM690ProEncodeCommand(command) {
|
|
112
|
+
const frame = new Uint8Array(REDRAGON_M690_PRO_COMMAND_LENGTH);
|
|
113
|
+
frame[0] = REDRAGON_M690_PRO_COMMAND_REPORT_ID;
|
|
114
|
+
frame[1] = command;
|
|
115
|
+
return frame;
|
|
116
|
+
}
|
|
117
|
+
/** Throws unless `reply` is report 5 answering `command`. */
|
|
118
|
+
export function redragonM690ProCheckCommandReply(reply, command) {
|
|
119
|
+
if (reply.length < 4 || reply[0] !== REDRAGON_M690_PRO_COMMAND_REPORT_ID || reply[1] !== command) {
|
|
120
|
+
throw new Error(`The Redragon M690 PRO answered command 0x${command.toString(16)} with ${hex(reply.subarray(0, 8))}.`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** `[05 01 32 39 34 35 ..]` -> "2945". */
|
|
124
|
+
export function redragonM690ProDecodeIdentity(reply) {
|
|
125
|
+
redragonM690ProCheckCommandReply(reply, REDRAGON_M690_PRO_CMD_IDENTIFY);
|
|
126
|
+
return String.fromCharCode(...reply.subarray(2, 6));
|
|
127
|
+
}
|
|
128
|
+
/** `[05 80 01 01 ..]` linked, `[05 80 00 01 ..]` mouse off or asleep. */
|
|
129
|
+
export function redragonM690ProDecodeLink(reply) {
|
|
130
|
+
redragonM690ProCheckCommandReply(reply, REDRAGON_M690_PRO_CMD_LINK);
|
|
131
|
+
return reply[2] === 0x01;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* `[05 90 11 64 ..]` through the receiver: byte 3 is the battery level,
|
|
135
|
+
* 0-100 (0x64 -> 0x63 seen as it drained). The vendor app showed "80 %" for
|
|
136
|
+
* 0x63 on a fully charged unit, so it displays coarser steps; the raw level
|
|
137
|
+
* is reported. Over the cable byte 3 is the charge
|
|
138
|
+
* state: `01` while charging, `02` once charged, when the vendor app shows
|
|
139
|
+
* "100 %" and the wheel LED turns green (a mouse plugged in at full charge
|
|
140
|
+
* answered `01` for about a minute, then `02`).
|
|
141
|
+
*/
|
|
142
|
+
export function redragonM690ProDecodeStatus(reply) {
|
|
143
|
+
redragonM690ProCheckCommandReply(reply, REDRAGON_M690_PRO_CMD_STATUS);
|
|
144
|
+
const wireless = (reply[2] & 0x01) === 0x01;
|
|
145
|
+
const raw = reply[3];
|
|
146
|
+
if (wireless)
|
|
147
|
+
return { wireless, batteryPercent: raw <= 100 ? raw : null, charge: null, raw };
|
|
148
|
+
const charge = raw === 0x01 ? "Charging" : raw === 0x02 ? "Full" : null;
|
|
149
|
+
return { wireless, batteryPercent: charge === "Full" ? 100 : null, charge, raw };
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Throws unless `block` is a report-8 answer to `command` long enough to hold
|
|
153
|
+
* `length` bytes. The settings block also ends in the vendor's `a5 00` marker.
|
|
154
|
+
*/
|
|
155
|
+
export function redragonM690ProCheckBlock(block, command, length) {
|
|
156
|
+
if (block.length < length || block[0] !== REDRAGON_M690_PRO_BLOCK_REPORT_ID || block[1] !== command) {
|
|
157
|
+
throw new Error(`The Redragon M690 PRO answered block 0x${command.toString(16)} with ${block.length} bytes starting ${hex(block.subarray(0, 8))}.`);
|
|
158
|
+
}
|
|
159
|
+
if (length === REDRAGON_M690_PRO_CONFIG_LENGTH && block[length - 2] !== 0xa5) {
|
|
160
|
+
throw new Error("The Redragon M690 PRO settings block lacks its a5 end marker; not using it.");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Whether a checked settings block (`redragonM690ProCheckBlock`) is the M690
|
|
165
|
+
* PRO's. The identify command's answer is the better proof, but it arrives on
|
|
166
|
+
* the 7-byte feature report 5, and the firmware STALLs a report-5 read unless
|
|
167
|
+
* it asks for exactly 8 bytes; Chrome asks for the device's largest feature
|
|
168
|
+
* report (520 bytes) on every read, so in a browser only report 8 answers.
|
|
169
|
+
*/
|
|
170
|
+
export function redragonM690ProIsModelBlock(block) {
|
|
171
|
+
return block.length >= REDRAGON_M690_PRO_CONFIG_LENGTH && block[OFFSET_MODEL] === REDRAGON_M690_PRO_MODEL_BYTE;
|
|
172
|
+
}
|
|
173
|
+
function rgbAt(block, offset) {
|
|
174
|
+
return { r: block[offset], g: block[offset + 1], b: block[offset + 2] };
|
|
175
|
+
}
|
|
176
|
+
/** Decodes a settings block (report id first, at least 154 bytes). */
|
|
177
|
+
export function redragonM690ProDecodeConfig(block) {
|
|
178
|
+
const pollingCode = block[OFFSET_POLLING] & 0x0f;
|
|
179
|
+
const pollingHz = REDRAGON_M690_PRO_POLLING_RATES.find((hz) => REDRAGON_M690_PRO_POLLING_CODES[hz] === pollingCode) ?? null;
|
|
180
|
+
const stageCount = block[OFFSET_STAGES] & 0x0f;
|
|
181
|
+
const activeStage = (block[OFFSET_STAGES] >> 4) - 1;
|
|
182
|
+
const stages = Array.from({ length: REDRAGON_M690_PRO_STAGE_COUNT }, (_, stage) => REDRAGON_M690_PRO_DPI_LABELS[block[OFFSET_STAGE_DPI + 2 * stage] - 1] ?? null);
|
|
183
|
+
const stageColors = Array.from({ length: REDRAGON_M690_PRO_STAGE_COUNT }, (_, stage) => rgbAt(block, OFFSET_STAGE_COLORS + 3 * stage));
|
|
184
|
+
const nibbles = (byte) => ({ brightness: byte >> 4, low: byte & 0x0f });
|
|
185
|
+
const streaming = nibbles(block[OFFSET_STREAMING]);
|
|
186
|
+
const steady = nibbles(block[OFFSET_STEADY]);
|
|
187
|
+
const breathing = nibbles(block[OFFSET_BREATHING]);
|
|
188
|
+
return {
|
|
189
|
+
pollingHz,
|
|
190
|
+
stageCount,
|
|
191
|
+
activeStage,
|
|
192
|
+
disabledStages: block[OFFSET_STAGES + 1],
|
|
193
|
+
stages,
|
|
194
|
+
stageColors,
|
|
195
|
+
lighting: {
|
|
196
|
+
effect: block[OFFSET_EFFECT],
|
|
197
|
+
streaming: { brightness: streaming.brightness, speed: streaming.low },
|
|
198
|
+
steady: { brightness: steady.brightness, slot: steady.low },
|
|
199
|
+
breathing: { brightness: breathing.brightness, speed: breathing.low },
|
|
200
|
+
steadyColors: Array.from({ length: REDRAGON_M690_PRO_STEADY_COLOR_SLOTS }, (_, slot) => rgbAt(block, OFFSET_STEADY_COLORS + 3 * slot)),
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function editable(block, length) {
|
|
205
|
+
return Uint8Array.from(block.subarray(0, length));
|
|
206
|
+
}
|
|
207
|
+
function checkStage(stage) {
|
|
208
|
+
if (!Number.isInteger(stage) || stage < 0 || stage >= REDRAGON_M690_PRO_STAGE_COUNT) {
|
|
209
|
+
throw new Error(`Redragon M690 PRO DPI stage ${stage} is outside 0-${REDRAGON_M690_PRO_STAGE_COUNT - 1}.`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function checkNibble(name, value, max) {
|
|
213
|
+
if (!Number.isInteger(value) || value < 0 || value > max) {
|
|
214
|
+
throw new Error(`Redragon M690 PRO ${name} ${value} is outside 0-${max}.`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/** The DPI label nearest to `dpi`, as the vendor slider would land. */
|
|
218
|
+
export function redragonM690ProNearestDpi(dpi) {
|
|
219
|
+
if (!Number.isFinite(dpi))
|
|
220
|
+
throw new Error(`Redragon M690 PRO DPI ${dpi} is not a number.`);
|
|
221
|
+
return REDRAGON_M690_PRO_DPI_LABELS.reduce((best, label) => Math.abs(label - dpi) < Math.abs(best - dpi) ? label : best);
|
|
222
|
+
}
|
|
223
|
+
/** Returns a copy of `block` with the polling code replaced (flag nibble kept). */
|
|
224
|
+
export function redragonM690ProWithPollingRate(block, hz) {
|
|
225
|
+
const code = REDRAGON_M690_PRO_POLLING_CODES[hz];
|
|
226
|
+
if (code === undefined) {
|
|
227
|
+
throw new Error(`Redragon M690 PRO polling rate ${hz} Hz is not one of ${REDRAGON_M690_PRO_POLLING_RATES.join(", ")}.`);
|
|
228
|
+
}
|
|
229
|
+
const next = editable(block, REDRAGON_M690_PRO_CONFIG_LENGTH);
|
|
230
|
+
next[OFFSET_POLLING] = (next[OFFSET_POLLING] & 0xf0) | code;
|
|
231
|
+
return next;
|
|
232
|
+
}
|
|
233
|
+
/** Returns a copy of `block` with one stage set to a vendor DPI label; the byte after it is kept. */
|
|
234
|
+
export function redragonM690ProWithStageDpi(block, stage, dpi) {
|
|
235
|
+
checkStage(stage);
|
|
236
|
+
const index = REDRAGON_M690_PRO_DPI_LABELS.indexOf(dpi);
|
|
237
|
+
if (index < 0)
|
|
238
|
+
throw new Error(`Redragon M690 PRO DPI ${dpi} is not one of the vendor app's values.`);
|
|
239
|
+
const next = editable(block, REDRAGON_M690_PRO_CONFIG_LENGTH);
|
|
240
|
+
next[OFFSET_STAGE_DPI + 2 * stage] = index + 1;
|
|
241
|
+
return next;
|
|
242
|
+
}
|
|
243
|
+
/** Returns a copy of `block` with the active stage (high nibble of 0x0b) replaced. */
|
|
244
|
+
export function redragonM690ProWithActiveStage(block, stage) {
|
|
245
|
+
checkStage(stage);
|
|
246
|
+
const next = editable(block, REDRAGON_M690_PRO_CONFIG_LENGTH);
|
|
247
|
+
next[OFFSET_STAGES] = ((stage + 1) << 4) | (next[OFFSET_STAGES] & 0x0f);
|
|
248
|
+
return next;
|
|
249
|
+
}
|
|
250
|
+
/** Returns a copy of `block` with one stage's indicator colour replaced. */
|
|
251
|
+
export function redragonM690ProWithStageColor(block, stage, rgb) {
|
|
252
|
+
checkStage(stage);
|
|
253
|
+
const next = editable(block, REDRAGON_M690_PRO_CONFIG_LENGTH);
|
|
254
|
+
next.set([rgb.r, rgb.g, rgb.b], OFFSET_STAGE_COLORS + 3 * stage);
|
|
255
|
+
return next;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Returns a copy of `block` with the effect selected and that effect's own
|
|
259
|
+
* parameter byte updated; other effects' bytes are left as stored.
|
|
260
|
+
*/
|
|
261
|
+
export function redragonM690ProWithLighting(block, change) {
|
|
262
|
+
const next = editable(block, REDRAGON_M690_PRO_CONFIG_LENGTH);
|
|
263
|
+
const offset = change.effect === REDRAGON_M690_PRO_EFFECT_STREAMING ? OFFSET_STREAMING
|
|
264
|
+
: change.effect === REDRAGON_M690_PRO_EFFECT_STEADY ? OFFSET_STEADY
|
|
265
|
+
: change.effect === REDRAGON_M690_PRO_EFFECT_BREATHING ? OFFSET_BREATHING
|
|
266
|
+
: null;
|
|
267
|
+
if (offset === null)
|
|
268
|
+
throw new Error(`Redragon M690 PRO lighting effect ${change.effect} cannot be written.`);
|
|
269
|
+
let brightness = next[offset] >> 4;
|
|
270
|
+
let low = next[offset] & 0x0f;
|
|
271
|
+
if (change.brightness !== undefined) {
|
|
272
|
+
checkNibble("brightness", change.brightness, REDRAGON_M690_PRO_MAX_BRIGHTNESS);
|
|
273
|
+
brightness = change.brightness;
|
|
274
|
+
}
|
|
275
|
+
if (change.speed !== undefined) {
|
|
276
|
+
if (change.effect === REDRAGON_M690_PRO_EFFECT_STEADY)
|
|
277
|
+
throw new Error("Redragon M690 PRO Steady lighting has no speed.");
|
|
278
|
+
checkNibble("lighting speed", change.speed, 0x0f);
|
|
279
|
+
low = change.speed;
|
|
280
|
+
}
|
|
281
|
+
if (change.color !== undefined) {
|
|
282
|
+
if (change.effect !== REDRAGON_M690_PRO_EFFECT_STEADY)
|
|
283
|
+
throw new Error("Only Steady lighting takes a colour on the Redragon M690 PRO.");
|
|
284
|
+
if (low >= REDRAGON_M690_PRO_STEADY_COLOR_SLOTS)
|
|
285
|
+
low = 0;
|
|
286
|
+
next.set([change.color.r, change.color.g, change.color.b], OFFSET_STEADY_COLORS + 3 * low);
|
|
287
|
+
}
|
|
288
|
+
next[OFFSET_EFFECT] = change.effect;
|
|
289
|
+
next[offset] = (brightness << 4) | low;
|
|
290
|
+
return next;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* The 520-byte report-8 write the vendor app sends for a block: the block as
|
|
294
|
+
* read (report id first), byte [3] set to its length minus 8, an optional
|
|
295
|
+
* trailer byte after it, and zero padding.
|
|
296
|
+
*/
|
|
297
|
+
export function redragonM690ProEncodeBlockWrite(block, length, trailer) {
|
|
298
|
+
if (block.length < length)
|
|
299
|
+
throw new Error(`Redragon M690 PRO block is ${block.length} bytes; expected ${length}.`);
|
|
300
|
+
const frame = new Uint8Array(REDRAGON_M690_PRO_BLOCK_LENGTH);
|
|
301
|
+
frame.set(block.subarray(0, length));
|
|
302
|
+
frame[WRITE_LENGTH_OFFSET] = length - 8;
|
|
303
|
+
if (trailer !== undefined)
|
|
304
|
+
frame[length] = trailer;
|
|
305
|
+
return frame;
|
|
306
|
+
}
|
|
307
|
+
// ---------------------------------------------------------------------------
|
|
308
|
+
// Buttons: 4-byte slots from offset 8 of the button block.
|
|
309
|
+
// ---------------------------------------------------------------------------
|
|
310
|
+
/**
|
|
311
|
+
* The vendor app's buttons 1-8 and the slot each one writes (Cfg.ini `Kn_1`
|
|
312
|
+
* last byte; button 4 -> slot 5 was captured when a macro was assigned to it).
|
|
313
|
+
* Names follow the factory function of each button.
|
|
314
|
+
*/
|
|
315
|
+
export const REDRAGON_M690_PRO_BUTTONS = [
|
|
316
|
+
["Left (1)", 1],
|
|
317
|
+
["Right (2)", 2],
|
|
318
|
+
["Wheel click (3)", 3],
|
|
319
|
+
["Forward (4)", 5],
|
|
320
|
+
["Back (5)", 4],
|
|
321
|
+
["DPI up (6)", 6],
|
|
322
|
+
["DPI down (7)", 7],
|
|
323
|
+
["Fire (8)", 8],
|
|
324
|
+
];
|
|
325
|
+
/** Consumer-control bits in the order of the mouse's own report-2 descriptor. */
|
|
326
|
+
const MEDIA_KEYS = [
|
|
327
|
+
["Next track", 0, 0], ["Previous track", 0, 1], ["Stop", 0, 2], ["Play/Pause", 0, 3],
|
|
328
|
+
["Mute", 0, 4], ["Volume up", 0, 6], ["Volume down", 0, 7],
|
|
329
|
+
["Media player", 1, 0], ["File explorer", 1, 1], ["Email", 1, 4], ["Calculator", 1, 5],
|
|
330
|
+
["Web search", 2, 0], ["Web home", 2, 1], ["Web back", 2, 2], ["Web forward", 2, 3],
|
|
331
|
+
["Web stop", 2, 4], ["Web refresh", 2, 5], ["Web favorites", 2, 6],
|
|
332
|
+
];
|
|
333
|
+
/** Actions whose slot bytes were captured from the vendor app or read from factory slots. */
|
|
334
|
+
const FIXED_ACTIONS = [
|
|
335
|
+
["Left click", [0x11, 0x01, 0x00, 0x00]],
|
|
336
|
+
["Right click", [0x11, 0x02, 0x00, 0x00]],
|
|
337
|
+
["Middle click", [0x11, 0x04, 0x00, 0x00]],
|
|
338
|
+
["Back", [0x11, 0x08, 0x00, 0x00]],
|
|
339
|
+
["Forward", [0x11, 0x10, 0x00, 0x00]],
|
|
340
|
+
["DPI up", [0x41, 0x01, 0x00, 0x00]],
|
|
341
|
+
["DPI down", [0x41, 0x02, 0x00, 0x00]],
|
|
342
|
+
["Three click", [0x31, 0x01, 0x32, 0x03]],
|
|
343
|
+
["Lighting on/off", [0x50, 0x02, 0x00, 0x00]],
|
|
344
|
+
["Disabled", [0x50, 0x01, 0x00, 0x00]],
|
|
345
|
+
];
|
|
346
|
+
/**
|
|
347
|
+
* Keyboard keys are `21 modifiers usage 00` with the HID modifier bits and
|
|
348
|
+
* usage IDs (see ./keys.ts). Captured from the vendor app and confirmed by
|
|
349
|
+
* the keyboard report the mouse sent on each press: Ctrl+Shift+R `21 03 15`,
|
|
350
|
+
* Alt+A `21 04 04`, Win+W `21 08 1a`, and A, \, Delete, Up arrow, F12,
|
|
351
|
+
* Numpad 5 and Backspace with no modifier.
|
|
352
|
+
*/
|
|
353
|
+
const KEY_TYPE = 0x21;
|
|
354
|
+
const KEYS = [...KEY_USAGES, ...NUMPAD_USAGES];
|
|
355
|
+
const usageOf = (key) => KEYS.find(([name]) => name === key)[1];
|
|
356
|
+
const SHORTCUT_ACTIONS = SHORTCUTS.map(([name, modifiers, key]) => [`${name} (${keyName(modifiers, usageOf(key))})`, [KEY_TYPE, modifiers, usageOf(key), 0x00]]);
|
|
357
|
+
const KEY_ACTIONS = KEYS.map(([name, usage]) => [`Key ${name}`, [KEY_TYPE, 0x00, usage, 0x00]]);
|
|
358
|
+
/** Every action `redragonM690ProEncodeButtonAction` accepts, in display order. */
|
|
359
|
+
export const REDRAGON_M690_PRO_BUTTON_OPTIONS = [
|
|
360
|
+
...FIXED_ACTIONS.map(([name]) => name),
|
|
361
|
+
...MEDIA_KEYS.map(([name]) => name),
|
|
362
|
+
...SHORTCUT_ACTIONS.map(([name]) => name),
|
|
363
|
+
...KEY_ACTIONS.map(([name]) => name),
|
|
364
|
+
];
|
|
365
|
+
export function redragonM690ProEncodeButtonAction(action) {
|
|
366
|
+
const fixed = [...FIXED_ACTIONS, ...SHORTCUT_ACTIONS, ...KEY_ACTIONS].find(([name]) => name === action);
|
|
367
|
+
if (fixed)
|
|
368
|
+
return [...fixed[1]];
|
|
369
|
+
const media = MEDIA_KEYS.find(([name]) => name === action);
|
|
370
|
+
if (media) {
|
|
371
|
+
const bytes = [0x22, 0x00, 0x00, 0x00];
|
|
372
|
+
bytes[1 + media[1]] = 1 << media[2];
|
|
373
|
+
return bytes;
|
|
374
|
+
}
|
|
375
|
+
throw new Error(`The Redragon M690 PRO has no button action "${action}".`);
|
|
376
|
+
}
|
|
377
|
+
/** Names a 4-byte slot; anything not offered (macros, keys) decodes to its raw bytes. */
|
|
378
|
+
export function redragonM690ProDecodeButtonAction(slot) {
|
|
379
|
+
const bytes = Array.from(slot).slice(0, 4);
|
|
380
|
+
const fixed = [...FIXED_ACTIONS, ...SHORTCUT_ACTIONS, ...KEY_ACTIONS].find(([, value]) => value.every((byte, index) => byte === bytes[index]));
|
|
381
|
+
if (fixed)
|
|
382
|
+
return fixed[0];
|
|
383
|
+
if (bytes[0] === KEY_TYPE && bytes[3] === 0x00) {
|
|
384
|
+
const combination = keyName(bytes[1], bytes[2], KEYS);
|
|
385
|
+
if (combination)
|
|
386
|
+
return `Keys ${combination}`;
|
|
387
|
+
}
|
|
388
|
+
if (bytes[0] === 0x22) {
|
|
389
|
+
const media = MEDIA_KEYS.find(([, byte, bit]) => bytes.slice(1).every((value, index) => value === (index === byte ? 1 << bit : 0)));
|
|
390
|
+
if (media)
|
|
391
|
+
return media[0];
|
|
392
|
+
}
|
|
393
|
+
if (bytes[0] === 0x70)
|
|
394
|
+
return `Macro ${bytes[1]}`;
|
|
395
|
+
return `Custom (${hex(bytes)})`;
|
|
396
|
+
}
|
|
397
|
+
function slotOffset(slot) {
|
|
398
|
+
return 8 + 4 * (slot - 1);
|
|
399
|
+
}
|
|
400
|
+
/** Decodes the eight vendor-app buttons from a button block. */
|
|
401
|
+
export function redragonM690ProDecodeButtons(block) {
|
|
402
|
+
return Object.fromEntries(REDRAGON_M690_PRO_BUTTONS.map(([name, slot]) => [name, redragonM690ProDecodeButtonAction(block.subarray(slotOffset(slot), slotOffset(slot) + 4))]));
|
|
403
|
+
}
|
|
404
|
+
/** Returns a copy of the button block with one named button reassigned. */
|
|
405
|
+
export function redragonM690ProWithButtonAction(block, button, action) {
|
|
406
|
+
const entry = REDRAGON_M690_PRO_BUTTONS.find(([name]) => name === button);
|
|
407
|
+
if (!entry)
|
|
408
|
+
throw new Error(`The Redragon M690 PRO has no button named "${button}".`);
|
|
409
|
+
const next = editable(block, REDRAGON_M690_PRO_BUTTONS_LENGTH);
|
|
410
|
+
next.set(redragonM690ProEncodeButtonAction(action), slotOffset(entry[1]));
|
|
411
|
+
return next;
|
|
412
|
+
}
|
|
413
|
+
function hex(bytes) {
|
|
414
|
+
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join(" ");
|
|
415
|
+
}
|
|
416
|
+
//# sourceMappingURL=m690-pro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m690-pro.js","sourceRoot":"","sources":["../../src/redragon/m690-pro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0B1E,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,CAAC,aAAa;AAChE,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;AACzD,MAAM,CAAC,MAAM,qCAAqC,GAAG,MAAM,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAgD,IAAI,GAAG,CAAC;IAC7F,CAAC,kCAAkC,EAAE;YACnC,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,OAAO;YACnB,aAAa,EAAE,IAAI;YACnB,cAAc,EAAE,IAAI;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;IACF,CAAC,qCAAqC,EAAE;YACtC,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE,IAAI;YACnB,cAAc,EAAE,IAAI;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAsB,CAAC,GAAG,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC;AAEvG,wEAAwE;AACxE,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AACnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAC5C,+DAA+D;AAC/D,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAClD,2DAA2D;AAC3D,MAAM,CAA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,CAAC,CAAC,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,GAAG,CAAC,KAAwB;IACnC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* steelseries aerox 3 wireless configuration protocol, pure encode/decode helpers.
|
|
3
|
+
*
|
|
4
|
+
* transcribed from rivalcfg `rivalcfg/devices/aerox3_wireless_wired.py` for the
|
|
5
|
+
* usb-cabled mode, `1038:183A` and the cs2 dragon lore edition `1038:187A`, and
|
|
6
|
+
* `aerox3_wireless_wireless.py` for the 2.4 ghz dongle mode, `1038:1838` and
|
|
7
|
+
* `1038:1878`. the dongle profile is the wired settings dict passed through a
|
|
8
|
+
* `_patch_command` helper that ors `0b01000000` into byte 0 of every command,
|
|
9
|
+
* implemented here as `applyAerox3WirelessFlag`.
|
|
10
|
+
*
|
|
11
|
+
* the settings dict is byte-identical to `aerox5_wireless_wired.py` except for
|
|
12
|
+
* `buttons_mapping`: the aerox 3 wireless has 6 buttons plus scroll up/down, so
|
|
13
|
+
* its packet is 40 bytes with the scroll fields at `0x1E`/`0x23`, where the
|
|
14
|
+
* aerox 5 wireless has 9 buttons and a 55-byte packet. it is also unrelated to
|
|
15
|
+
* the wired-only aerox 3 in `./aerox3.ts`, whose polling bytes, zone packing,
|
|
16
|
+
* rainbow command and dpi preset base all differ.
|
|
17
|
+
*
|
|
18
|
+
* every command is an hid output report with report id `0x00` on the usage page
|
|
19
|
+
* `0xFFC0` collection. settings are write-only and the mouse acks each write by
|
|
20
|
+
* echoing its command byte followed by `00`. battery level is readable through
|
|
21
|
+
* `92`. the save command `11 00` persists dpi, polling, timers and buttons, but
|
|
22
|
+
* zone colors are lost at power-off and the mouse boots into its default
|
|
23
|
+
* lighting, as rivalcfg's docs warn for newer steelseries mice.
|
|
24
|
+
*/
|
|
25
|
+
export declare const AEROX3_WIRELESS_REPORT_ID = 0;
|
|
26
|
+
/** wired-mode command bytes, see `applyAerox3WirelessFlag` for 2.4 ghz mode. */
|
|
27
|
+
export declare const AEROX3_WIRELESS_COMMAND: {
|
|
28
|
+
readonly dpiPresets: readonly [45];
|
|
29
|
+
readonly pollingRate: readonly [43];
|
|
30
|
+
readonly zoneColor: readonly [33, 1];
|
|
31
|
+
readonly reactiveColor: readonly [38];
|
|
32
|
+
readonly sleepTimer: readonly [41];
|
|
33
|
+
readonly dimTimer: readonly [35, 15, 1, 0, 0];
|
|
34
|
+
readonly buttonsMapping: readonly [42];
|
|
35
|
+
readonly rainbowEffect: readonly [34, 255];
|
|
36
|
+
readonly defaultLighting: readonly [39];
|
|
37
|
+
readonly batteryLevel: readonly [146];
|
|
38
|
+
};
|
|
39
|
+
export declare const AEROX3_WIRELESS_SAVE_COMMAND: readonly [17, 0];
|
|
40
|
+
/** rivalcfg `_patch_command`: ors `0x40` into the first byte. */
|
|
41
|
+
export declare function applyAerox3WirelessFlag(command: readonly number[]): number[];
|
|
42
|
+
export declare const AEROX3_WIRELESS_POLLING_RATES: readonly [125, 250, 500, 1000];
|
|
43
|
+
export declare const AEROX3_WIRELESS_DPI_MIN = 100;
|
|
44
|
+
export declare const AEROX3_WIRELESS_DPI_MAX = 18000;
|
|
45
|
+
export declare const AEROX3_WIRELESS_DPI_STEP = 100;
|
|
46
|
+
export declare const AEROX3_WIRELESS_MAX_DPI_PRESETS = 5;
|
|
47
|
+
export declare const AEROX3_WIRELESS_SLEEP_TIMER_MAX_MINUTES = 20;
|
|
48
|
+
export declare const AEROX3_WIRELESS_DIM_TIMER_MAX_SECONDS = 1200;
|
|
49
|
+
export declare const AEROX3_WIRELESS_BATTERY_RESPONSE_LENGTH = 2;
|
|
50
|
+
/** rivalcfg profile defaults. */
|
|
51
|
+
export declare const AEROX3_WIRELESS_DEFAULT_DPI_PRESETS: readonly [400, 800, 1200, 2400, 3200];
|
|
52
|
+
export declare const AEROX3_WIRELESS_DEFAULT_POLLING_RATE = 1000;
|
|
53
|
+
export declare const AEROX3_WIRELESS_DEFAULT_SLEEP_TIMER_MINUTES = 5;
|
|
54
|
+
export declare const AEROX3_WIRELESS_DEFAULT_DIM_TIMER_SECONDS = 30;
|
|
55
|
+
export declare class Aerox3WirelessProtocolError extends Error {
|
|
56
|
+
}
|
|
57
|
+
/** every dpi the truemove air table can express, ascending. */
|
|
58
|
+
export declare function steelseriesAerox3WirelessDpiOptions(): number[];
|
|
59
|
+
/** `2D <count> <selected> <v1>...<vN>`, one byte per dpi, `selectedIndex` is 0-based on the wire. */
|
|
60
|
+
export declare function steelseriesAerox3WirelessEncodeDpiPresets(presets: readonly number[], selectedIndex: number, wireless: boolean): Uint8Array;
|
|
61
|
+
/** `2B <v>` with 1000 as `0x00` down to 125 as `0x03`. */
|
|
62
|
+
export declare function steelseriesAerox3WirelessEncodePollingRate(pollingRateHz: number, wireless: boolean): Uint8Array;
|
|
63
|
+
export interface Aerox3WirelessRgb {
|
|
64
|
+
r: number;
|
|
65
|
+
g: number;
|
|
66
|
+
b: number;
|
|
67
|
+
}
|
|
68
|
+
/** zone 1 is the top led of the strip, 2 the middle one, 3 the bottom one. */
|
|
69
|
+
export type Aerox3WirelessZone = 1 | 2 | 3;
|
|
70
|
+
export declare const AEROX3_WIRELESS_ZONES: readonly [1, 2, 3];
|
|
71
|
+
/** rivalcfg defaults are red, lime and blue. */
|
|
72
|
+
export declare const AEROX3_WIRELESS_DEFAULT_ZONE_COLORS: Readonly<Record<Aerox3WirelessZone, Aerox3WirelessRgb>>;
|
|
73
|
+
/** `21 01 <zone index> <r> <g> <b>`. */
|
|
74
|
+
export declare function steelseriesAerox3WirelessEncodeZoneColor(zone: Aerox3WirelessZone, color: Aerox3WirelessRgb, wireless: boolean): Uint8Array;
|
|
75
|
+
/** `26 01 00 <r> <g> <b>` when enabled, `26 00 00 00 00 00` when `color` is null. */
|
|
76
|
+
export declare function steelseriesAerox3WirelessEncodeReactiveColor(color: Aerox3WirelessRgb | null, wireless: boolean): Uint8Array;
|
|
77
|
+
/** `29 <ms LE24>`, idle minutes before sleep, 0 disables it. */
|
|
78
|
+
export declare function steelseriesAerox3WirelessEncodeSleepTimer(minutes: number, wireless: boolean): Uint8Array;
|
|
79
|
+
/** `23 0F 01 00 00 <ms LE24>`, idle seconds before the leds dim, 0 disables it. */
|
|
80
|
+
export declare function steelseriesAerox3WirelessEncodeDimTimer(seconds: number, wireless: boolean): Uint8Array;
|
|
81
|
+
/**
|
|
82
|
+
* `22 FF`, rivalcfg's rainbow on every zone. a `1038:183A` unit acks it but the
|
|
83
|
+
* strip stays dark, use the `rainbow` default lighting instead.
|
|
84
|
+
*/
|
|
85
|
+
export declare function steelseriesAerox3WirelessEncodeRainbowEffect(wireless: boolean): Uint8Array;
|
|
86
|
+
export declare const AEROX3_WIRELESS_DEFAULT_LIGHTING: {
|
|
87
|
+
readonly off: readonly [0, 0];
|
|
88
|
+
readonly reactive: readonly [0, 1];
|
|
89
|
+
readonly rainbow: readonly [1, 0];
|
|
90
|
+
readonly "reactive-rainbow": readonly [1, 1];
|
|
91
|
+
};
|
|
92
|
+
export type Aerox3WirelessDefaultLighting = keyof typeof AEROX3_WIRELESS_DEFAULT_LIGHTING;
|
|
93
|
+
/** `27 <v1> <v2>`, the lighting shown before a host sends any color. */
|
|
94
|
+
export declare function steelseriesAerox3WirelessEncodeDefaultLighting(mode: Aerox3WirelessDefaultLighting, wireless: boolean): Uint8Array;
|
|
95
|
+
/** `11 00`, commits the current settings to onboard flash. */
|
|
96
|
+
export declare function steelseriesAerox3WirelessSaveCommand(wireless: boolean): Uint8Array;
|
|
97
|
+
/** `92`, answered by a two-byte input report. */
|
|
98
|
+
export declare function steelseriesAerox3WirelessBatteryQuery(wireless: boolean): Uint8Array;
|
|
99
|
+
export interface Aerox3WirelessBattery {
|
|
100
|
+
/** 0 to 100 in steps of 5. */
|
|
101
|
+
level: number;
|
|
102
|
+
isCharging: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** `data[1]` holds the charging flag in its top bit and a 1-based level in steps of 5 below it. */
|
|
105
|
+
export declare function steelseriesAerox3WirelessDecodeBattery(payload: Uint8Array): Aerox3WirelessBattery;
|
|
106
|
+
/** `buttons_mapping.buttons` from `aerox3_wireless_wired.py`. */
|
|
107
|
+
export declare const AEROX3_WIRELESS_BUTTONS: {
|
|
108
|
+
readonly button1: {
|
|
109
|
+
readonly id: 1;
|
|
110
|
+
readonly offset: 0;
|
|
111
|
+
};
|
|
112
|
+
readonly button2: {
|
|
113
|
+
readonly id: 2;
|
|
114
|
+
readonly offset: 5;
|
|
115
|
+
};
|
|
116
|
+
readonly button3: {
|
|
117
|
+
readonly id: 3;
|
|
118
|
+
readonly offset: 10;
|
|
119
|
+
};
|
|
120
|
+
readonly button4: {
|
|
121
|
+
readonly id: 4;
|
|
122
|
+
readonly offset: 15;
|
|
123
|
+
};
|
|
124
|
+
readonly button5: {
|
|
125
|
+
readonly id: 5;
|
|
126
|
+
readonly offset: 20;
|
|
127
|
+
};
|
|
128
|
+
readonly button6: {
|
|
129
|
+
readonly id: 6;
|
|
130
|
+
readonly offset: 25;
|
|
131
|
+
};
|
|
132
|
+
readonly scrollUp: {
|
|
133
|
+
readonly id: 49;
|
|
134
|
+
readonly offset: 30;
|
|
135
|
+
};
|
|
136
|
+
readonly scrollDown: {
|
|
137
|
+
readonly id: 50;
|
|
138
|
+
readonly offset: 35;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export type Aerox3WirelessButtonName = keyof typeof AEROX3_WIRELESS_BUTTONS;
|
|
142
|
+
/**
|
|
143
|
+
* a button's target. any physical button, scroll included, is a valid target:
|
|
144
|
+
* rivalcfg resolves `scrollup` through the buttons table, which is how its
|
|
145
|
+
* default profile keeps the wheel working.
|
|
146
|
+
*/
|
|
147
|
+
export type Aerox3WirelessButtonAction = {
|
|
148
|
+
type: "button";
|
|
149
|
+
target: Aerox3WirelessButtonName;
|
|
150
|
+
} | {
|
|
151
|
+
type: "disabled";
|
|
152
|
+
} | {
|
|
153
|
+
type: "dpiSwitch";
|
|
154
|
+
} | {
|
|
155
|
+
type: "keyboard";
|
|
156
|
+
code: number;
|
|
157
|
+
} | {
|
|
158
|
+
type: "multimedia";
|
|
159
|
+
code: number;
|
|
160
|
+
};
|
|
161
|
+
/** rivalcfg's default mapping, button 6 being the dpi cycle button behind the wheel. */
|
|
162
|
+
export declare const AEROX3_WIRELESS_DEFAULT_BUTTONS: Readonly<Record<Aerox3WirelessButtonName, Aerox3WirelessButtonAction>>;
|
|
163
|
+
/** rivalcfg `layout_multimedia.py`, the low byte of each consumer usage. */
|
|
164
|
+
export declare const AEROX3_WIRELESS_MULTIMEDIA_KEYS: {
|
|
165
|
+
readonly mute: 226;
|
|
166
|
+
readonly next: 181;
|
|
167
|
+
readonly playPause: 205;
|
|
168
|
+
readonly previous: 182;
|
|
169
|
+
readonly volumeUp: 233;
|
|
170
|
+
readonly volumeDown: 234;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* `2A` followed by a 40-byte packet, 5 bytes per button. like rivalcfg, any
|
|
174
|
+
* button missing from `mapping` gets its default action, so remapping one
|
|
175
|
+
* button never disables the others.
|
|
176
|
+
*/
|
|
177
|
+
export declare function steelseriesAerox3WirelessEncodeButtonsMapping(mapping: Partial<Record<Aerox3WirelessButtonName, Aerox3WirelessButtonAction>>, wireless: boolean): Uint8Array;
|
|
178
|
+
//# sourceMappingURL=aerox3-wireless.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aerox3-wireless.d.ts","sourceRoot":"","sources":["../../src/steelseries/aerox3-wireless.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,eAAO,MAAM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