@openmouse/protocol 0.48.1 → 0.50.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 (96) hide show
  1. package/README.md +1 -0
  2. package/dist/drivers/atk/hid.d.ts.map +1 -1
  3. package/dist/drivers/atk/hid.js +2 -2
  4. package/dist/drivers/atk/hid.js.map +1 -1
  5. package/dist/drivers/atk/products.d.ts +7 -0
  6. package/dist/drivers/atk/products.d.ts.map +1 -1
  7. package/dist/drivers/atk/products.js +19 -2
  8. package/dist/drivers/atk/products.js.map +1 -1
  9. package/dist/drivers/glorious/sinowealth-hid.d.ts +71 -0
  10. package/dist/drivers/glorious/sinowealth-hid.d.ts.map +1 -0
  11. package/dist/drivers/glorious/sinowealth-hid.js +388 -0
  12. package/dist/drivers/glorious/sinowealth-hid.js.map +1 -0
  13. package/dist/drivers/gwolves/products.d.ts +5 -0
  14. package/dist/drivers/gwolves/products.d.ts.map +1 -1
  15. package/dist/drivers/gwolves/products.js +14 -10
  16. package/dist/drivers/gwolves/products.js.map +1 -1
  17. package/dist/drivers/gwolves/xvi-hid.d.ts +1 -0
  18. package/dist/drivers/gwolves/xvi-hid.d.ts.map +1 -1
  19. package/dist/drivers/gwolves/xvi-hid.js +14 -7
  20. package/dist/drivers/gwolves/xvi-hid.js.map +1 -1
  21. package/dist/drivers/hitscan/xvi-hid.d.ts +110 -0
  22. package/dist/drivers/hitscan/xvi-hid.d.ts.map +1 -0
  23. package/dist/drivers/hitscan/xvi-hid.js +803 -0
  24. package/dist/drivers/hitscan/xvi-hid.js.map +1 -0
  25. package/dist/drivers/motospeed/hid.js +1 -1
  26. package/dist/drivers/motospeed/hid.js.map +1 -1
  27. package/dist/drivers/mouse-types.d.ts +16 -0
  28. package/dist/drivers/mouse-types.d.ts.map +1 -1
  29. package/dist/drivers/razer/hid.d.ts +0 -1
  30. package/dist/drivers/razer/hid.d.ts.map +1 -1
  31. package/dist/drivers/razer/hid.js +14 -9
  32. package/dist/drivers/razer/hid.js.map +1 -1
  33. package/dist/drivers/redragon/hid.d.ts +44 -63
  34. package/dist/drivers/redragon/hid.d.ts.map +1 -1
  35. package/dist/drivers/redragon/hid.js +207 -270
  36. package/dist/drivers/redragon/hid.js.map +1 -1
  37. package/dist/drivers/registry.d.ts +2 -1
  38. package/dist/drivers/registry.d.ts.map +1 -1
  39. package/dist/drivers/registry.js +10 -1
  40. package/dist/drivers/registry.js.map +1 -1
  41. package/dist/drivers/vendors.d.ts +8 -1
  42. package/dist/drivers/vendors.d.ts.map +1 -1
  43. package/dist/drivers/vendors.js +18 -4
  44. package/dist/drivers/vendors.js.map +1 -1
  45. package/dist/gearhub/index.d.ts +8 -0
  46. package/dist/gearhub/index.d.ts.map +1 -1
  47. package/dist/gearhub/index.js +18 -0
  48. package/dist/gearhub/index.js.map +1 -1
  49. package/dist/glorious-sinowealth/index.d.ts +165 -0
  50. package/dist/glorious-sinowealth/index.d.ts.map +1 -0
  51. package/dist/glorious-sinowealth/index.js +345 -0
  52. package/dist/glorious-sinowealth/index.js.map +1 -0
  53. package/dist/hitscan/index.d.ts +2 -0
  54. package/dist/hitscan/index.d.ts.map +1 -1
  55. package/dist/hitscan/index.js +2 -0
  56. package/dist/hitscan/index.js.map +1 -1
  57. package/dist/hitscan/xvi-inputs.d.ts +81 -0
  58. package/dist/hitscan/xvi-inputs.d.ts.map +1 -0
  59. package/dist/hitscan/xvi-inputs.js +393 -0
  60. package/dist/hitscan/xvi-inputs.js.map +1 -0
  61. package/dist/hitscan/xvi.d.ts +278 -0
  62. package/dist/hitscan/xvi.d.ts.map +1 -0
  63. package/dist/hitscan/xvi.js +773 -0
  64. package/dist/hitscan/xvi.js.map +1 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +1 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/keychron/index.d.ts.map +1 -1
  70. package/dist/keychron/index.js +4 -0
  71. package/dist/keychron/index.js.map +1 -1
  72. package/dist/razer/codec.d.ts +3 -2
  73. package/dist/razer/codec.d.ts.map +1 -1
  74. package/dist/razer/codec.js +5 -4
  75. package/dist/razer/codec.js.map +1 -1
  76. package/dist/redragon/deprecated.d.ts +24 -0
  77. package/dist/redragon/deprecated.d.ts.map +1 -0
  78. package/dist/redragon/deprecated.js +54 -0
  79. package/dist/redragon/deprecated.js.map +1 -0
  80. package/dist/redragon/holtek.d.ts +127 -0
  81. package/dist/redragon/holtek.d.ts.map +1 -0
  82. package/dist/redragon/holtek.js +232 -0
  83. package/dist/redragon/holtek.js.map +1 -0
  84. package/dist/redragon/index.d.ts +9 -203
  85. package/dist/redragon/index.d.ts.map +1 -1
  86. package/dist/redragon/index.js +11 -430
  87. package/dist/redragon/index.js.map +1 -1
  88. package/dist/redragon/m612.d.ts +82 -0
  89. package/dist/redragon/m612.d.ts.map +1 -0
  90. package/dist/redragon/m612.js +166 -0
  91. package/dist/redragon/m612.js.map +1 -0
  92. package/dist/redragon/m724.d.ts +47 -0
  93. package/dist/redragon/m724.d.ts.map +1 -0
  94. package/dist/redragon/m724.js +107 -0
  95. package/dist/redragon/m724.js.map +1 -0
  96. package/package.json +5 -1
