@openmouse/protocol 0.50.0 → 0.51.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 +1 -0
- package/dist/amkette/index.d.ts +2 -0
- package/dist/amkette/index.d.ts.map +1 -0
- package/dist/amkette/index.js +2 -0
- package/dist/amkette/index.js.map +1 -0
- package/dist/amkette/xs.d.ts +63 -0
- package/dist/amkette/xs.d.ts.map +1 -0
- package/dist/amkette/xs.js +79 -0
- package/dist/amkette/xs.js.map +1 -0
- package/dist/corsair/bragi.d.ts +70 -12
- package/dist/corsair/bragi.d.ts.map +1 -1
- package/dist/corsair/bragi.js +85 -16
- package/dist/corsair/bragi.js.map +1 -1
- package/dist/drivers/amkette/xs-hid.d.ts +142 -0
- package/dist/drivers/amkette/xs-hid.d.ts.map +1 -0
- package/dist/drivers/amkette/xs-hid.js +683 -0
- package/dist/drivers/amkette/xs-hid.js.map +1 -0
- package/dist/drivers/corsair/bragi-hid.d.ts +17 -12
- package/dist/drivers/corsair/bragi-hid.d.ts.map +1 -1
- package/dist/drivers/corsair/bragi-hid.js +35 -15
- package/dist/drivers/corsair/bragi-hid.js.map +1 -1
- package/dist/drivers/gwolves/products.d.ts.map +1 -1
- package/dist/drivers/gwolves/products.js +3 -0
- package/dist/drivers/gwolves/products.js.map +1 -1
- package/dist/drivers/incott/hid.d.ts +5 -0
- package/dist/drivers/incott/hid.d.ts.map +1 -1
- package/dist/drivers/incott/hid.js +18 -7
- package/dist/drivers/incott/hid.js.map +1 -1
- package/dist/drivers/lamzu/hid.d.ts +4 -0
- package/dist/drivers/lamzu/hid.d.ts.map +1 -1
- package/dist/drivers/lamzu/hid.js +41 -2
- package/dist/drivers/lamzu/hid.js.map +1 -1
- package/dist/drivers/lamzu-atlantis/hid.d.ts.map +1 -1
- package/dist/drivers/lamzu-atlantis/hid.js +2 -3
- package/dist/drivers/lamzu-atlantis/hid.js.map +1 -1
- package/dist/drivers/logitech/hidpp.d.ts +2 -0
- package/dist/drivers/logitech/hidpp.d.ts.map +1 -1
- package/dist/drivers/logitech/hidpp.js +28 -13
- package/dist/drivers/logitech/hidpp.js.map +1 -1
- package/dist/drivers/mchose/hid.d.ts +9 -0
- package/dist/drivers/mchose/hid.d.ts.map +1 -1
- package/dist/drivers/mchose/hid.js +36 -5
- package/dist/drivers/mchose/hid.js.map +1 -1
- package/dist/drivers/mouse-types.d.ts +1 -1
- package/dist/drivers/mouse-types.d.ts.map +1 -1
- package/dist/drivers/ninjutso/hid.d.ts +1 -0
- package/dist/drivers/ninjutso/hid.d.ts.map +1 -1
- package/dist/drivers/ninjutso/hid.js +18 -11
- package/dist/drivers/ninjutso/hid.js.map +1 -1
- package/dist/drivers/pulsar/pulsar-hid.js +1 -1
- package/dist/drivers/pulsar/pulsar-hid.js.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 +6 -0
- package/dist/drivers/registry.js.map +1 -1
- package/dist/drivers/ryunix/kyu-pro-mx1-hid.d.ts.map +1 -1
- package/dist/drivers/ryunix/kyu-pro-mx1-hid.js +4 -1
- package/dist/drivers/ryunix/kyu-pro-mx1-hid.js.map +1 -1
- package/dist/drivers/scyrox/hid.d.ts +5 -0
- package/dist/drivers/scyrox/hid.d.ts.map +1 -1
- package/dist/drivers/scyrox/hid.js +5 -0
- package/dist/drivers/scyrox/hid.js.map +1 -1
- package/dist/drivers/vendors.d.ts +7 -2
- package/dist/drivers/vendors.d.ts.map +1 -1
- package/dist/drivers/vendors.js +35 -9
- package/dist/drivers/vendors.js.map +1 -1
- package/dist/incott/index.d.ts +33 -8
- package/dist/incott/index.d.ts.map +1 -1
- package/dist/incott/index.js +44 -11
- package/dist/incott/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lamzu/atlantis.d.ts +18 -9
- package/dist/lamzu/atlantis.d.ts.map +1 -1
- package/dist/lamzu/atlantis.js +21 -6
- package/dist/lamzu/atlantis.js.map +1 -1
- package/dist/lamzu/index.d.ts +8 -5
- package/dist/lamzu/index.d.ts.map +1 -1
- package/dist/lamzu/index.js +10 -5
- package/dist/lamzu/index.js.map +1 -1
- package/dist/mchose/index.d.ts +14 -0
- package/dist/mchose/index.d.ts.map +1 -1
- package/dist/mchose/index.js +25 -2
- package/dist/mchose/index.js.map +1 -1
- package/dist/ninjutso/index.d.ts.map +1 -1
- package/dist/ninjutso/index.js +5 -2
- package/dist/ninjutso/index.js.map +1 -1
- package/dist/ryunix/index.d.ts +1 -0
- package/dist/ryunix/index.d.ts.map +1 -1
- package/dist/ryunix/index.js +1 -0
- package/dist/ryunix/index.js.map +1 -1
- package/dist/ryunix/kyu-pro-mx1.d.ts +10 -1
- package/dist/ryunix/kyu-pro-mx1.d.ts.map +1 -1
- package/dist/ryunix/kyu-pro-mx1.js +10 -12
- package/dist/ryunix/kyu-pro-mx1.js.map +1 -1
- package/dist/ryunix/protocol.d.ts +204 -0
- package/dist/ryunix/protocol.d.ts.map +1 -0
- package/dist/ryunix/protocol.js +366 -0
- package/dist/ryunix/protocol.js.map +1 -0
- package/dist/scyrox/index.d.ts +5 -0
- package/dist/scyrox/index.d.ts.map +1 -1
- package/dist/scyrox/index.js +37 -1
- package/dist/scyrox/index.js.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -73,6 +73,7 @@ checklist.
|
|
|
73
73
|
| Rapoo VT9 Pro | `@openmouse/protocol/rapoo` |
|
|
74
74
|
| Razer V4 | `@openmouse/protocol/razer-v4` |
|
|
75
75
|
| Ryunix | `@openmouse/protocol/ryunix` |
|
|
76
|
+
| Amkette XS series | `@openmouse/protocol/amkette` |
|
|
76
77
|
| SteelSeries Rival 3 (Gen 1) | `@openmouse/protocol/steelseries` |
|
|
77
78
|
| Teevolution | `@openmouse/protocol/teevolution` |
|
|
78
79
|
| VGN | `@openmouse/protocol/vgn` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/amkette/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/amkette/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Amkette XS series on the 0x04F3 OEM firmware it shares with the Ryunix Kyu Pro
|
|
3
|
+
* MX1. The wire protocol, telemetry and command encoders are shared and live in
|
|
4
|
+
* `@openmouse/protocol/ryunix`; this module holds only what identifies the
|
|
5
|
+
* Amkette models: their IDs, collection usage, product strings and Bluetooth
|
|
6
|
+
* names. See `docs/amkette-xs-flow-testing.md` for the evidence.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Bluetooth LE product ID of the Amkette XS Flow 2 Speed. Amkette's
|
|
10
|
+
* configurator treats any ID other than 0x026E and 0x026F as Bluetooth.
|
|
11
|
+
*/
|
|
12
|
+
export declare const AMKETTE_XS_BLUETOOTH_PRODUCT_ID = 621;
|
|
13
|
+
/**
|
|
14
|
+
* The Amkette XS firmware publishes the same configuration channel on usage
|
|
15
|
+
* 0x00 of page 0x0A, on all three paths, where the Kyu Pro MX1 contribution
|
|
16
|
+
* saw usage 0xC7. The usage keeps the two drivers apart.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AMKETTE_XS_USAGE = 0;
|
|
19
|
+
export declare const AMKETTE_XS_PRODUCT_IDS: ReadonlySet<number>;
|
|
20
|
+
export interface AmketteXsModel {
|
|
21
|
+
/** Retail name shown to the user. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** The USB product string the model reports, as Amkette's configurator labels it. */
|
|
24
|
+
productStrings: readonly string[];
|
|
25
|
+
/**
|
|
26
|
+
* Base of the Bluetooth LE name; the mouse keeps three Bluetooth slots and
|
|
27
|
+
* appends the active slot, e.g. "XS speed 2". Null where not known.
|
|
28
|
+
*/
|
|
29
|
+
bluetoothLabel: string | null;
|
|
30
|
+
/** Lighting scheme in the vendor app (`RYUNIX_LIGHTING_SCHEMES` in `@openmouse/protocol/ryunix`). */
|
|
31
|
+
lightingScheme: number;
|
|
32
|
+
/** True once an owned unit has been seen reporting `productStrings`. */
|
|
33
|
+
verified: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Amkette XS models on this firmware. Each configurator names its device with a
|
|
37
|
+
* short label; an owned XS Flow 2 Speed reports that label ("XS Speed") as its
|
|
38
|
+
* USB product string on the cable. Over Bluetooth LE it advertises "XS speed" plus
|
|
39
|
+
* the active slot (the mouse holds three; "XS speed 2" was seen on slot 2, the
|
|
40
|
+
* other slots are as the owner described them). The other two models' labels are
|
|
41
|
+
* taken from their configurators and have not been seen on hardware.
|
|
42
|
+
*/
|
|
43
|
+
export declare const AMKETTE_XS_MODELS: readonly AmketteXsModel[];
|
|
44
|
+
/**
|
|
45
|
+
* The Amkette model a product string names: a USB label or a Bluetooth slot
|
|
46
|
+
* name. Retail names are not matched, since the firmware has not been seen to
|
|
47
|
+
* report them.
|
|
48
|
+
*/
|
|
49
|
+
export declare function amketteXsModel(productName: string | null | undefined): AmketteXsModel | null;
|
|
50
|
+
/**
|
|
51
|
+
* Name shown when the firmware reports no model name. The driver is chosen by
|
|
52
|
+
* the usage-0x00 collection, which has only been seen on an Amkette mouse, so an
|
|
53
|
+
* unnamed device is shown as Amkette's XS series rather than a specific model.
|
|
54
|
+
*/
|
|
55
|
+
export declare const AMKETTE_XS_FALLBACK_NAME = "XS series";
|
|
56
|
+
/**
|
|
57
|
+
* True for the generic strings the 2.4 GHz receiver reports ("2.4G Wireless
|
|
58
|
+
* Receiver"), which name the dongle rather than the mouse.
|
|
59
|
+
*/
|
|
60
|
+
export declare function amketteIsReceiverName(name: string | null | undefined): boolean;
|
|
61
|
+
/** The Bluetooth slot (1-3) a name like "XS speed 2" advertises for a model, or null. */
|
|
62
|
+
export declare function amketteBluetoothSlot(productName: string | null | undefined, model?: AmketteXsModel): number | null;
|
|
63
|
+
//# sourceMappingURL=xs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xs.d.ts","sourceRoot":"","sources":["../../src/amkette/xs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,eAAO,MAAM,+BAA+B,MAAS,CAAC;AACtD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAO,CAAC;AACrC,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAIrD,CAAC;AAEH,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;OAGG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qGAAqG;IACrG,cAAc,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAItD,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,cAAc,GAAG,IAAI,CAM5F;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,cAAc,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE9E;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,KAAK,CAAC,EAAE,cAAc,GACrB,MAAM,GAAG,IAAI,CASf"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Amkette XS series on the 0x04F3 OEM firmware it shares with the Ryunix Kyu Pro
|
|
3
|
+
* MX1. The wire protocol, telemetry and command encoders are shared and live in
|
|
4
|
+
* `@openmouse/protocol/ryunix`; this module holds only what identifies the
|
|
5
|
+
* Amkette models: their IDs, collection usage, product strings and Bluetooth
|
|
6
|
+
* names. See `docs/amkette-xs-flow-testing.md` for the evidence.
|
|
7
|
+
*/
|
|
8
|
+
import { RYUNIX_WIRED_PRODUCT_ID, RYUNIX_WIRELESS_PRODUCT_ID } from "../ryunix/kyu-pro-mx1.js";
|
|
9
|
+
/**
|
|
10
|
+
* Bluetooth LE product ID of the Amkette XS Flow 2 Speed. Amkette's
|
|
11
|
+
* configurator treats any ID other than 0x026E and 0x026F as Bluetooth.
|
|
12
|
+
*/
|
|
13
|
+
export const AMKETTE_XS_BLUETOOTH_PRODUCT_ID = 0x026d;
|
|
14
|
+
/**
|
|
15
|
+
* The Amkette XS firmware publishes the same configuration channel on usage
|
|
16
|
+
* 0x00 of page 0x0A, on all three paths, where the Kyu Pro MX1 contribution
|
|
17
|
+
* saw usage 0xC7. The usage keeps the two drivers apart.
|
|
18
|
+
*/
|
|
19
|
+
export const AMKETTE_XS_USAGE = 0x00;
|
|
20
|
+
export const AMKETTE_XS_PRODUCT_IDS = new Set([
|
|
21
|
+
AMKETTE_XS_BLUETOOTH_PRODUCT_ID,
|
|
22
|
+
RYUNIX_WIRED_PRODUCT_ID,
|
|
23
|
+
RYUNIX_WIRELESS_PRODUCT_ID,
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Amkette XS models on this firmware. Each configurator names its device with a
|
|
27
|
+
* short label; an owned XS Flow 2 Speed reports that label ("XS Speed") as its
|
|
28
|
+
* USB product string on the cable. Over Bluetooth LE it advertises "XS speed" plus
|
|
29
|
+
* the active slot (the mouse holds three; "XS speed 2" was seen on slot 2, the
|
|
30
|
+
* other slots are as the owner described them). The other two models' labels are
|
|
31
|
+
* taken from their configurators and have not been seen on hardware.
|
|
32
|
+
*/
|
|
33
|
+
export const AMKETTE_XS_MODELS = [
|
|
34
|
+
{ name: "XS Flow 2 Speed", productStrings: ["XS Speed"], bluetoothLabel: "XS speed", lightingScheme: 1, verified: true },
|
|
35
|
+
{ name: "XS Flow Plus", productStrings: ["XS Flow+"], bluetoothLabel: null, lightingScheme: 3, verified: false },
|
|
36
|
+
{ name: "XS Natural Plus", productStrings: ["XS Natural+"], bluetoothLabel: null, lightingScheme: 4, verified: false },
|
|
37
|
+
];
|
|
38
|
+
function compactName(name) {
|
|
39
|
+
return name.trim().toLowerCase().replace(/[\s_-]+/g, "");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The Amkette model a product string names: a USB label or a Bluetooth slot
|
|
43
|
+
* name. Retail names are not matched, since the firmware has not been seen to
|
|
44
|
+
* report them.
|
|
45
|
+
*/
|
|
46
|
+
export function amketteXsModel(productName) {
|
|
47
|
+
const compact = compactName(productName ?? "");
|
|
48
|
+
if (compact === "")
|
|
49
|
+
return null;
|
|
50
|
+
return AMKETTE_XS_MODELS.find((model) => model.productStrings.some((label) => compact === compactName(label))
|
|
51
|
+
|| amketteBluetoothSlot(productName, model) !== null) ?? null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Name shown when the firmware reports no model name. The driver is chosen by
|
|
55
|
+
* the usage-0x00 collection, which has only been seen on an Amkette mouse, so an
|
|
56
|
+
* unnamed device is shown as Amkette's XS series rather than a specific model.
|
|
57
|
+
*/
|
|
58
|
+
export const AMKETTE_XS_FALLBACK_NAME = "XS series";
|
|
59
|
+
/**
|
|
60
|
+
* True for the generic strings the 2.4 GHz receiver reports ("2.4G Wireless
|
|
61
|
+
* Receiver"), which name the dongle rather than the mouse.
|
|
62
|
+
*/
|
|
63
|
+
export function amketteIsReceiverName(name) {
|
|
64
|
+
return /receiver|dongle/i.test(name ?? "");
|
|
65
|
+
}
|
|
66
|
+
/** The Bluetooth slot (1-3) a name like "XS speed 2" advertises for a model, or null. */
|
|
67
|
+
export function amketteBluetoothSlot(productName, model) {
|
|
68
|
+
const compact = compactName(productName ?? "");
|
|
69
|
+
for (const candidate of model ? [model] : AMKETTE_XS_MODELS) {
|
|
70
|
+
if (candidate.bluetoothLabel === null)
|
|
71
|
+
continue;
|
|
72
|
+
const base = compactName(candidate.bluetoothLabel);
|
|
73
|
+
const slot = /^[123]$/.exec(compact.slice(base.length));
|
|
74
|
+
if (compact.startsWith(base) && slot)
|
|
75
|
+
return Number(slot[0]);
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=xs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xs.js","sourceRoot":"","sources":["../../src/amkette/xs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE/F;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;AACtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AACrC,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IACjE,+BAA+B;IAC/B,uBAAuB;IACvB,0BAA0B;CAC3B,CAAC,CAAC;AAkBH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,EAAE,IAAI,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,UAAU,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxH,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC,UAAU,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;IAChH,EAAE,IAAI,EAAE,iB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M,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/corsair/bragi.d.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Corsair's "Bragi" protocol (ckb-next's name; OpenRGB calls it Corsair
|
|
3
|
-
* Peripheral V2), spoken by the IRONCLAW RGB WIRELESS
|
|
4
|
-
* post-2019 peripherals, over the cable and through
|
|
3
|
+
* Peripheral V2), spoken by the IRONCLAW RGB WIRELESS, the SCIMITAR RGB ELITE
|
|
4
|
+
* and Corsair's other post-2019 peripherals, over the cable and through
|
|
5
|
+
* SLIPSTREAM receivers.
|
|
5
6
|
*
|
|
6
7
|
* The request layout and the SET ack are confirmed against iCUE in
|
|
7
|
-
* `captures/corsair-ironclaw-rgb-wireless/`. GET replies
|
|
8
|
-
*
|
|
8
|
+
* `captures/corsair-ironclaw-rgb-wireless/`. GET replies, the handshake and
|
|
9
|
+
* the polling, brightness and angle-snapping properties were captured from a
|
|
10
|
+
* wired SCIMITAR RGB ELITE in `captures/corsair-scimitar-rgb-elite/`. Property
|
|
11
|
+
* ids not seen in a capture come from ckb-next (`bragi_proto.h`,
|
|
9
12
|
* `bragi_common.c`), OpenRGB (`CorsairPeripheralV2Controller.cpp`) and
|
|
10
13
|
* OpenLinkHub (`ironclawW.go`), which agree with each other.
|
|
11
14
|
*
|
|
12
|
-
* Transport:
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* Transport: output reports without a report id on the vendor interface
|
|
16
|
+
* (usage page 0xFF42, interface 1, interrupt endpoints 0x04/0x84). Every
|
|
17
|
+
* request is answered by an input report of the same size on the same
|
|
18
|
+
* interface. The size is 64 bytes on the IRONCLAW and 128 bytes on the
|
|
19
|
+
* SCIMITAR RGB ELITE (its report descriptor declares 128; see the mouse table).
|
|
15
20
|
*
|
|
16
21
|
* request [0x08 | slot] [command] [property] [0x00] [value, u16 LE]
|
|
17
22
|
* reply [slot] [command] [status] [value, LE]
|
|
@@ -22,6 +27,7 @@
|
|
|
22
27
|
* `src/drivers/corsair/bragi-hid.ts`.
|
|
23
28
|
*/
|
|
24
29
|
export declare const CORSAIR_BRAGI_USAGE_PAGE = 65346;
|
|
30
|
+
/** The default report size; a mouse whose descriptor says otherwise sets `packetSize` in its table entry. */
|
|
25
31
|
export declare const CORSAIR_BRAGI_PACKET_SIZE = 64;
|
|
26
32
|
/** Byte 0 of every request, OR'd with the slot. */
|
|
27
33
|
export declare const CORSAIR_BRAGI_MAGIC = 8;
|
|
@@ -33,8 +39,12 @@ export declare const CORSAIR_BRAGI_COMMAND: {
|
|
|
33
39
|
export declare const CORSAIR_BRAGI_PROPERTY: {
|
|
34
40
|
/** 1–7 = 8 ms … 0.125 ms, see `CORSAIR_BRAGI_POLLING_RATES`. */
|
|
35
41
|
readonly pollingRate: 1;
|
|
42
|
+
/** Lighting brightness in tenths of a percent, 0–1000 (SCIMITAR RGB ELITE: iCUE's 0/33/66/100 % steps send 0/330/660/1000). */
|
|
43
|
+
readonly brightness: 2;
|
|
36
44
|
/** 1 = hardware (onboard settings), 2 = software (iCUE drives the mouse). */
|
|
37
45
|
readonly mode: 3;
|
|
46
|
+
/** Angle snapping, 0 = off, 1 = on (SCIMITAR RGB ELITE). */
|
|
47
|
+
readonly angleSnapping: 7;
|
|
38
48
|
/** Tenths of a percent, 0–1000. */
|
|
39
49
|
readonly batteryLevel: 15;
|
|
40
50
|
readonly batteryStatus: 16;
|
|
@@ -44,6 +54,12 @@ export declare const CORSAIR_BRAGI_PROPERTY: {
|
|
|
44
54
|
/** Live DPI per axis, plain u16 (no scaling). */
|
|
45
55
|
readonly dpiX: 33;
|
|
46
56
|
readonly dpiY: 34;
|
|
57
|
+
/**
|
|
58
|
+
* Active onboard DPI stage, 0-based (SCIMITAR RGB ELITE: follows the mouse's own
|
|
59
|
+
* DPI button and survives a replug; iCUE writes it along with the stage's DPI
|
|
60
|
+
* when a stage is selected in Device Memory Mode). Read-only here.
|
|
61
|
+
*/
|
|
62
|
+
readonly dpiStage: 79;
|
|
47
63
|
/** Receivers only: bit n is set while the device paired in slot n is connected. */
|
|
48
64
|
readonly slots: 54;
|
|
49
65
|
};
|
|
@@ -64,12 +80,32 @@ export interface CorsairBragiMouse {
|
|
|
64
80
|
name: string;
|
|
65
81
|
dpiMin: number;
|
|
66
82
|
dpiMax: number;
|
|
83
|
+
/**
|
|
84
|
+
* Output/input report size in bytes, from the vendor interface's HID report
|
|
85
|
+
* descriptor. Optional so existing entries stay valid: omitted means
|
|
86
|
+
* `CORSAIR_BRAGI_PACKET_SIZE` (64).
|
|
87
|
+
*/
|
|
88
|
+
packetSize?: number;
|
|
89
|
+
/**
|
|
90
|
+
* HID usage of the command collection (the input-only 0xFF42 collection on the
|
|
91
|
+
* same device has a different usage). Left out when the descriptor was not
|
|
92
|
+
* captured, which leaves the picker filter on the usage page alone.
|
|
93
|
+
*/
|
|
94
|
+
commandUsage?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Properties beyond the base set that this mouse has been seen to answer a GET
|
|
97
|
+
* for on hardware. Mice without the entry are never asked, so a mouse that
|
|
98
|
+
* refuses them costs no timeouts and the IRONCLAW's request sequence is unchanged.
|
|
99
|
+
*/
|
|
100
|
+
extraProperties?: readonly ("brightness" | "angleSnapping" | "dpiStage")[];
|
|
67
101
|
}
|
|
68
102
|
/**
|
|
69
103
|
* Mice by the product id they report over the cable, which is also what a
|
|
70
104
|
* receiver returns for property 0x12 on their slot (ckb-next names receiver
|
|
71
|
-
* children this way). DPI range from iCUE's slider: the
|
|
72
|
-
* fit 100–18,000.
|
|
105
|
+
* children this way). The IRONCLAW's DPI range is from iCUE's slider: the
|
|
106
|
+
* captured values only fit 100–18,000. The SCIMITAR RGB ELITE's range was
|
|
107
|
+
* probed on the mouse: SET 100 and 18,000 are acked ok, 99 and 18,001 get
|
|
108
|
+
* status 1 (invalid value) and leave the old value in place.
|
|
73
109
|
*/
|
|
74
110
|
export declare const CORSAIR_BRAGI_MICE: ReadonlyMap<number, CorsairBragiMouse>;
|
|
75
111
|
/**
|
|
@@ -85,16 +121,34 @@ export interface CorsairBragiReply {
|
|
|
85
121
|
/** Bytes 3–6 little-endian; a property uses as many of them as it needs. */
|
|
86
122
|
value: number;
|
|
87
123
|
}
|
|
124
|
+
/** A zero-padded request of `size` bytes (a mouse's `packetSize`). */
|
|
125
|
+
export declare function corsairBragiPacketOfSize(size: number, slot: number, command: number, property: number, ...value: number[]): Uint8Array;
|
|
88
126
|
/** A zero-padded 64-byte request. */
|
|
89
127
|
export declare function corsairBragiPacket(slot: number, command: number, property: number, ...value: number[]): Uint8Array;
|
|
128
|
+
/**
|
|
129
|
+
* Request encoders. `size` is the mouse's `packetSize` (default 64); pass 128 for the
|
|
130
|
+
* SCIMITAR RGB ELITE. The driver is read-only for now, so nothing here is sent by it:
|
|
131
|
+
* the SET layouts are tested against captures.
|
|
132
|
+
*/
|
|
90
133
|
export declare const corsairBragiEncode: {
|
|
91
|
-
readonly get: (slot: number, property: number) => Uint8Array;
|
|
134
|
+
readonly get: (slot: number, property: number, size?: number) => Uint8Array;
|
|
92
135
|
/**
|
|
93
136
|
* One DPI axis. iCUE sends X then Y on every change and gets a bare ack
|
|
94
137
|
* (`01 01 00`) for each. Encoded here so the layout is tested against the
|
|
95
|
-
* capture; the read-only driver never sends it.
|
|
138
|
+
* capture; the read-only driver never sends it. The mouse itself rejects values
|
|
139
|
+
* outside its range with status 1 (SCIMITAR RGB ELITE: below 100 or above 18,000).
|
|
140
|
+
* The write is live and volatile: the SCIMITAR RGB ELITE forgot it on a replug.
|
|
141
|
+
*/
|
|
142
|
+
readonly setDpi: (slot: number, axis: "x" | "y", dpi: number, size?: number) => Uint8Array;
|
|
143
|
+
/**
|
|
144
|
+
* Polling rate in Hz. The SCIMITAR RGB ELITE stores it and re-enumerates on USB
|
|
145
|
+
* right after the ack, so the read-back must wait for the device to return.
|
|
96
146
|
*/
|
|
97
|
-
readonly
|
|
147
|
+
readonly setPollingRate: (slot: number, hz: number, size?: number) => Uint8Array;
|
|
148
|
+
/** Lighting brightness as a percentage, sent in tenths of a percent. Stored by the SCIMITAR RGB ELITE. */
|
|
149
|
+
readonly setBrightness: (slot: number, percent: number, size?: number) => Uint8Array;
|
|
150
|
+
/** Angle snapping on or off. Stored by the SCIMITAR RGB ELITE. */
|
|
151
|
+
readonly setAngleSnapping: (slot: number, enabled: boolean, size?: number) => Uint8Array;
|
|
98
152
|
};
|
|
99
153
|
/** True when `reply` answers `request`: same slot (low three bits) and the command echoed. */
|
|
100
154
|
export declare function corsairBragiIsReplyTo(request: Uint8Array, reply: Uint8Array): boolean;
|
|
@@ -106,6 +160,10 @@ export declare const corsairBragiDecode: {
|
|
|
106
160
|
readonly pollingRateHz: (value: number) => number | null;
|
|
107
161
|
/** Tenths of a percent → percent. */
|
|
108
162
|
readonly batteryPercent: (value: number) => number | null;
|
|
163
|
+
/** Tenths of a percent → percent (SCIMITAR RGB ELITE brightness: 330 → 33). */
|
|
164
|
+
readonly brightnessPercent: (value: number) => number | null;
|
|
165
|
+
/** 0 off, 1 on; anything else is not a value this mouse has been seen to send. */
|
|
166
|
+
readonly angleSnapping: (value: number) => boolean | null;
|
|
109
167
|
/** ckb-next's battery enum: 1 charging, 2 discharging, 3 charged. */
|
|
110
168
|
readonly batteryState: (value: number) => "Charging" | "Discharging" | "Full" | "Unknown";
|
|
111
169
|
/** Connected receiver slots, ascending. Bit 0 is never a paired device. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bragi.d.ts","sourceRoot":"","sources":["../../src/corsair/bragi.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bragi.d.ts","sourceRoot":"","sources":["../../src/corsair/bragi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,6GAA6G;AAC7G,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,IAAO,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,eAAO,MAAM,qBAAqB;;;CAGxB,CAAC;AAEX,eAAO,MAAM,sBAAsB;IACjC,gEAAgE;;IAEhE,+HAA+H;;IAE/H,6EAA6E;;IAE7E,4DAA4D;;IAE5D,mCAAmC;;;;;;IAMnC,iDAAiD;;;IAGjD;;;;OAIG;;IAEH,mFAAmF;;CAE3E,CAAC;AAEX,iFAAiF;AACjF,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX,8FAA8F;AAC9F,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAElE,CAAC;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC,YAAY,GAAG,eAAe,GAAG,UAAU,CAAC,EAAE,CAAC;CAC5E;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAUpE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE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MAAM,KAAG,MAAM,GAAG,IAAI;IAC7C,qCAAqC;qCACb,MAAM,KAAG,MAAM,GAAG,IAAI;IAC9C,+EAA+E;wCACpD,MAAM,KAAG,MAAM,GAAG,IAAI;IACjD,kFAAkF;oCAC3D,MAAM,KAAG,OAAO,GAAG,IAAI;IAC9C,qEAAqE;mCAC/C,MAAM,KAAG,UAAU,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS;IAE9E,2EAA2E;4BAC5D,MAAM,KAAG,MAAM,EAAE;CAOxB,CAAC"}
|
package/dist/corsair/bragi.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Corsair's "Bragi" protocol (ckb-next's name; OpenRGB calls it Corsair
|
|
3
|
-
* Peripheral V2), spoken by the IRONCLAW RGB WIRELESS
|
|
4
|
-
* post-2019 peripherals, over the cable and through
|
|
3
|
+
* Peripheral V2), spoken by the IRONCLAW RGB WIRELESS, the SCIMITAR RGB ELITE
|
|
4
|
+
* and Corsair's other post-2019 peripherals, over the cable and through
|
|
5
|
+
* SLIPSTREAM receivers.
|
|
5
6
|
*
|
|
6
7
|
* The request layout and the SET ack are confirmed against iCUE in
|
|
7
|
-
* `captures/corsair-ironclaw-rgb-wireless/`. GET replies
|
|
8
|
-
*
|
|
8
|
+
* `captures/corsair-ironclaw-rgb-wireless/`. GET replies, the handshake and
|
|
9
|
+
* the polling, brightness and angle-snapping properties were captured from a
|
|
10
|
+
* wired SCIMITAR RGB ELITE in `captures/corsair-scimitar-rgb-elite/`. Property
|
|
11
|
+
* ids not seen in a capture come from ckb-next (`bragi_proto.h`,
|
|
9
12
|
* `bragi_common.c`), OpenRGB (`CorsairPeripheralV2Controller.cpp`) and
|
|
10
13
|
* OpenLinkHub (`ironclawW.go`), which agree with each other.
|
|
11
14
|
*
|
|
12
|
-
* Transport:
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* Transport: output reports without a report id on the vendor interface
|
|
16
|
+
* (usage page 0xFF42, interface 1, interrupt endpoints 0x04/0x84). Every
|
|
17
|
+
* request is answered by an input report of the same size on the same
|
|
18
|
+
* interface. The size is 64 bytes on the IRONCLAW and 128 bytes on the
|
|
19
|
+
* SCIMITAR RGB ELITE (its report descriptor declares 128; see the mouse table).
|
|
15
20
|
*
|
|
16
21
|
* request [0x08 | slot] [command] [property] [0x00] [value, u16 LE]
|
|
17
22
|
* reply [slot] [command] [status] [value, LE]
|
|
@@ -22,6 +27,7 @@
|
|
|
22
27
|
* `src/drivers/corsair/bragi-hid.ts`.
|
|
23
28
|
*/
|
|
24
29
|
export const CORSAIR_BRAGI_USAGE_PAGE = 0xff42;
|
|
30
|
+
/** The default report size; a mouse whose descriptor says otherwise sets `packetSize` in its table entry. */
|
|
25
31
|
export const CORSAIR_BRAGI_PACKET_SIZE = 64;
|
|
26
32
|
/** Byte 0 of every request, OR'd with the slot. */
|
|
27
33
|
export const CORSAIR_BRAGI_MAGIC = 0x08;
|
|
@@ -33,8 +39,12 @@ export const CORSAIR_BRAGI_COMMAND = {
|
|
|
33
39
|
export const CORSAIR_BRAGI_PROPERTY = {
|
|
34
40
|
/** 1–7 = 8 ms … 0.125 ms, see `CORSAIR_BRAGI_POLLING_RATES`. */
|
|
35
41
|
pollingRate: 0x01,
|
|
42
|
+
/** Lighting brightness in tenths of a percent, 0–1000 (SCIMITAR RGB ELITE: iCUE's 0/33/66/100 % steps send 0/330/660/1000). */
|
|
43
|
+
brightness: 0x02,
|
|
36
44
|
/** 1 = hardware (onboard settings), 2 = software (iCUE drives the mouse). */
|
|
37
45
|
mode: 0x03,
|
|
46
|
+
/** Angle snapping, 0 = off, 1 = on (SCIMITAR RGB ELITE). */
|
|
47
|
+
angleSnapping: 0x07,
|
|
38
48
|
/** Tenths of a percent, 0–1000. */
|
|
39
49
|
batteryLevel: 0x0f,
|
|
40
50
|
batteryStatus: 0x10,
|
|
@@ -44,6 +54,12 @@ export const CORSAIR_BRAGI_PROPERTY = {
|
|
|
44
54
|
/** Live DPI per axis, plain u16 (no scaling). */
|
|
45
55
|
dpiX: 0x21,
|
|
46
56
|
dpiY: 0x22,
|
|
57
|
+
/**
|
|
58
|
+
* Active onboard DPI stage, 0-based (SCIMITAR RGB ELITE: follows the mouse's own
|
|
59
|
+
* DPI button and survives a replug; iCUE writes it along with the stage's DPI
|
|
60
|
+
* when a stage is selected in Device Memory Mode). Read-only here.
|
|
61
|
+
*/
|
|
62
|
+
dpiStage: 0x4f,
|
|
47
63
|
/** Receivers only: bit n is set while the device paired in slot n is connected. */
|
|
48
64
|
slots: 0x36,
|
|
49
65
|
};
|
|
@@ -65,11 +81,21 @@ export const CORSAIR_BRAGI_POLLING_RATES = new Map([
|
|
|
65
81
|
/**
|
|
66
82
|
* Mice by the product id they report over the cable, which is also what a
|
|
67
83
|
* receiver returns for property 0x12 on their slot (ckb-next names receiver
|
|
68
|
-
* children this way). DPI range from iCUE's slider: the
|
|
69
|
-
* fit 100–18,000.
|
|
84
|
+
* children this way). The IRONCLAW's DPI range is from iCUE's slider: the
|
|
85
|
+
* captured values only fit 100–18,000. The SCIMITAR RGB ELITE's range was
|
|
86
|
+
* probed on the mouse: SET 100 and 18,000 are acked ok, 99 and 18,001 get
|
|
87
|
+
* status 1 (invalid value) and leave the old value in place.
|
|
70
88
|
*/
|
|
71
89
|
export const CORSAIR_BRAGI_MICE = new Map([
|
|
72
90
|
[0x1b4c, { name: "IRONCLAW RGB WIRELESS", dpiMin: 100, dpiMax: 18_000 }],
|
|
91
|
+
[0x1be3, {
|
|
92
|
+
name: "SCIMITAR RGB ELITE",
|
|
93
|
+
dpiMin: 100,
|
|
94
|
+
dpiMax: 18_000,
|
|
95
|
+
packetSize: 128,
|
|
96
|
+
commandUsage: 0x01,
|
|
97
|
+
extraProperties: ["brightness", "angleSnapping", "dpiStage"],
|
|
98
|
+
}],
|
|
73
99
|
]);
|
|
74
100
|
/**
|
|
75
101
|
* Receivers that relay to paired slots. 0x1bdc carried the ticket-0159
|
|
@@ -80,28 +106,67 @@ export const CORSAIR_BRAGI_RECEIVERS = new Map([
|
|
|
80
106
|
[0x1bdc, "SLIPSTREAM WIRELESS USB Receiver"],
|
|
81
107
|
]);
|
|
82
108
|
export const CORSAIR_BRAGI_PRODUCT_IDS = [...CORSAIR_BRAGI_MICE.keys(), ...CORSAIR_BRAGI_RECEIVERS.keys()];
|
|
83
|
-
/** A zero-padded
|
|
84
|
-
export function
|
|
109
|
+
/** A zero-padded request of `size` bytes (a mouse's `packetSize`). */
|
|
110
|
+
export function corsairBragiPacketOfSize(size, slot, command, property, ...value) {
|
|
85
111
|
if (!Number.isInteger(slot) || slot < 0 || slot > CORSAIR_BRAGI_MAX_SLOT) {
|
|
86
112
|
throw new Error(`Corsair Bragi slot must be 0–${CORSAIR_BRAGI_MAX_SLOT}.`);
|
|
87
113
|
}
|
|
88
|
-
|
|
114
|
+
if (!Number.isInteger(size) || size < 4 + value.length)
|
|
115
|
+
throw new Error("Corsair Bragi packet size is too small for the request.");
|
|
116
|
+
const packet = new Uint8Array(size);
|
|
89
117
|
packet.set([CORSAIR_BRAGI_MAGIC | slot, command, property, 0x00, ...value]);
|
|
90
118
|
return packet;
|
|
91
119
|
}
|
|
120
|
+
/** A zero-padded 64-byte request. */
|
|
121
|
+
export function corsairBragiPacket(slot, command, property, ...value) {
|
|
122
|
+
return corsairBragiPacketOfSize(CORSAIR_BRAGI_PACKET_SIZE, slot, command, property, ...value);
|
|
123
|
+
}
|
|
124
|
+
/** The Bragi polling property value for a rate in Hz, or null when the table has none. */
|
|
125
|
+
function pollingValue(hz) {
|
|
126
|
+
for (const [value, rate] of CORSAIR_BRAGI_POLLING_RATES)
|
|
127
|
+
if (rate === hz)
|
|
128
|
+
return value;
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Request encoders. `size` is the mouse's `packetSize` (default 64); pass 128 for the
|
|
133
|
+
* SCIMITAR RGB ELITE. The driver is read-only for now, so nothing here is sent by it:
|
|
134
|
+
* the SET layouts are tested against captures.
|
|
135
|
+
*/
|
|
92
136
|
export const corsairBragiEncode = {
|
|
93
|
-
get: (slot, property) =>
|
|
137
|
+
get: (slot, property, size = CORSAIR_BRAGI_PACKET_SIZE) => corsairBragiPacketOfSize(size, slot, CORSAIR_BRAGI_COMMAND.get, property),
|
|
94
138
|
/**
|
|
95
139
|
* One DPI axis. iCUE sends X then Y on every change and gets a bare ack
|
|
96
140
|
* (`01 01 00`) for each. Encoded here so the layout is tested against the
|
|
97
|
-
* capture; the read-only driver never sends it.
|
|
141
|
+
* capture; the read-only driver never sends it. The mouse itself rejects values
|
|
142
|
+
* outside its range with status 1 (SCIMITAR RGB ELITE: below 100 or above 18,000).
|
|
143
|
+
* The write is live and volatile: the SCIMITAR RGB ELITE forgot it on a replug.
|
|
98
144
|
*/
|
|
99
|
-
setDpi: (slot, axis, dpi) => {
|
|
145
|
+
setDpi: (slot, axis, dpi, size = CORSAIR_BRAGI_PACKET_SIZE) => {
|
|
100
146
|
if (!Number.isInteger(dpi) || dpi < 1 || dpi > 0xffff)
|
|
101
147
|
throw new Error("Corsair Bragi DPI must be an integer from 1 to 65535.");
|
|
102
148
|
const property = axis === "x" ? CORSAIR_BRAGI_PROPERTY.dpiX : CORSAIR_BRAGI_PROPERTY.dpiY;
|
|
103
|
-
return
|
|
149
|
+
return corsairBragiPacketOfSize(size, slot, CORSAIR_BRAGI_COMMAND.set, property, dpi & 0xff, dpi >> 8);
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Polling rate in Hz. The SCIMITAR RGB ELITE stores it and re-enumerates on USB
|
|
153
|
+
* right after the ack, so the read-back must wait for the device to return.
|
|
154
|
+
*/
|
|
155
|
+
setPollingRate: (slot, hz, size = CORSAIR_BRAGI_PACKET_SIZE) => {
|
|
156
|
+
const value = pollingValue(hz);
|
|
157
|
+
if (value === null)
|
|
158
|
+
throw new Error(`Corsair Bragi has no polling value for ${hz} Hz.`);
|
|
159
|
+
return corsairBragiPacketOfSize(size, slot, CORSAIR_BRAGI_COMMAND.set, CORSAIR_BRAGI_PROPERTY.pollingRate, value, 0x00);
|
|
160
|
+
},
|
|
161
|
+
/** Lighting brightness as a percentage, sent in tenths of a percent. Stored by the SCIMITAR RGB ELITE. */
|
|
162
|
+
setBrightness: (slot, percent, size = CORSAIR_BRAGI_PACKET_SIZE) => {
|
|
163
|
+
if (!Number.isFinite(percent) || percent < 0 || percent > 100)
|
|
164
|
+
throw new Error("Corsair Bragi brightness must be 0–100 %.");
|
|
165
|
+
const value = Math.round(percent * 10);
|
|
166
|
+
return corsairBragiPacketOfSize(size, slot, CORSAIR_BRAGI_COMMAND.set, CORSAIR_BRAGI_PROPERTY.brightness, value & 0xff, value >> 8);
|
|
104
167
|
},
|
|
168
|
+
/** Angle snapping on or off. Stored by the SCIMITAR RGB ELITE. */
|
|
169
|
+
setAngleSnapping: (slot, enabled, size = CORSAIR_BRAGI_PACKET_SIZE) => corsairBragiPacketOfSize(size, slot, CORSAIR_BRAGI_COMMAND.set, CORSAIR_BRAGI_PROPERTY.angleSnapping, enabled ? 1 : 0, 0x00),
|
|
105
170
|
};
|
|
106
171
|
/** True when `reply` answers `request`: same slot (low three bits) and the command echoed. */
|
|
107
172
|
export function corsairBragiIsReplyTo(request, reply) {
|
|
@@ -135,6 +200,10 @@ export const corsairBragiDecode = {
|
|
|
135
200
|
pollingRateHz: (value) => CORSAIR_BRAGI_POLLING_RATES.get(value) ?? null,
|
|
136
201
|
/** Tenths of a percent → percent. */
|
|
137
202
|
batteryPercent: (value) => (value <= 1000 ? Math.round(value / 10) : null),
|
|
203
|
+
/** Tenths of a percent → percent (SCIMITAR RGB ELITE brightness: 330 → 33). */
|
|
204
|
+
brightnessPercent: (value) => (value <= 1000 ? Math.round(value / 10) : null),
|
|
205
|
+
/** 0 off, 1 on; anything else is not a value this mouse has been seen to send. */
|
|
206
|
+
angleSnapping: (value) => (value === 1 ? true : value === 0 ? false : null),
|
|
138
207
|
/** ckb-next's battery enum: 1 charging, 2 discharging, 3 charged. */
|
|
139
208
|
batteryState: (value) => value === 1 ? "Charging" : value === 2 ? "Discharging" : value === 3 ? "Full" : "Unknown",
|
|
140
209
|
/** Connected receiver slots, ascending. Bit 0 is never a paired device. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bragi.js","sourceRoot":"","sources":["../../src/corsair/bragi.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bragi.js","sourceRoot":"","sources":["../../src/corsair/bragi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC/C,6GAA6G;AAC7G,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAC5C,mDAAmD;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,gEAAgE;IAChE,WAAW,EAAE,IAAI;IACjB,+HAA+H;IAC/H,UAAU,EAAE,IAAI;IAChB,6EAA6E;IAC7E,IAAI,EAAE,IAAI;IACV,4DAA4D;IAC5D,aAAa,EAAE,IAAI;IACnB,mCAAmC;IACnC,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,iDAAiD;IACjD,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV;;;;OAIG;IACH,QAAQ,EAAE,IAAI;IACd,mFAAmF;IACnF,KAAK,EAAE,IAAI;CACH,CAAC;AAEX,iFAAiF;AACjF,MAAM,CAAC,MAAM,oBAAoB,GAAG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