@openmouse/protocol 0.8.0 → 0.10.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/atk/index.d.ts +29 -0
- package/dist/atk/index.d.ts.map +1 -1
- package/dist/atk/index.js +74 -0
- package/dist/atk/index.js.map +1 -1
- package/dist/drivers/atk/hid.d.ts +22 -0
- package/dist/drivers/atk/hid.d.ts.map +1 -1
- package/dist/drivers/atk/hid.js +90 -4
- package/dist/drivers/atk/hid.js.map +1 -1
- package/dist/drivers/atk/products.js +1 -1
- package/dist/drivers/atk/products.js.map +1 -1
- package/dist/drivers/mouse-types.d.ts +16 -0
- package/dist/drivers/mouse-types.d.ts.map +1 -1
- package/dist/drivers/registry.d.ts +2 -1
- package/dist/drivers/registry.d.ts.map +1 -1
- package/dist/drivers/registry.js +2 -0
- package/dist/drivers/registry.js.map +1 -1
- package/dist/drivers/vendors.d.ts +2 -2
- package/dist/drivers/vendors.d.ts.map +1 -1
- package/dist/drivers/vendors.js +5 -3
- package/dist/drivers/vendors.js.map +1 -1
- package/dist/drivers/wlmouse/beast-x-4k-hid.d.ts +45 -0
- package/dist/drivers/wlmouse/beast-x-4k-hid.d.ts.map +1 -0
- package/dist/drivers/wlmouse/beast-x-4k-hid.js +262 -0
- package/dist/drivers/wlmouse/beast-x-4k-hid.js.map +1 -0
- package/dist/drivers/wlmouse/hid.js +4 -4
- package/dist/drivers/wlmouse/hid.js.map +1 -1
- package/dist/logitech/index.d.ts +39 -1
- package/dist/logitech/index.d.ts.map +1 -1
- package/dist/logitech/index.js +63 -1
- package/dist/logitech/index.js.map +1 -1
- package/dist/wlmouse/beast-x-4k.d.ts +77 -0
- package/dist/wlmouse/beast-x-4k.d.ts.map +1 -0
- package/dist/wlmouse/beast-x-4k.js +110 -0
- package/dist/wlmouse/beast-x-4k.js.map +1 -0
- package/dist/wlmouse/index.d.ts +1 -0
- package/dist/wlmouse/index.d.ts.map +1 -1
- package/dist/wlmouse/index.js +1 -0
- package/dist/wlmouse/index.js.map +1 -1
- package/package.json +1 -1
package/dist/logitech/index.d.ts
CHANGED
|
@@ -56,11 +56,16 @@ export declare const BOLT_PAIRING_SLOTS: readonly [1, 2, 3, 4, 5, 6];
|
|
|
56
56
|
*
|
|
57
57
|
* G Pro X Superlight generation:
|
|
58
58
|
* - 0xc094 — G Pro X Superlight (wired)
|
|
59
|
+
* - 0xc09b — PRO X SUPERLIGHT 2 (USB)
|
|
60
|
+
* - 0xc0a0 — PRO X SUPERLIGHT 2 DEX (USB)
|
|
61
|
+
*
|
|
62
|
+
* G PRO 2 / next-gen G Pro family:
|
|
63
|
+
* - 0xc09a — G PRO 2 LIGHTSPEED (USB)
|
|
59
64
|
*
|
|
60
65
|
* This module deliberately imports nothing, so both the driver and the WebHID
|
|
61
66
|
* filters in ../vendors can read it without a cycle.
|
|
62
67
|
*/
|
|
63
|
-
export declare const LOGITECH_DIRECT_PRODUCT_IDS: readonly [49284, 49289, 49298, 49277, 49278, 49280, 49285, 49287, 49291, 49292, 49294, 49295, 49300, 49301, 49304, 49305];
|
|
68
|
+
export declare const LOGITECH_DIRECT_PRODUCT_IDS: readonly [49284, 49289, 49298, 49277, 49278, 49280, 49285, 49287, 49291, 49292, 49294, 49295, 49300, 49307, 49312, 49306, 49301, 49304, 49305];
|
|
64
69
|
/**
|
|
65
70
|
* Logi Bolt receivers. Unlike Lightspeed, device HID++ 2.0 rides long reports
|
|
66
71
|
* (report id 0x11) on usage `ff00:2`, and the mouse may sit on any pairing
|
|
@@ -69,6 +74,39 @@ export declare const LOGITECH_DIRECT_PRODUCT_IDS: readonly [49284, 49289, 49298,
|
|
|
69
74
|
* - 0xc548 — Logi Bolt USB receiver (MX Master 3S and other Bolt mice)
|
|
70
75
|
*/
|
|
71
76
|
export declare const LOGITECH_BOLT_PRODUCT_IDS: readonly [50504];
|
|
77
|
+
/**
|
|
78
|
+
* Named catalog of the Logitech mice the HID++ driver directly covers, keyed
|
|
79
|
+
* by product id. This is the named counterpart to the bare-PID registries above
|
|
80
|
+
* (`LOGITECH_DIRECT_PRODUCT_IDS` etc.) and exists for the same reason every
|
|
81
|
+
* other vendor registry carries names: the supported-devices page auto-lists
|
|
82
|
+
* from it, so a covered Logitech model can never go missing because someone
|
|
83
|
+
* forgot to hand-write a row.
|
|
84
|
+
*
|
|
85
|
+
* Only *direct-connect* models get a PID here. Wireless Logitech mice have no
|
|
86
|
+
* dedicated USB product id of their own — they answer behind a Lightspeed/Bolt
|
|
87
|
+
* receiver or over HID++, and the driver claims them by protocol on the
|
|
88
|
+
* receiver's single control interface, not by a per-mouse PID. Listing them in
|
|
89
|
+
* a PID-keyed map would be a lie; they are receiver-supported and the page
|
|
90
|
+
* carries them as static receiver rows with an honest note (see the wall of
|
|
91
|
+
* "receiver" notes in the supported-mice table). That asymmetry is structural
|
|
92
|
+
* Logitech, not a maintenance gap — the same way WLMouse's wireless rows stay
|
|
93
|
+
* receiver-curated.
|
|
94
|
+
*
|
|
95
|
+
* `status` is per-model and honest: everything in `LOGITECH_DIRECT_PRODUCT_IDS`
|
|
96
|
+
* is genuinely writable (DPI via 0x2202 where the model has it, report rate
|
|
97
|
+
* 0x8060, onboard profiles), so every entry here is `supported`. The auto-list
|
|
98
|
+
* loop must honor `status` rather than hardcoding it, so adding a not-yet-
|
|
99
|
+
* implemented model here later cannot silently over-claim.
|
|
100
|
+
*
|
|
101
|
+
* Names mirror the landing page's static rows exactly ("G502 (all variants)",
|
|
102
|
+
* "G Pro (2017)", "G703 (wired)"), because the registry loop dedupes against
|
|
103
|
+
* the table by exact normalized key before falling back to fuzzy matching.
|
|
104
|
+
*/
|
|
105
|
+
export declare const LOGITECH_PRODUCTS: ReadonlyMap<number, {
|
|
106
|
+
name: string;
|
|
107
|
+
wireless: boolean;
|
|
108
|
+
status: "supported";
|
|
109
|
+
}>;
|
|
72
110
|
export declare function isDirectConnectProduct(productId: number): boolean;
|
|
73
111
|
export declare function isBoltReceiverProduct(productId: number): boolean;
|
|
74
112
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logitech/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAM3B,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,IAAO,CAAC;AAC1C,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,MAAO,CAAC;AACxC,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,6BAAgD,CAAC;AAEhF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logitech/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAM3B,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,IAAO,CAAC;AAC1C,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,MAAO,CAAC;AACxC,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,6BAAgD,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO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AM,GAAG,kBAAkB,CAUjF;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;gBAE5B,eAAe,EAAE,MAAM,GAAG,IAAI;CAU3C"}
|
package/dist/logitech/index.js
CHANGED
|
@@ -61,6 +61,11 @@ export const BOLT_PAIRING_SLOTS = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06];
|
|
|
61
61
|
*
|
|
62
62
|
* G Pro X Superlight generation:
|
|
63
63
|
* - 0xc094 — G Pro X Superlight (wired)
|
|
64
|
+
* - 0xc09b — PRO X SUPERLIGHT 2 (USB)
|
|
65
|
+
* - 0xc0a0 — PRO X SUPERLIGHT 2 DEX (USB)
|
|
66
|
+
*
|
|
67
|
+
* G PRO 2 / next-gen G Pro family:
|
|
68
|
+
* - 0xc09a — G PRO 2 LIGHTSPEED (USB)
|
|
64
69
|
*
|
|
65
70
|
* This module deliberately imports nothing, so both the driver and the WebHID
|
|
66
71
|
* filters in ../vendors can read it without a cycle.
|
|
@@ -73,7 +78,9 @@ export const LOGITECH_DIRECT_PRODUCT_IDS = [
|
|
|
73
78
|
// G Pro / G502 / G403 HERO / G703 generation
|
|
74
79
|
0xc085, 0xc087, 0xc08b, 0xc08c, 0xc08e, 0xc08f,
|
|
75
80
|
// G Pro X Superlight generation
|
|
76
|
-
0xc094,
|
|
81
|
+
0xc094, 0xc09b, 0xc0a0,
|
|
82
|
+
// G PRO 2 / next-gen G Pro family
|
|
83
|
+
0xc09a,
|
|
77
84
|
// G502 X generation
|
|
78
85
|
0xc095, 0xc098, 0xc099,
|
|
79
86
|
];
|
|
@@ -85,6 +92,61 @@ export const LOGITECH_DIRECT_PRODUCT_IDS = [
|
|
|
85
92
|
* - 0xc548 — Logi Bolt USB receiver (MX Master 3S and other Bolt mice)
|
|
86
93
|
*/
|
|
87
94
|
export const LOGITECH_BOLT_PRODUCT_IDS = [0xc548];
|
|
95
|
+
/**
|
|
96
|
+
* Named catalog of the Logitech mice the HID++ driver directly covers, keyed
|
|
97
|
+
* by product id. This is the named counterpart to the bare-PID registries above
|
|
98
|
+
* (`LOGITECH_DIRECT_PRODUCT_IDS` etc.) and exists for the same reason every
|
|
99
|
+
* other vendor registry carries names: the supported-devices page auto-lists
|
|
100
|
+
* from it, so a covered Logitech model can never go missing because someone
|
|
101
|
+
* forgot to hand-write a row.
|
|
102
|
+
*
|
|
103
|
+
* Only *direct-connect* models get a PID here. Wireless Logitech mice have no
|
|
104
|
+
* dedicated USB product id of their own — they answer behind a Lightspeed/Bolt
|
|
105
|
+
* receiver or over HID++, and the driver claims them by protocol on the
|
|
106
|
+
* receiver's single control interface, not by a per-mouse PID. Listing them in
|
|
107
|
+
* a PID-keyed map would be a lie; they are receiver-supported and the page
|
|
108
|
+
* carries them as static receiver rows with an honest note (see the wall of
|
|
109
|
+
* "receiver" notes in the supported-mice table). That asymmetry is structural
|
|
110
|
+
* Logitech, not a maintenance gap — the same way WLMouse's wireless rows stay
|
|
111
|
+
* receiver-curated.
|
|
112
|
+
*
|
|
113
|
+
* `status` is per-model and honest: everything in `LOGITECH_DIRECT_PRODUCT_IDS`
|
|
114
|
+
* is genuinely writable (DPI via 0x2202 where the model has it, report rate
|
|
115
|
+
* 0x8060, onboard profiles), so every entry here is `supported`. The auto-list
|
|
116
|
+
* loop must honor `status` rather than hardcoding it, so adding a not-yet-
|
|
117
|
+
* implemented model here later cannot silently over-claim.
|
|
118
|
+
*
|
|
119
|
+
* Names mirror the landing page's static rows exactly ("G502 (all variants)",
|
|
120
|
+
* "G Pro (2017)", "G703 (wired)"), because the registry loop dedupes against
|
|
121
|
+
* the table by exact normalized key before falling back to fuzzy matching.
|
|
122
|
+
*/
|
|
123
|
+
export const LOGITECH_PRODUCTS = new Map([
|
|
124
|
+
// G203 / G102 generation
|
|
125
|
+
[0xc084, { name: "G203 PRODIGY", wireless: false, status: "supported" }],
|
|
126
|
+
[0xc089, { name: "G102 LIGHTSYNC", wireless: false, status: "supported" }],
|
|
127
|
+
[0xc092, { name: "G203 LIGHTSYNC", wireless: false, status: "supported" }],
|
|
128
|
+
// G303 / G402 generation
|
|
129
|
+
[0xc07d, { name: "G502 (all variants)", wireless: false, status: "supported" }],
|
|
130
|
+
[0xc07e, { name: "G402 Hyperion Fury", wireless: false, status: "supported" }],
|
|
131
|
+
[0xc080, { name: "G303 Daedalus Apex", wireless: false, status: "supported" }],
|
|
132
|
+
// G Pro / G502 / G403 HERO / G703 generation
|
|
133
|
+
[0xc085, { name: "G Pro (2017)", wireless: false, status: "supported" }],
|
|
134
|
+
[0xc087, { name: "G703 (wired)", wireless: false, status: "supported" }],
|
|
135
|
+
[0xc08b, { name: "G502 HERO", wireless: false, status: "supported" }],
|
|
136
|
+
[0xc08c, { name: "G Pro Hero", wireless: false, status: "supported" }],
|
|
137
|
+
[0xc08e, { name: "G903 HERO", wireless: false, status: "supported" }],
|
|
138
|
+
[0xc08f, { name: "G403 HERO", wireless: false, status: "supported" }],
|
|
139
|
+
// G Pro X Superlight generation
|
|
140
|
+
[0xc094, { name: "G Pro X Superlight", wireless: false, status: "supported" }],
|
|
141
|
+
[0xc09b, { name: "PRO X SUPERLIGHT 2", wireless: false, status: "supported" }],
|
|
142
|
+
[0xc0a0, { name: "PRO X SUPERLIGHT 2 DEX", wireless: false, status: "supported" }],
|
|
143
|
+
// G PRO 2 / next-gen G Pro family
|
|
144
|
+
[0xc09a, { name: "G PRO 2 LIGHTSPEED", wireless: false, status: "supported" }],
|
|
145
|
+
// G502 X generation
|
|
146
|
+
[0xc095, { name: "G502 X PLUS", wireless: false, status: "supported" }],
|
|
147
|
+
[0xc098, { name: "G502 X LIGHTSPEED", wireless: false, status: "supported" }],
|
|
148
|
+
[0xc099, { name: "G502 X", wireless: false, status: "supported" }],
|
|
149
|
+
]);
|
|
88
150
|
const DIRECT_PRODUCT_ID_SET = new Set(LOGITECH_DIRECT_PRODUCT_IDS);
|
|
89
151
|
const BOLT_PRODUCT_ID_SET = new Set(LOGITECH_BOLT_PRODUCT_IDS);
|
|
90
152
|
export function isDirectConnectProduct(productId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logitech/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAE3B,4EAA4E;AAC5E,4EAA4E;AAC5E,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,WAAW,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEjD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC,iFAAiF;AACjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAEhF
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logitech/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAE3B,4EAA4E;AAC5E,4EAA4E;AAC5E,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,UAA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,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beast X 4K (36a7:a887) settings protocol. Unlike the rest of the WLmouse
|
|
3
|
+
* range it never answers compx feature reports: commands go out as 64-byte
|
|
4
|
+
* output report 4 and each answer comes back as input report 4.
|
|
5
|
+
*
|
|
6
|
+
* Report body, after the report id:
|
|
7
|
+
* [0..1] CRC-16/MODBUS of [2..30], little-endian
|
|
8
|
+
* [2] command; [3] data length; [4..5] address, little-endian
|
|
9
|
+
* [6] reply status, 0xfe or 0xff on error (0 in requests)
|
|
10
|
+
* [7..30] data, at most 24 bytes
|
|
11
|
+
*
|
|
12
|
+
* Decoded from a USB capture of WLmouse's desktop software driving a Beast X
|
|
13
|
+
* 4K, and from that software's V0109 build for the read command and the
|
|
14
|
+
* settings layout. V0109 checksums with a plain byte sum; the newer build in
|
|
15
|
+
* the capture, which the firmware answered, uses the CRC above.
|
|
16
|
+
*/
|
|
17
|
+
export declare const WLMOUSE_4K_PRODUCT_ID = 43143;
|
|
18
|
+
export declare const WLMOUSE_4K_REPORT_ID = 4;
|
|
19
|
+
export declare const WLMOUSE_4K_PACKET_LENGTH = 63;
|
|
20
|
+
export declare const WLMOUSE_4K_CHUNK_LENGTH = 24;
|
|
21
|
+
export declare const WLMOUSE_4K_COMMAND: {
|
|
22
|
+
readonly openSession: 1;
|
|
23
|
+
readonly closeSession: 2;
|
|
24
|
+
readonly readSettings: 5;
|
|
25
|
+
readonly writeSettings: 6;
|
|
26
|
+
};
|
|
27
|
+
export declare const WLMOUSE_4K_STATUS_ERRORS: ReadonlySet<number>;
|
|
28
|
+
/**
|
|
29
|
+
* One onboard profile's settings, read and written at `profile << 7`. The
|
|
30
|
+
* active profile number is the byte at address 0.
|
|
31
|
+
* [01..08] lighting, [58..59] a fixed 600, [6b..70] the PC clock the vendor
|
|
32
|
+
* software pushes on every write; all preserved as read.
|
|
33
|
+
*/
|
|
34
|
+
export declare const WLMOUSE_4K_SETTINGS_LENGTH = 117;
|
|
35
|
+
export declare const WLMOUSE_4K_SETTINGS: {
|
|
36
|
+
readonly stageCount: 9;
|
|
37
|
+
readonly highMode: 10;
|
|
38
|
+
readonly pollingIndex: 11;
|
|
39
|
+
readonly activeStage: 12;
|
|
40
|
+
/** 0 = 1 mm, 1 = 2 mm. */
|
|
41
|
+
readonly liftOff: 13;
|
|
42
|
+
/** Eight 9-byte slots: [enabled][separate axes][X u16 LE][Y u16 LE][R][G][B]. */
|
|
43
|
+
readonly stages: 14;
|
|
44
|
+
readonly sleepSeconds: 86;
|
|
45
|
+
readonly debounceMs: 90;
|
|
46
|
+
readonly slamClickPrevention: 91;
|
|
47
|
+
readonly motionSync: 92;
|
|
48
|
+
};
|
|
49
|
+
export declare const WLMOUSE_4K_STAGE_LENGTH = 9;
|
|
50
|
+
export declare const WLMOUSE_4K_STAGE_SLOTS = 8;
|
|
51
|
+
export declare const WLMOUSE_4K_POLLING_RATES: readonly [125, 250, 500, 1000, 2000, 4000];
|
|
52
|
+
export interface Wlmouse4kReply {
|
|
53
|
+
command: number;
|
|
54
|
+
length: number;
|
|
55
|
+
address: number;
|
|
56
|
+
status: number;
|
|
57
|
+
data: Uint8Array;
|
|
58
|
+
}
|
|
59
|
+
export interface Wlmouse4kSettings {
|
|
60
|
+
stageCount: number;
|
|
61
|
+
activeStage: number;
|
|
62
|
+
/** X DPI of all eight slots; only the first `stageCount` are cycled. */
|
|
63
|
+
stageDpis: number[];
|
|
64
|
+
pollingRateHz: number | null;
|
|
65
|
+
highMode: boolean;
|
|
66
|
+
liftOffMm: number;
|
|
67
|
+
sleepSeconds: number;
|
|
68
|
+
debounceMs: number;
|
|
69
|
+
slamClickPrevention: boolean;
|
|
70
|
+
motionSync: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare function wlmouse4kCrc(bytes: ArrayLike<number>): number;
|
|
73
|
+
/** A request body; reads pass `length` and no data. */
|
|
74
|
+
export declare function wlmouse4kEncodeRequest(command: number, address?: number, data?: ArrayLike<number>, length?: number): Uint8Array<ArrayBuffer>;
|
|
75
|
+
export declare function wlmouse4kDecodeReply(body: Uint8Array): Wlmouse4kReply | null;
|
|
76
|
+
export declare function wlmouse4kDecodeSettings(block: Uint8Array): Wlmouse4kSettings;
|
|
77
|
+
//# sourceMappingURL=beast-x-4k.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beast-x-4k.d.ts","sourceRoot":"","sources":["../../src/wlmouse/beast-x-4k.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAC5C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AACX,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CAAyB,CAAC;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,MAAO,CAAC;AAC/C,eAAO,MAAM,mBAAmB;;;;;IAK9B,0BAA0B;;IAE1B,iFAAiF;;;;;;CAMzE,CAAC;AACX,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,wBAAwB,4CAA6C,CAAC;AAEnF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAO7D;AAED,uDAAuD;AACvD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,OAAO,SAAI,EACX,IAAI,GAAE,SAAS,CAAC,MAAM,CAAM,EAC5B,MAAM,SAAc,GACnB,UAAU,CAAC,WAAW,CAAC,CAczB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAU5E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAmB5E"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beast X 4K (36a7:a887) settings protocol. Unlike the rest of the WLmouse
|
|
3
|
+
* range it never answers compx feature reports: commands go out as 64-byte
|
|
4
|
+
* output report 4 and each answer comes back as input report 4.
|
|
5
|
+
*
|
|
6
|
+
* Report body, after the report id:
|
|
7
|
+
* [0..1] CRC-16/MODBUS of [2..30], little-endian
|
|
8
|
+
* [2] command; [3] data length; [4..5] address, little-endian
|
|
9
|
+
* [6] reply status, 0xfe or 0xff on error (0 in requests)
|
|
10
|
+
* [7..30] data, at most 24 bytes
|
|
11
|
+
*
|
|
12
|
+
* Decoded from a USB capture of WLmouse's desktop software driving a Beast X
|
|
13
|
+
* 4K, and from that software's V0109 build for the read command and the
|
|
14
|
+
* settings layout. V0109 checksums with a plain byte sum; the newer build in
|
|
15
|
+
* the capture, which the firmware answered, uses the CRC above.
|
|
16
|
+
*/
|
|
17
|
+
export const WLMOUSE_4K_PRODUCT_ID = 0xa887;
|
|
18
|
+
export const WLMOUSE_4K_REPORT_ID = 4;
|
|
19
|
+
export const WLMOUSE_4K_PACKET_LENGTH = 63;
|
|
20
|
+
export const WLMOUSE_4K_CHUNK_LENGTH = 24;
|
|
21
|
+
export const WLMOUSE_4K_COMMAND = {
|
|
22
|
+
openSession: 0x01,
|
|
23
|
+
closeSession: 0x02,
|
|
24
|
+
readSettings: 0x05,
|
|
25
|
+
writeSettings: 0x06,
|
|
26
|
+
};
|
|
27
|
+
export const WLMOUSE_4K_STATUS_ERRORS = new Set([0xfe, 0xff]);
|
|
28
|
+
/**
|
|
29
|
+
* One onboard profile's settings, read and written at `profile << 7`. The
|
|
30
|
+
* active profile number is the byte at address 0.
|
|
31
|
+
* [01..08] lighting, [58..59] a fixed 600, [6b..70] the PC clock the vendor
|
|
32
|
+
* software pushes on every write; all preserved as read.
|
|
33
|
+
*/
|
|
34
|
+
export const WLMOUSE_4K_SETTINGS_LENGTH = 0x75;
|
|
35
|
+
export const WLMOUSE_4K_SETTINGS = {
|
|
36
|
+
stageCount: 0x09,
|
|
37
|
+
highMode: 0x0a,
|
|
38
|
+
pollingIndex: 0x0b,
|
|
39
|
+
activeStage: 0x0c,
|
|
40
|
+
/** 0 = 1 mm, 1 = 2 mm. */
|
|
41
|
+
liftOff: 0x0d,
|
|
42
|
+
/** Eight 9-byte slots: [enabled][separate axes][X u16 LE][Y u16 LE][R][G][B]. */
|
|
43
|
+
stages: 0x0e,
|
|
44
|
+
sleepSeconds: 0x56,
|
|
45
|
+
debounceMs: 0x5a,
|
|
46
|
+
slamClickPrevention: 0x5b,
|
|
47
|
+
motionSync: 0x5c,
|
|
48
|
+
};
|
|
49
|
+
export const WLMOUSE_4K_STAGE_LENGTH = 9;
|
|
50
|
+
export const WLMOUSE_4K_STAGE_SLOTS = 8;
|
|
51
|
+
export const WLMOUSE_4K_POLLING_RATES = [125, 250, 500, 1000, 2000, 4000];
|
|
52
|
+
export function wlmouse4kCrc(bytes) {
|
|
53
|
+
let crc = 0xffff;
|
|
54
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
55
|
+
crc ^= bytes[index] & 0xff;
|
|
56
|
+
for (let bit = 0; bit < 8; bit += 1)
|
|
57
|
+
crc = crc & 1 ? (crc >>> 1) ^ 0xa001 : crc >>> 1;
|
|
58
|
+
}
|
|
59
|
+
return crc;
|
|
60
|
+
}
|
|
61
|
+
/** A request body; reads pass `length` and no data. */
|
|
62
|
+
export function wlmouse4kEncodeRequest(command, address = 0, data = [], length = data.length) {
|
|
63
|
+
if (length > WLMOUSE_4K_CHUNK_LENGTH || data.length > length) {
|
|
64
|
+
throw new Error(`A Beast X 4K request carries at most ${WLMOUSE_4K_CHUNK_LENGTH} bytes.`);
|
|
65
|
+
}
|
|
66
|
+
const body = new Uint8Array(WLMOUSE_4K_PACKET_LENGTH);
|
|
67
|
+
body[2] = command;
|
|
68
|
+
body[3] = length;
|
|
69
|
+
body[4] = address & 0xff;
|
|
70
|
+
body[5] = (address >> 8) & 0xff;
|
|
71
|
+
body.set(Array.from(data), 7);
|
|
72
|
+
const crc = wlmouse4kCrc(body.subarray(2, 31));
|
|
73
|
+
body[0] = crc & 0xff;
|
|
74
|
+
body[1] = crc >> 8;
|
|
75
|
+
return body;
|
|
76
|
+
}
|
|
77
|
+
export function wlmouse4kDecodeReply(body) {
|
|
78
|
+
if (body.length < 31)
|
|
79
|
+
return null;
|
|
80
|
+
const length = Math.min(body[3], WLMOUSE_4K_CHUNK_LENGTH);
|
|
81
|
+
return {
|
|
82
|
+
command: body[2],
|
|
83
|
+
length,
|
|
84
|
+
address: body[4] | (body[5] << 8),
|
|
85
|
+
status: body[6],
|
|
86
|
+
data: body.slice(7, 7 + length),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function wlmouse4kDecodeSettings(block) {
|
|
90
|
+
if (block.length < WLMOUSE_4K_SETTINGS_LENGTH)
|
|
91
|
+
throw new Error("The Beast X 4K returned a truncated settings block.");
|
|
92
|
+
const at = WLMOUSE_4K_SETTINGS;
|
|
93
|
+
const stageCount = Math.min(Math.max(block[at.stageCount], 1), WLMOUSE_4K_STAGE_SLOTS);
|
|
94
|
+
return {
|
|
95
|
+
stageCount,
|
|
96
|
+
activeStage: Math.min(block[at.activeStage], stageCount - 1),
|
|
97
|
+
stageDpis: Array.from({ length: WLMOUSE_4K_STAGE_SLOTS }, (_, stage) => {
|
|
98
|
+
const x = at.stages + stage * WLMOUSE_4K_STAGE_LENGTH + 2;
|
|
99
|
+
return block[x] | (block[x + 1] << 8);
|
|
100
|
+
}),
|
|
101
|
+
pollingRateHz: WLMOUSE_4K_POLLING_RATES[block[at.pollingIndex]] ?? null,
|
|
102
|
+
highMode: block[at.highMode] === 1,
|
|
103
|
+
liftOffMm: block[at.liftOff] === 1 ? 2 : 1,
|
|
104
|
+
sleepSeconds: block[at.sleepSeconds] | (block[at.sleepSeconds + 1] << 8),
|
|
105
|
+
debounceMs: block[at.debounceMs],
|
|
106
|
+
slamClickPrevention: block[at.slamClickPrevention] === 1,
|
|
107
|
+
motionSync: block[at.motionSync] === 1,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=beast-x-4k.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beast-x-4k.js","sourceRoot":"","sources":["../../src/wlmouse/beast-x-4k.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;CACX,CAAC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AAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,GAAG,CAAC,CAAE,IAAI,CAAC,CAAC;QAC1E,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAAE;QACjC,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC;QACxD,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;KACvC,CAAC;AACJ,CAAC"}
|
package/dist/wlmouse/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "../compx/codec.js";
|
|
2
|
+
export * from "./beast-x-4k.js";
|
|
2
3
|
export declare const WLMOUSE_VENDOR_ID = 13991;
|
|
3
4
|
export declare const WLMOUSE_POLLING_RATES: readonly [readonly [8, 125], readonly [4, 250], readonly [2, 500], readonly [1, 1000], readonly [16, 1000], readonly [32, 2000], readonly [64, 4000], readonly [128, 8000]];
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wlmouse/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,eAAO,MAAM,iBAAiB,QAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,6KAGxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wlmouse/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,eAAO,MAAM,iBAAiB,QAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,6KAGxB,CAAC"}
|
package/dist/wlmouse/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wlmouse/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IACnD,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;CAC9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wlmouse/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IACnD,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;CAC9C,CAAC"}
|