@@ -1,23 +1,5 @@
1
- import { KEY_USAGES, SHORTCUTS, keyName } from "./keys.js";
2
- export const REDRAGON_VENDOR_ID = 0x04d9; // Holtek Semiconductor
3
- export const REDRAGON_CONFIG_USAGE_PAGE = 0xffa0;
4
- export const REDRAGON_CONFIG_USAGE = 0x01;
5
- export const REDRAGON_REPORT_ID = 2;
6
- export const REDRAGON_REPORT_SIZE = 16;
7
- /** First payload byte of a config write (report id excluded). */
8
- export const REDRAGON_CMD_WRITE = 0xf3;
9
- /** Vendor hello, sent once per RDCfg session before any write. */
10
- export const REDRAGON_CMD_HELLO = 0xf5;
11
- /** Write section carrying the per-profile DPI table. */
12
- export const REDRAGON_DPI_SECTION = 0x05;
13
- /** Profile index byte for profile 1 (the only profile decoded so far). */
14
- export const REDRAGON_PROFILE0 = 0x00;
15
- /**
16
- * DPI-table subcommands for profile 1, levels 1-5. Other profiles use
17
- * different bases (0x04, 0xb4, 0x64, 0x14 + 6 per level); only profile 1 is
18
- * captured well enough to send.
19
- */
20
- export const REDRAGON_PROFILE0_DPI_SUBCMDS = [0x44, 0x4a, 0x50, 0x56, 0x5c];
1
+ import { REDRAGON_M612_MODEL } from "./m612.js";
2
+ import { REDRAGON_M724_MODEL } from "./m724.js";
21
3
  export const REDRAGON_PRODUCTS = new Map([
22
4
  [0xfc7a, {
23
5
  model: "M724",
@@ -37,415 +19,14 @@ export const REDRAGON_PRODUCTS = new Map([
37
19
  }],
38
20
  ]);
39
21
  export const REDRAGON_PRODUCT_IDS = [...REDRAGON_PRODUCTS.keys()];
40
- /**
41
- * Wire encoding of one DPI axis, derived from a usbmon capture of RDCfg
42
- * pushing the table and one live 800 -> 1200 DPI edit (see
43
- * docs/redragon-m724-testing.md):
44
- *
45
- * code = round(dpi * 9 / 400) (800->18, 1200->27, 2400->54,
46
- * 3500->79, 5500->124)
47
- * code > 255 wraps to a second range: flag = 1, code = round(code / 2)
48
- * (12400->279->140)
49
- */
50
- export function redragonEncodeDpiValue(dpi) {
51
- if (!Number.isInteger(dpi) || dpi < 50 || dpi > 12400) {
52
- throw new Error(`Redragon DPI ${dpi} is outside the observed 50-12400 range.`);
53
- }
54
- let code = Math.round((dpi * 9) / 400);
55
- if (code <= 255)
56
- return { value: code, range: 0 };
57
- return { value: Math.round(code / 2), range: 1 };
58
- }
59
- /** Nominal DPI for a wire (value, range) pair. Quantization error is normal. */
60
- export function redragonDecodeDpiValue(value, range) {
61
- return Math.round(value * (range === 1 ? 2 : 1) * (400 / 9));
62
- }
63
- /**
64
- * Encodes one DPI-table write as the full 16-byte feature frame, report id
65
- * included, byte-for-byte as RDCfg sends it:
66
- *
67
- * [02 F3 sub profile 05 00 00 00 01 x range y range 00 00 00]
68
- *
69
- * X and Y carry the same value; the vendor app keeps the axes linked.
70
- */
71
- export function redragonEncodeDpiSlot(profile, level, dpiX, dpiY = dpiX) {
72
- if (profile !== REDRAGON_PROFILE0) {
73
- throw new Error(`Redragon profile ${profile} subcommands are not decoded yet (only profile 1).`);
74
- }
75
- if (!Number.isInteger(level) || level < 0 || level >= REDRAGON_PROFILE0_DPI_SUBCMDS.length) {
76
- throw new Error(`Redragon DPI level ${level} is out of range 0-4.`);
77
- }
78
- const x = redragonEncodeDpiValue(dpiX);
79
- const y = redragonEncodeDpiValue(dpiY);
80
- const frame = new Uint8Array(REDRAGON_REPORT_SIZE);
81
- frame[0] = REDRAGON_REPORT_ID;
82
- frame[1] = REDRAGON_CMD_WRITE;
83
- frame[2] = REDRAGON_PROFILE0_DPI_SUBCMDS[level];
84
- frame[3] = profile;
85
- frame[4] = REDRAGON_DPI_SECTION;
86
- frame[8] = 0x01;
87
- frame[9] = x.value;
88
- frame[10] = x.range;
89
- frame[11] = y.value;
90
- frame[12] = y.range;
91
- return frame;
92
- }
93
- /** First payload byte of a commit write (report id excluded). */
94
- export const REDRAGON_CMD_COMMIT = 0xf1;
95
- /** Write section carrying the polling rate. */
96
- export const REDRAGON_POLL_SECTION = 0x06;
97
- /** Polling-rate subcommand. */
98
- export const REDRAGON_POLL_SUB = 0x32;
99
- /** Polling rates observed on the wire. */
100
- export const REDRAGON_POLLING_RATES = [125, 250, 500, 1000];
101
- /** Wire code per polling rate: rate = 1000 / code (bisected live). */
102
- export const REDRAGON_POLLING_CODES = {
103
- 1000: 0x01,
104
- 500: 0x02,
105
- 250: 0x04,
106
- 125: 0x08,
107
- };
108
- /** Write section of the commit block (meaning of the codes is unknown). */
109
- export const REDRAGON_COMMIT_SECTION = 0x02;
110
- /**
111
- * Commit codes closing every vendor session, in order. Bisected live on
112
- * hardware: without them a DPI write is stored but only takes effect at
113
- * boot; with them it applies instantly. Per-code semantics unknown.
114
- */
115
- export const REDRAGON_COMMIT_CODES = [0x04, 0x01, 0x02, 0x08, 0x10];
116
- /** Vendor hello frame, sent once after connect before the first write. */
117
- export function redragonHello() {
118
- return redragonSession(true);
119
- }
120
- /**
121
- * Session bracket frames. Every RDCfg session opens with `[02 F5 00 ...]`
122
- * and closes with `[02 F5 01 ...]`; a session left open hangs the mouse
123
- * interface until replug, so every write must be followed by the close.
124
- */
125
- export function redragonSession(begin) {
126
- const frame = new Uint8Array(REDRAGON_REPORT_SIZE);
127
- frame[0] = REDRAGON_REPORT_ID;
128
- frame[1] = REDRAGON_CMD_HELLO;
129
- frame[2] = begin ? 0x00 : 0x01;
130
- return frame;
131
- }
132
- /** One commit-block write (full frame, report id included). */
133
- export function redragonEncodeCommit(code) {
134
- const frame = new Uint8Array(REDRAGON_REPORT_SIZE);
135
- frame[0] = REDRAGON_REPORT_ID;
136
- frame[1] = REDRAGON_CMD_COMMIT;
137
- frame[2] = REDRAGON_COMMIT_SECTION;
138
- frame[3] = code;
139
- return frame;
140
- }
141
- /**
142
- * Polling-rate write (full frame, report id included), byte-for-byte as
143
- * RDCfg sends it: `[02 F3 32 00 06 00 00 00 RR 00 01 00 01 00 00 00]`
144
- * with `RR = 1000 / Hz` (captured across 4 sessions and bisected live:
145
- * 1000->0x01, 500->0x02, 250->0x04, 125->0x08).
146
- */
147
- export function redragonEncodePollingRate(hz) {
148
- const code = REDRAGON_POLLING_CODES[hz];
149
- if (code === undefined) {
150
- throw new Error(`Redragon polling rate ${hz} Hz was never observed; supported: ${REDRAGON_POLLING_RATES.join(", ")}.`);
151
- }
152
- const frame = new Uint8Array(REDRAGON_REPORT_SIZE);
153
- frame[0] = REDRAGON_REPORT_ID;
154
- frame[1] = REDRAGON_CMD_WRITE;
155
- frame[2] = REDRAGON_POLL_SUB;
156
- frame[3] = REDRAGON_PROFILE0;
157
- frame[4] = REDRAGON_POLL_SECTION;
158
- frame[8] = code;
159
- frame[10] = 0x01;
160
- frame[12] = 0x01;
161
- return frame;
162
- }
163
- /*
164
- * Predator M612 (`04d9:fc61`), captured with usbmon while RDCfg 1.0.58 ran
165
- * under Wine, then probed with hidraw (see docs/redragon-m612-testing.md).
166
- *
167
- * The M612 shares the M724 transport (feature report 2, `F5` bracket, `F1`
168
- * commit block) but its bytes are best read as a flat settings memory:
169
- * `[02 F3 addrLo addrHi len 00 00 00 data...]` writes `len` bytes at
170
- * `addr`. Unlike the M724, it also answers reads: `[02 F2 addrLo addrHi len]`
171
- * followed by a GET_FEATURE returns `[02 08 addrLo 32+addrHi len 00 FA FA
172
- * data...]`, at most 8 data bytes per read.
173
- */
174
- export const REDRAGON_M612_PRODUCT_ID = 0xfc61;
175
- /** First payload byte of a settings read (report id excluded). */
176
- export const REDRAGON_CMD_READ = 0xf2;
177
- /** First payload byte of every GET_FEATURE answer (report id excluded). */
178
- export const REDRAGON_REPLY_TAG = 0x08;
179
- /** Length of the answer header before the data bytes (report id excluded). */
180
- export const REDRAGON_REPLY_HEADER = 7;
181
- /** Most data bytes one read or write frame carries. */
182
- export const REDRAGON_MAX_TRANSFER = 8;
183
- /** Active onboard profile, 0-4. */
184
- export const REDRAGON_M612_ACTIVE_PROFILE_ADDRESS = 0x002c;
185
- /** Polling block: `[1000 / Hz, 00, 02, 00, 02, 00]` (last four constant). */
186
- export const REDRAGON_M612_POLL_ADDRESS = 0x0032;
187
- export const REDRAGON_M612_POLL_LENGTH = 6;
188
- /**
189
- * Per-profile block bases. `base + 0` is the active DPI stage (0-4, moved
190
- * by the DPI button); stage slot `n` is the 5 bytes at `base + 2 + 6n`:
191
- * `[enabled, x, xRange, y, yRange]`.
192
- */
193
- export const REDRAGON_M612_PROFILE_BASES = [0x0042, 0x0102, 0x01b2, 0x0262, 0x0312];
194
- export const REDRAGON_M612_STAGE_COUNT = 5;
195
- export const REDRAGON_M612_SLOT_LENGTH = 5;
196
- /**
197
- * DPI labels RDCfg shows for each position of its DPI slider, read from the
198
- * running vendor app and cross-checked by matching its bitmap-font glyphs.
199
- * Position `p` 0-92 writes `value = 14 + p, range 0`; 93-145 write
200
- * `value = p - 39, range 1` (range 1 doubles the step). The rule was
201
- * confirmed by Apply captures at positions 0-6, 93, 94, 120, 144, and 145,
202
- * and by the factory push (13, 39, 65, 92). The labels are the vendor's
203
- * rounded values, so they are the DPI OpenMouse shows for the same bytes.
204
- */
205
- export const REDRAGON_M612_DPI_LABELS = [
206
- 500, 570, 600, 640, 680, 700, 760, 800,
207
- 830, 870, 900, 950, 980, 1000, 1060, 1100,
208
- 1140, 1170, 1200, 1250, 1300, 1330, 1360, 1400,
209
- 1440, 1480, 1500, 1550, 1600, 1630, 1670, 1700,
210
- 1740, 1780, 1800, 1860, 1900, 1930, 1970, 2000,
211
- 2050, 2090, 2100, 2160, 2200, 2240, 2280, 2300,
212
- 2350, 2400, 2430, 2470, 2500, 2540, 2580, 2600,
213
- 2660, 2700, 2730, 2770, 2800, 2850, 2880, 2900,
214
- 2960, 3000, 3040, 3070, 3100, 3150, 3200, 3230,
215
- 3260, 3300, 3340, 3380, 3400, 3450, 3500, 3530,
216
- 3570, 3600, 3640, 3680, 3700, 3760, 3800, 3830,
217
- 3870, 3900, 3950, 3990, 4000, 4100, 4180, 4250,
218
- 4330, 4400, 4480, 4560, 4630, 4700, 4780, 4860,
219
- 4940, 5000, 5100, 5160, 5240, 5300, 5400, 5470,
220
- 5540, 5600, 5700, 5770, 5850, 5900, 6000, 6080,
221
- 6150, 6230, 6300, 6380, 6460, 6530, 6600, 6680,
222
- 6760, 6840, 6900, 7000, 7060, 7140, 7200, 7300,
223
- 7370, 7440, 7500, 7600, 7670, 7750, 7800, 7900,
224
- 7980, 8000,
225
- ];
226
- /** Slider position where RDCfg switches to range 1. */
227
- const M612_RANGE1_FIRST_POSITION = 93;
228
- /** Wire code for one RDCfg slider position. */
229
- export function redragonM612DpiCodeAt(position) {
230
- if (!Number.isInteger(position) || position < 0 || position >= REDRAGON_M612_DPI_LABELS.length) {
231
- throw new Error(`Redragon M612 DPI position ${position} is outside 0-${REDRAGON_M612_DPI_LABELS.length - 1}.`);
232
- }
233
- return position < M612_RANGE1_FIRST_POSITION
234
- ? { value: 14 + position, range: 0 }
235
- : { value: position - 39, range: 1 };
236
- }
237
- /**
238
- * Snaps a requested DPI to the nearest RDCfg slider label (ties go to the
239
- * lower one) and returns that label with its wire code.
240
- */
241
- export function redragonM612EncodeDpi(dpi) {
242
- const labels = REDRAGON_M612_DPI_LABELS;
243
- if (!Number.isInteger(dpi) || dpi < labels[0] || dpi > labels[labels.length - 1]) {
244
- throw new Error(`Redragon M612 DPI ${dpi} is outside ${labels[0]}-${labels[labels.length - 1]}.`);
245
- }
246
- let best = 0;
247
- for (let position = 1; position < labels.length; position++) {
248
- if (Math.abs(labels[position] - dpi) < Math.abs(labels[best] - dpi))
249
- best = position;
250
- }
251
- return { dpi: labels[best], ...redragonM612DpiCodeAt(best) };
252
- }
253
- /**
254
- * DPI for a wire code. Codes RDCfg can write map to its label; anything else
255
- * (another tool's write) falls back to the linear sensor scale the labels
256
- * approximate, 4000 DPI per 106 counts, rounded to 10.
257
- */
258
- export function redragonM612DecodeDpi(value, range) {
259
- const position = range === 0 ? value - 14 : range === 1 ? value + 39 : -1;
260
- const inRange = range === 0 ? position < M612_RANGE1_FIRST_POSITION : position >= M612_RANGE1_FIRST_POSITION;
261
- if (inRange && position >= 0 && position < REDRAGON_M612_DPI_LABELS.length) {
262
- return REDRAGON_M612_DPI_LABELS[position];
263
- }
264
- return Math.round((value * (range === 1 ? 2 : 1) * 4000) / 106 / 10) * 10;
265
- }
266
- function checkTransfer(address, length) {
267
- if (!Number.isInteger(address) || address < 0 || address > 0xffff) {
268
- throw new Error(`Redragon address ${address} is outside 0x0000-0xffff.`);
269
- }
270
- if (!Number.isInteger(length) || length < 1 || length > REDRAGON_MAX_TRANSFER) {
271
- throw new Error(`Redragon transfer length ${length} is outside 1-${REDRAGON_MAX_TRANSFER}.`);
272
- }
273
- }
274
- /** `[02 F3 addrLo addrHi len 00 00 00 data...]` (full frame, report id included). */
275
- export function redragonEncodeWrite(address, data) {
276
- checkTransfer(address, data.length);
277
- const frame = new Uint8Array(REDRAGON_REPORT_SIZE);
278
- frame[0] = REDRAGON_REPORT_ID;
279
- frame[1] = REDRAGON_CMD_WRITE;
280
- frame[2] = address & 0xff;
281
- frame[3] = address >> 8;
282
- frame[4] = data.length;
283
- for (let index = 0; index < data.length; index++) {
284
- const byte = data[index];
285
- if (!Number.isInteger(byte) || byte < 0 || byte > 0xff)
286
- throw new Error(`Redragon data byte ${byte} is not a byte.`);
287
- frame[8 + index] = byte;
288
- }
289
- return frame;
290
- }
291
- /** `[02 F2 addrLo addrHi len ...]` (full frame, report id included). */
292
- export function redragonEncodeRead(address, length) {
293
- checkTransfer(address, length);
294
- const frame = new Uint8Array(REDRAGON_REPORT_SIZE);
295
- frame[0] = REDRAGON_REPORT_ID;
296
- frame[1] = REDRAGON_CMD_READ;
297
- frame[2] = address & 0xff;
298
- frame[3] = address >> 8;
299
- frame[4] = length;
300
- return frame;
301
- }
302
- /**
303
- * Validates the GET_FEATURE answer to `redragonEncodeRead(address, length)`
304
- * and returns its data bytes. Accepts the answer with or without the leading
305
- * report id, since WebHID and hidraw differ there.
306
- */
307
- export function redragonDecodeRead(answer, address, length) {
308
- checkTransfer(address, length);
309
- const body = answer[0] === REDRAGON_REPORT_ID && answer[1] === REDRAGON_REPLY_TAG ? answer.subarray(1) : answer;
310
- const hex = [...answer].map((byte) => byte.toString(16).padStart(2, "0")).join(" ");
311
- if (body.length < REDRAGON_REPLY_HEADER + length ||
312
- body[0] !== REDRAGON_REPLY_TAG ||
313
- body[1] !== (address & 0xff) ||
314
- body[2] !== 0x32 + (address >> 8) ||
315
- body[3] !== length ||
316
- body[5] !== 0xfa ||
317
- body[6] !== 0xfa) {
318
- throw new Error(`Redragon read of ${length} bytes at 0x${address.toString(16).padStart(4, "0")} got an unexpected answer: ${hex}.`);
319
- }
320
- return body.slice(REDRAGON_REPLY_HEADER, REDRAGON_REPLY_HEADER + length);
321
- }
322
- /** Address of one M612 DPI stage slot. */
323
- export function redragonM612SlotAddress(profile, stage) {
324
- const base = REDRAGON_M612_PROFILE_BASES[profile];
325
- if (base === undefined)
326
- throw new Error(`Redragon M612 profile ${profile} is outside 0-4.`);
327
- if (!Number.isInteger(stage) || stage < 0 || stage >= REDRAGON_M612_STAGE_COUNT) {
328
- throw new Error(`Redragon M612 DPI stage ${stage} is outside 0-4.`);
329
- }
330
- return base + 2 + 6 * stage;
331
- }
332
- /*
333
- * M612 profiles, lighting, and buttons: decoded from RDCfg 1.0.58 Apply
334
- * captures (see docs/redragon-m612-testing.md).
335
- */
336
- export const REDRAGON_M612_PROFILE_COUNT = 5;
337
- /**
338
- * RDCfg's MODE select, byte-for-byte: write `[profile, 00]` at `0x2c`
339
- * (outside any `F5` bracket), then `F1 02 01`, then the commit block.
340
- */
341
- export const REDRAGON_M612_PROFILE_SELECT_CODE = 0x01;
342
- /** Lighting effect selector: one bit per effect, `[bit, 00]`. Global, not per profile. */
343
- export const REDRAGON_M612_LIGHTING_EFFECT_ADDRESS = 0x0446;
344
- /** RDCfg effects, from Apply captures of each one. */
345
- export const REDRAGON_M612_EFFECTS = [
346
- { effect: "wave", bit: 0x01, block: 0x0448, color: false, speed: true },
347
- { effect: "spectrumBreathing", bit: 0x02, block: 0x0450, color: false, speed: true },
348
- { effect: "breathing", bit: 0x04, block: 0x0458, color: true, speed: true },
349
- { effect: "flash", bit: 0x08, block: 0x0460, color: true, speed: true },
350
- { effect: "static", bit: 0x10, block: 0x0468, color: true, speed: false },
351
- { effect: "off", bit: 0x20, block: null, color: false, speed: false },
352
- ];
353
- export const REDRAGON_M612_LIGHTING_BLOCK_LENGTH = 8;
354
- /** Speed byte: 8 is RDCfg's slowest slider position, 1 its fastest. */
355
- export const REDRAGON_M612_LIGHTING_SPEEDS = 8;
356
- /** Brightness byte: RDCfg's slider has three positions, 1-3. */
357
- export const REDRAGON_M612_LIGHTING_BRIGHTNESS_LEVELS = 3;
358
- export function redragonM612EffectForBit(bit) {
359
- return REDRAGON_M612_EFFECTS.find((info) => info.bit === bit);
360
- }
361
- /**
362
- * Button slots per profile, in RDCfg's numbering: 1 left, 2 right,
363
- * 3 middle, 4 rapid fire, 5-6 side, 7-8 DPI, 9 LED, then wheel up/down.
364
- * Four bytes each; there is no slot at `base + 0x24`.
365
- */
366
- export const REDRAGON_M612_BUTTON_BASES = [0x0082, 0x0142, 0x01f2, 0x02a2, 0x0352];
367
- export const REDRAGON_M612_BUTTON_OFFSETS = [0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, 0x20, 0x28, 0x2c];
368
- export const REDRAGON_M612_BUTTON_LENGTH = 4;
369
- export function redragonM612ButtonAddress(profile, slot) {
370
- const base = REDRAGON_M612_BUTTON_BASES[profile];
371
- const offset = REDRAGON_M612_BUTTON_OFFSETS[slot];
372
- if (base === undefined)
373
- throw new Error(`Redragon M612 profile ${profile} is outside 0-4.`);
374
- if (offset === undefined)
375
- throw new Error(`Redragon M612 button slot ${slot} is outside 0-10.`);
376
- return base + offset;
377
- }
378
- /**
379
- * Single-byte actions captured from RDCfg (the value is padded to four bytes
380
- * with zeros). "Rapid fire" is button 4's factory value; its speed and count
381
- * bytes are kept exactly as shipped.
382
- */
383
- export const REDRAGON_M612_BUTTON_ACTIONS = [
384
- ["Left click", [0x81]],
385
- ["Right click", [0x82]],
386
- ["Middle click", [0x83]],
387
- ["Back", [0x84]],
388
- ["Forward", [0x85]],
389
- ["Scroll up", [0x8b]],
390
- ["Scroll down", [0x8c]],
391
- ["Rapid fire", [0x99, 0x81, 0x03]],
392
- ["DPI cycle", [0x88]],
393
- ["DPI up", [0x8a]],
394
- ["DPI down", [0x89]],
395
- ["Profile cycle", [0x8d]],
396
- ["Profile up", [0x94]],
397
- ["Profile down", [0x95]],
398
- ["Polling rate up", [0x97]],
399
- ["Polling rate down", [0x98]],
400
- ["Lighting effect cycle", [0x9b, 0x08]],
401
- ["Disabled", []],
402
- ];
403
- /**
404
- * Keyboard assignments are `[8F, modifiers, usage]` with the HID keyboard
405
- * modifier bits (1 Ctrl, 2 Shift, 4 Alt, 8 Win) and usage IDs. Captured from
406
- * RDCfg's shortcut menus: Ctrl+V `8f 01 19`, Ctrl+A `8f 01 04`, Ctrl+F
407
- * `8f 01 09`, Ctrl+N `8f 01 11`, Alt+Tab `8f 04 2b`, Alt+F4 `8f 04 3d`,
408
- * Win+E `8f 08 08`, Win+R `8f 08 15`, Win+D `8f 08 07`, Win+L `8f 08 0f`.
409
- */
410
- export const REDRAGON_M612_KEY_ACTION = 0x8f;
411
- /** Every action name `redragonM612EncodeButtonAction` accepts, in display order. */
412
- export const REDRAGON_M612_BUTTON_OPTIONS = [
413
- ...REDRAGON_M612_BUTTON_ACTIONS.map(([name]) => name),
414
- ...SHORTCUTS.map(([name, modifiers, key]) => `${name} (${keyName(modifiers, KEY_USAGES.find(([k]) => k === key)[1])})`),
415
- ...KEY_USAGES.map(([name]) => `Key ${name}`),
416
- ];
417
- /** Four-byte slot value for an action name from `REDRAGON_M612_BUTTON_OPTIONS`. */
418
- export function redragonM612EncodeButtonAction(action) {
419
- const pad = (bytes) => [...bytes, 0, 0, 0, 0].slice(0, REDRAGON_M612_BUTTON_LENGTH);
420
- const fixed = REDRAGON_M612_BUTTON_ACTIONS.find(([name]) => name === action);
421
- if (fixed)
422
- return pad(fixed[1]);
423
- const shortcut = SHORTCUTS.find(([name, modifiers, key]) => action === `${name} (${keyName(modifiers, KEY_USAGES.find(([k]) => k === key)[1])})`);
424
- if (shortcut) {
425
- return pad([REDRAGON_M612_KEY_ACTION, shortcut[1], KEY_USAGES.find(([k]) => k === shortcut[2])[1]]);
426
- }
427
- const key = action.startsWith("Key ") ? KEY_USAGES.find(([name]) => name === action.slice(4)) : undefined;
428
- if (key)
429
- return pad([REDRAGON_M612_KEY_ACTION, 0x00, key[1]]);
430
- throw new Error(`Redragon M612 button action "${action}" is not offered.`);
431
- }
432
- /**
433
- * Names a slot value: an offered action where the bytes match one exactly,
434
- * any other keyboard combination by its keys, and anything else (macros,
435
- * RDCfg's advanced actions) as its raw bytes.
436
- */
437
- export function redragonM612DecodeButtonAction(value) {
438
- const bytes = Array.from(value).slice(0, REDRAGON_M612_BUTTON_LENGTH);
439
- const same = (encoded) => encoded.every((byte, index) => byte === (bytes[index] ?? 0));
440
- const named = REDRAGON_M612_BUTTON_OPTIONS.find((option) => same(redragonM612EncodeButtonAction(option)));
441
- if (named)
442
- return named;
443
- if (bytes[0] === REDRAGON_M612_KEY_ACTION && (bytes[3] ?? 0) === 0) {
444
- const combination = keyName(bytes[1] ?? 0, bytes[2] ?? 0);
445
- if (combination)
446
- return `Keys ${combination}`;
447
- }
448
- return `Vendor action (${bytes.map((byte) => byte.toString(16).padStart(2, "0")).join(" ")})`;
449
- }
22
+ /** Codec differences per Holtek PID. */
23
+ export const REDRAGON_MODELS = new Map([
24
+ [REDRAGON_M724_MODEL.productId, REDRAGON_M724_MODEL],
25
+ [REDRAGON_M612_MODEL.productId, REDRAGON_M612_MODEL],
26
+ ]);
27
+ export * from "./holtek.js";
28
+ export * from "./m612.js";
29
+ export * from "./m724.js";
30
+ export * from "./deprecated.js";
450
31
  export * from "./m690-pro.js";
451
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/redragon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAc3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,uBAAuB;AACjE,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,C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BAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAehD,MAAM,CAAC,MAAM,iBAAiB,GAAyC,IAAI,GAAG,CAAC;IAC7E,CAAC,MAAM,EAAE;YACP,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,KAAK;SACd,CAAC;IACF,CAAC,MAAM,EAAE;YACP,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,eAAe;YACrB,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,IAAI;SACb,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAsB,CAAC,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC;AAErF,wCAAwC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAuC,IAAI,GAAG,CAAC;IACzE,CAAC,mBAAmB,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACpD,CAAC,mBAAmB,CAAC,SAAS,EAAE,mBAAmB,CAAC;CACrD,CAAC,CAAC;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { redragonSlotAddress, type RedragonDpiCode, type RedragonModel } from "./holtek.js";
2
+ export declare const REDRAGON_M612_PRODUCT_ID = 64609;
3
+ export declare const REDRAGON_M612_ACTIVE_PROFILE_ADDRESS = 44;
4
+ /** Polling codes of profiles 1-3, as RDCfg writes them in one block. */
5
+ export declare const REDRAGON_M612_POLL_ADDRESS = 50;
6
+ export declare const REDRAGON_M612_POLL_LENGTH = 6;
7
+ export declare const REDRAGON_M612_PROFILE_BASES: readonly [66, 258, 434, 610, 786];
8
+ export declare const REDRAGON_M612_STAGE_COUNT = 5;
9
+ export declare const REDRAGON_M612_SLOT_LENGTH = 5;
10
+ export declare const REDRAGON_M612_PROFILE_COUNT = 5;
11
+ export declare const REDRAGON_M612_PROFILE_SELECT_CODE = 1;
12
+ export declare const REDRAGON_M612_BUTTON_BASES: readonly [130, 322, 498, 674, 850];
13
+ export declare const REDRAGON_M612_BUTTON_LENGTH = 4;
14
+ export declare const REDRAGON_M612_KEY_ACTION = 143;
15
+ /**
16
+ * DPI labels RDCfg shows for each position of its DPI slider, read from the
17
+ * running vendor app and cross-checked by matching its bitmap-font glyphs.
18
+ * Position `p` 0-92 writes `value = 14 + p, range 0`; 93-145 write
19
+ * `value = p - 39, range 1` (range 1 doubles the step). The rule was
20
+ * confirmed by Apply captures at positions 0-6, 93, 94, 120, 144, and 145,
21
+ * and by the factory push (13, 39, 65, 92). The labels are the vendor's
22
+ * rounded values, so they are the DPI OpenMouse shows for the same bytes.
23
+ */
24
+ export declare const REDRAGON_M612_DPI_LABELS: readonly number[];
25
+ /** Wire code for one RDCfg slider position. */
26
+ export declare function redragonM612DpiCodeAt(position: number): RedragonDpiCode;
27
+ /**
28
+ * Snaps a requested DPI to the nearest RDCfg slider label (ties go to the
29
+ * lower one) and returns that label with its wire code.
30
+ */
31
+ export declare function redragonM612EncodeDpi(dpi: number): RedragonDpiCode & {
32
+ dpi: number;
33
+ };
34
+ /**
35
+ * DPI for a wire code. Codes RDCfg can write map to its label; anything else
36
+ * (another tool's write) falls back to the linear sensor scale the labels
37
+ * approximate, 4000 DPI per 106 counts, rounded to 10.
38
+ */
39
+ export declare function redragonM612DecodeDpi(value: number, range: number): number;
40
+ /** Address of one M612 DPI stage slot. */
41
+ export declare const redragonM612SlotAddress: typeof redragonSlotAddress;
42
+ /** Lighting effect selector: one bit per effect, `[bit, 00]`. Global, not per profile. */
43
+ export declare const REDRAGON_M612_LIGHTING_EFFECT_ADDRESS = 1094;
44
+ export type RedragonM612Effect = "wave" | "spectrumBreathing" | "breathing" | "flash" | "static" | "off";
45
+ export interface RedragonM612EffectInfo {
46
+ effect: RedragonM612Effect;
47
+ /** Value at `0x446`. */
48
+ bit: number;
49
+ /** 8-byte parameter block `[flag, R, G, B, kind, speed, ?, brightness]`, or null for off. */
50
+ block: number | null;
51
+ color: boolean;
52
+ speed: boolean;
53
+ }
54
+ /** RDCfg effects, from Apply captures of each one. */
55
+ export declare const REDRAGON_M612_EFFECTS: readonly RedragonM612EffectInfo[];
56
+ export declare const REDRAGON_M612_LIGHTING_BLOCK_LENGTH = 8;
57
+ /** Speed byte: 8 is RDCfg's slowest slider position, 1 its fastest. */
58
+ export declare const REDRAGON_M612_LIGHTING_SPEEDS = 8;
59
+ /** Brightness byte: RDCfg's slider has three positions, 1-3. */
60
+ export declare const REDRAGON_M612_LIGHTING_BRIGHTNESS_LEVELS = 3;
61
+ export declare function redragonM612EffectForBit(bit: number): RedragonM612EffectInfo | undefined;
62
+ /**
63
+ * Button slots per profile, in RDCfg's numbering: 1 left, 2 right,
64
+ * 3 middle, 4 rapid fire, 5-6 side, 7-8 DPI, 9 LED, then wheel up/down.
65
+ * Four bytes each; there is no slot at `base + 0x24`.
66
+ */
67
+ export declare const REDRAGON_M612_BUTTON_OFFSETS: readonly [0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 44];
68
+ /** Address of one button slot in RDCfg's M612 numbering (slot 0-10). */
69
+ export declare function redragonM612ButtonAddress(profile: number, slot: number): number;
70
+ /**
71
+ * Single-byte actions captured from RDCfg (the value is padded to four bytes
72
+ * with zeros). "Rapid fire" is button 4's factory value; its speed and count
73
+ * bytes are kept exactly as shipped.
74
+ */
75
+ export declare const REDRAGON_M612_BUTTON_ACTIONS: ReadonlyArray<readonly [string, readonly number[]]>;
76
+ /** Every action name `redragonM612EncodeButtonAction` accepts, in display order. */
77
+ export declare const REDRAGON_M612_BUTTON_OPTIONS: readonly string[];
78
+ /** Four-byte slot value for an action name from `REDRAGON_M612_BUTTON_OPTIONS`. */
79
+ export declare const redragonM612EncodeButtonAction: (action: string) => number[];
80
+ export declare const redragonM612DecodeButtonAction: (value: ArrayLike<number>) => string;
81
+ export declare const REDRAGON_M612_MODEL: RedragonModel;
82
+ //# sourceMappingURL=m612.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"m612.d.ts","sourceRoot":"","sources":["../../src/redragon/m612.ts"],"names":[],"mappings":"AAOA,OAAO,EAaL,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,eAAO,MAAM,oCAAoC,KAAkC,CAAC;AACpF,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,KAAwB,CAAC;AAChE,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,2BAA2B,mCAAyB,CAAC;AAClE,eAAO,MAAM,yBAAyB,IAAuB,CAAC;AAC9D,eAAO,MAAM,yBAAyB,IAAuB,CAAC;AAC9D,eAAO,MAAM,2BAA2B,IAAyB,CAAC;AAClE,eAAO,MAAM,iCAAiC,IAA+B,CAAC;AAC9E,eAAO,MAAM,0BAA0B,oCAAwB,CAAC;AAChE,eAAO,MAAM,2BAA2B,IAAyB,CAAC;AAClE,eAAO,MAAM,wBAAwB,MAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAoBrD,CAAC;AAKF,+CAA+C;AAC/C,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAOvE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAGpF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,M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