@openmouse/protocol 0.35.0 → 0.37.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 +2 -0
- package/dist/drivers/endgame/egg-ot-hid.d.ts +108 -0
- package/dist/drivers/endgame/egg-ot-hid.d.ts.map +1 -0
- package/dist/drivers/endgame/egg-ot-hid.js +407 -0
- package/dist/drivers/endgame/egg-ot-hid.js.map +1 -0
- package/dist/drivers/glorious/core2-hid.d.ts +6 -1
- package/dist/drivers/glorious/core2-hid.d.ts.map +1 -1
- package/dist/drivers/glorious/core2-hid.js +11 -3
- package/dist/drivers/glorious/core2-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 +5 -1
- package/dist/drivers/registry.js.map +1 -1
- package/dist/drivers/vendors.d.ts +4 -4
- package/dist/drivers/vendors.d.ts.map +1 -1
- package/dist/drivers/vendors.js +29 -8
- package/dist/drivers/vendors.js.map +1 -1
- package/dist/endgame-gear/op1.d.ts +14 -0
- package/dist/endgame-gear/op1.d.ts.map +1 -1
- package/dist/endgame-gear/op1.js +34 -0
- package/dist/endgame-gear/op1.js.map +1 -1
- package/dist/endgame-gear/ot.d.ts +318 -0
- package/dist/endgame-gear/ot.d.ts.map +1 -0
- package/dist/endgame-gear/ot.js +527 -0
- package/dist/endgame-gear/ot.js.map +1 -0
- package/dist/endgame-gear/wireless.d.ts +7 -0
- package/dist/endgame-gear/wireless.d.ts.map +1 -1
- package/dist/endgame-gear/wireless.js +3 -0
- package/dist/endgame-gear/wireless.js.map +1 -1
- package/dist/glorious-core2/index.d.ts.map +1 -1
- package/dist/glorious-core2/index.js +17 -0
- package/dist/glorious-core2/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/package.json +5 -1
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ checklist.
|
|
|
45
45
|
| Dareu | `@openmouse/protocol/dareu` |
|
|
46
46
|
| Delux M800 Mini / M600 Pro | `@openmouse/protocol/delux` |
|
|
47
47
|
| Endgame Gear OP1/XM2 8K | `@openmouse/protocol/endgame-gear-op1` |
|
|
48
|
+
| Endgame Gear XM1r/OP1/OP1 RGB | `@openmouse/protocol/endgame-gear-ot` |
|
|
48
49
|
| Endgame Gear wireless | `@openmouse/protocol/endgame-gear-we` |
|
|
49
50
|
| Fantech | `@openmouse/protocol/fantech` |
|
|
50
51
|
| Finalmouse | `@openmouse/protocol/finalmouse` |
|
|
@@ -52,6 +53,7 @@ checklist.
|
|
|
52
53
|
| GearHub (AJAZZ / Attack Shark / Lingbao) | `@openmouse/protocol/gearhub` |
|
|
53
54
|
| Glorious | `@openmouse/protocol/glorious` |
|
|
54
55
|
| Glorious classic (Model O/D/I) | `@openmouse/protocol/glorious-classic` |
|
|
56
|
+
| Glorious core2 (O2/D2 Pro 4K/8K) | `@openmouse/protocol/glorious-core2` |
|
|
55
57
|
| HyperX | `@openmouse/protocol/hyperx` |
|
|
56
58
|
| Incott | `@openmouse/protocol/incott` |
|
|
57
59
|
| K-snake | `@openmouse/protocol/ksnake` |
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { MouseStatus } from "../mouse-types.ts";
|
|
2
|
+
import { type OtButtonAction, type OtDeviceProfile } from "@openmouse/protocol/endgame-gear-ot";
|
|
3
|
+
export interface EggOtStatus extends MouseStatus {
|
|
4
|
+
otProfileIndex: number;
|
|
5
|
+
otProfileCount: number;
|
|
6
|
+
otProfileNames: string[];
|
|
7
|
+
otCpiStages: Array<{
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
active: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
otCpiMin: number;
|
|
13
|
+
otCpiMax: number;
|
|
14
|
+
otActiveCpiIndex: number;
|
|
15
|
+
otPollRates: number[];
|
|
16
|
+
otPollRateIndex: number;
|
|
17
|
+
otLodRaw: number;
|
|
18
|
+
otLodLabel: string | null;
|
|
19
|
+
otAngleSnapping: boolean;
|
|
20
|
+
otRippleControl: boolean;
|
|
21
|
+
otSlamClickFilter: boolean;
|
|
22
|
+
otMotionSyncResponsive: boolean;
|
|
23
|
+
otMotionSyncSmooth: boolean;
|
|
24
|
+
otSensitivityX: number;
|
|
25
|
+
otSensitivityY: number;
|
|
26
|
+
otAcceleration: number;
|
|
27
|
+
otJitterCorrection: number;
|
|
28
|
+
otLedStages: Array<{
|
|
29
|
+
r: number;
|
|
30
|
+
g: number;
|
|
31
|
+
b: number;
|
|
32
|
+
}>;
|
|
33
|
+
otButtonActions: OtButtonAction[];
|
|
34
|
+
otHasRgbEffect: boolean;
|
|
35
|
+
otRgbMode: number;
|
|
36
|
+
otRgbColor: {
|
|
37
|
+
r: number;
|
|
38
|
+
g: number;
|
|
39
|
+
b: number;
|
|
40
|
+
};
|
|
41
|
+
otRgbBrightness: number;
|
|
42
|
+
otRgbSpeed: number;
|
|
43
|
+
otBattery: {
|
|
44
|
+
level: number;
|
|
45
|
+
charging: boolean;
|
|
46
|
+
} | null;
|
|
47
|
+
otFirmwareRaw: number[] | null;
|
|
48
|
+
}
|
|
49
|
+
export declare const EGG_OT_BUTTON_NAMES: readonly ["Left", "Right", "Middle", "Forward", "Back", "Wheel Up", "Wheel Down"];
|
|
50
|
+
export type EggOtButtonIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
51
|
+
export interface EggOtFlashProgress {
|
|
52
|
+
fraction: number;
|
|
53
|
+
packet: number;
|
|
54
|
+
packets: number;
|
|
55
|
+
}
|
|
56
|
+
export declare class EggOtHidClient {
|
|
57
|
+
private chain;
|
|
58
|
+
private firmwareRaw;
|
|
59
|
+
private packetPayloadLength;
|
|
60
|
+
readonly device: HIDDevice;
|
|
61
|
+
readonly profile: OtDeviceProfile;
|
|
62
|
+
constructor(device: HIDDevice);
|
|
63
|
+
static isSupported(device: HIDDevice): boolean;
|
|
64
|
+
private static collectionHasFeatureReport;
|
|
65
|
+
open(): Promise<void>;
|
|
66
|
+
close(): Promise<void>;
|
|
67
|
+
describeCollections(): string;
|
|
68
|
+
getDpiOptions(): number[];
|
|
69
|
+
readStatus(): Promise<EggOtStatus>;
|
|
70
|
+
setDpi(dpi: number): Promise<number>;
|
|
71
|
+
setCpiStage(level: number, x: number, y: number): Promise<void>;
|
|
72
|
+
setPollingRate(rate: number): Promise<number>;
|
|
73
|
+
setLiftOffDistance(value: NonNullable<MouseStatus["liftOffDistance"]>): Promise<void>;
|
|
74
|
+
setProcessingFlag(flag: number, enabled: boolean, label: string): Promise<void>;
|
|
75
|
+
setAngleSnapping(enabled: boolean): Promise<void>;
|
|
76
|
+
setRippleControl(enabled: boolean): Promise<void>;
|
|
77
|
+
setSlamClickFilter(enabled: boolean): Promise<void>;
|
|
78
|
+
setMotionSyncResponsive(enabled: boolean): Promise<void>;
|
|
79
|
+
setMotionSyncSmooth(enabled: boolean): Promise<void>;
|
|
80
|
+
buttonLabels(): string[];
|
|
81
|
+
decodeButtonAction(slot: number, value: number): OtButtonAction;
|
|
82
|
+
buttonActionLabel(action: OtButtonAction): string;
|
|
83
|
+
/**
|
|
84
|
+
* Vendor firmware flash, byte-for-byte from Custom_HID_Update_Firmware:
|
|
85
|
+
* DlSetup, 2 s settle, indexed data packets with progress. The caller must
|
|
86
|
+
* invoke resetFirmware() afterwards as a separate, deliberate step, exactly
|
|
87
|
+
* like the vendor tool. Never exercised on hardware.
|
|
88
|
+
*/
|
|
89
|
+
flashFirmware(image: Uint8Array, version: {
|
|
90
|
+
major: number;
|
|
91
|
+
minor: number;
|
|
92
|
+
build: number;
|
|
93
|
+
}, onProgress?: (progress: EggOtFlashProgress) => void): Promise<void>;
|
|
94
|
+
/** Vendor reset magic (kComResetFirmware + 0x0BADF00D). Reboots the mouse. */
|
|
95
|
+
resetFirmware(): Promise<void>;
|
|
96
|
+
queryFirmwareRaw(): Promise<number[] | null>;
|
|
97
|
+
private loadProfile;
|
|
98
|
+
private queryBlock;
|
|
99
|
+
private updateProfile;
|
|
100
|
+
private sendPacket;
|
|
101
|
+
private exchange;
|
|
102
|
+
private receivePacket;
|
|
103
|
+
private featurePayloadLength;
|
|
104
|
+
private assertCpi;
|
|
105
|
+
private run;
|
|
106
|
+
private delay;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=egg-ot-hid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egg-ot-hid.d.ts","sourceRoot":"","sources":["../../../src/drivers/endgame/egg-ot-hid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAiCL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGrB,MAAM,qCAAqC,CAAC;AAE7C,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sBAAsB,EAAE,OAAO,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,E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,CACjB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EACxD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,GAClD,OAAO,CAAC,IAAI,CAAC;IAiBhB,8EAA8E;IACxE,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAO9B,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;YAWpC,WAAW;YAgBX,UAAU;YAMV,aAAa;YAyBb,UAAU;YAoCV,QAAQ;YA4BR,aAAa;IAY3B,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,GAAG;IAMX,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { OT_COMTYPE, OT_CPI_COUNT, OT_DEVICE_PROFILES, OT_PACKET_SIZE, OT_PAYLOAD_INDEX, OT_POLLING_RATES, OT_POLL_RATE_HZ, OT_PROFILE_BLOCK, OT_PROFILE_FLAG, OT_READ_RETRIES, OT_REPORT_ID, OT_VENDOR_ID, OT_WRITE_RETRIES, otCpiStep, otDecodeButtonRemap, otDecodeEffect, otEncodeEffect, otEncodeFirmwarePacket, otEncodeFirmwareReset, otEncodeFirmwareSetup, otEncodeProfilePackets, otEncodeQueryPacket, otFirmwarePackets, otIsValidCpi, otLodLabel, otLodRaw, otNormalizeFeatureReport, otParseWirelessTelemetry, otPollRateHz, otProfileBlocks, otProfileForPid, otReassembleEffect, } from "@openmouse/protocol/endgame-gear-ot";
|
|
2
|
+
export const EGG_OT_BUTTON_NAMES = ["Left", "Right", "Middle", "Forward", "Back", "Wheel Up", "Wheel Down"];
|
|
3
|
+
const OT_BUTTON_LABELS = ["Left Click", "Right Click", "Middle Click", "Back", "Forward", "Wheel Up", "Wheel Down"];
|
|
4
|
+
export class EggOtHidClient {
|
|
5
|
+
chain = Promise.resolve();
|
|
6
|
+
firmwareRaw;
|
|
7
|
+
packetPayloadLength = OT_PACKET_SIZE - 1;
|
|
8
|
+
device;
|
|
9
|
+
profile;
|
|
10
|
+
constructor(device) {
|
|
11
|
+
this.device = device;
|
|
12
|
+
this.profile = otProfileForPid(device.productId);
|
|
13
|
+
}
|
|
14
|
+
static isSupported(device) {
|
|
15
|
+
return device.vendorId === OT_VENDOR_ID
|
|
16
|
+
&& OT_DEVICE_PROFILES.has(device.productId)
|
|
17
|
+
&& this.collectionHasFeatureReport(device.collections, OT_REPORT_ID);
|
|
18
|
+
}
|
|
19
|
+
static collectionHasFeatureReport(collections, reportId) {
|
|
20
|
+
return (collections ?? []).some((collection) => (collection.featureReports ?? []).some((report) => report.reportId === reportId)
|
|
21
|
+
|| this.collectionHasFeatureReport(collection.children ?? [], reportId));
|
|
22
|
+
}
|
|
23
|
+
async open() {
|
|
24
|
+
if (!this.device.opened)
|
|
25
|
+
await this.device.open();
|
|
26
|
+
this.packetPayloadLength = this.featurePayloadLength(OT_REPORT_ID, OT_PACKET_SIZE - 1);
|
|
27
|
+
}
|
|
28
|
+
async close() {
|
|
29
|
+
if (this.device.opened)
|
|
30
|
+
await this.device.close();
|
|
31
|
+
}
|
|
32
|
+
describeCollections() {
|
|
33
|
+
return (this.device.collections ?? []).map((collection) => {
|
|
34
|
+
const reports = (collection.featureReports ?? []).map((report) => `0x${report.reportId.toString(16)}`);
|
|
35
|
+
return `usage 0x${collection.usagePage.toString(16)}:0x${collection.usage.toString(16)} · feature ${reports.join(", ") || "none"}`;
|
|
36
|
+
}).join(" | ") || "No HID collections reported";
|
|
37
|
+
}
|
|
38
|
+
getDpiOptions() {
|
|
39
|
+
const values = [];
|
|
40
|
+
for (let cpi = 50; cpi <= this.profile.maxCpi;) {
|
|
41
|
+
values.push(cpi);
|
|
42
|
+
const step = otCpiStep(cpi + 1);
|
|
43
|
+
cpi += step;
|
|
44
|
+
}
|
|
45
|
+
return values;
|
|
46
|
+
}
|
|
47
|
+
async readStatus() {
|
|
48
|
+
const { effect, telemetry } = await this.run(() => this.loadProfile(0));
|
|
49
|
+
// queryFirmwareRaw serializes itself; wrapping it in run() would deadlock the chain.
|
|
50
|
+
if (this.firmwareRaw === undefined) {
|
|
51
|
+
this.firmwareRaw = await this.queryFirmwareRaw().catch(() => null);
|
|
52
|
+
}
|
|
53
|
+
const activeCpi = effect.cpi[effect.cpiIndex] ?? 800;
|
|
54
|
+
const activeY = effect.cpiY[effect.cpiIndex] ?? activeCpi;
|
|
55
|
+
const pollHz = otPollRateHz(effect.pollrateIndex) ?? otPollRateHz(effect.pollRates[effect.pollrateIndex] ?? -1);
|
|
56
|
+
if (pollHz === null)
|
|
57
|
+
throw new Error(`The mouse reported an unknown poll-rate index ${effect.pollrateIndex}.`);
|
|
58
|
+
const lodLabel = otLodLabel(effect.dcuThreshold);
|
|
59
|
+
const flags = effect.profileFlags;
|
|
60
|
+
const buttonActions = effect.buttonRemap.map((value, slot) => otDecodeButtonRemap(slot, value));
|
|
61
|
+
return {
|
|
62
|
+
brand: "Endgame Gear",
|
|
63
|
+
name: this.profile.name,
|
|
64
|
+
batteryPercent: null,
|
|
65
|
+
batteryState: "Unknown",
|
|
66
|
+
dpi: activeCpi,
|
|
67
|
+
dpiY: activeY,
|
|
68
|
+
supportsSeparateDpiAxes: true,
|
|
69
|
+
pollingRateHz: pollHz,
|
|
70
|
+
supportedPollingRates: [...OT_POLLING_RATES],
|
|
71
|
+
activeProfile: effect.activeProfile,
|
|
72
|
+
profileCount: Math.max(effect.maxProfile, 1),
|
|
73
|
+
profileNames: effect.profileName ? [effect.profileName] : [],
|
|
74
|
+
connectionType: "Wired",
|
|
75
|
+
connectionDetail: `Wired USB - PID 0x${this.device.productId.toString(16).toUpperCase()} - ${this.profile.sensorFamily.toUpperCase()}`,
|
|
76
|
+
motionSync: (flags & (OT_PROFILE_FLAG.motionSyncResponsive | OT_PROFILE_FLAG.motionSyncSmooth)) !== 0,
|
|
77
|
+
angleSnapping: (flags & OT_PROFILE_FLAG.angleSnapping) !== 0,
|
|
78
|
+
rippleControl: (flags & OT_PROFILE_FLAG.rippleControl) !== 0,
|
|
79
|
+
slamclickFilter: (flags & OT_PROFILE_FLAG.slamClickFilter) !== 0,
|
|
80
|
+
liftOffDistance: lodLabel === "1 mm" ? "Medium" : lodLabel === "2 mm" ? "High" : null,
|
|
81
|
+
firmware: [],
|
|
82
|
+
ui: {
|
|
83
|
+
family: "egg-ot",
|
|
84
|
+
defaultDisplayName: this.profile.name,
|
|
85
|
+
hideSleepCard: true,
|
|
86
|
+
},
|
|
87
|
+
otProfileIndex: effect.profileIndex,
|
|
88
|
+
otProfileCount: Math.max(effect.maxProfile, 1),
|
|
89
|
+
otProfileNames: effect.profileName ? [effect.profileName] : [],
|
|
90
|
+
otCpiStages: effect.cpi.map((x, i) => ({
|
|
91
|
+
x,
|
|
92
|
+
y: effect.cpiY[i] ?? x,
|
|
93
|
+
// Selected stage. The vendor tool instead marks stages whose value
|
|
94
|
+
// is not 50-aligned; that readback quirk is not mirrored here.
|
|
95
|
+
active: i === effect.cpiIndex,
|
|
96
|
+
})),
|
|
97
|
+
otCpiMin: 50,
|
|
98
|
+
otCpiMax: this.profile.maxCpi,
|
|
99
|
+
otActiveCpiIndex: effect.cpiIndex,
|
|
100
|
+
otPollRates: [...effect.pollRates],
|
|
101
|
+
otPollRateIndex: effect.pollrateIndex,
|
|
102
|
+
otLodRaw: effect.dcuThreshold,
|
|
103
|
+
otLodLabel: lodLabel,
|
|
104
|
+
otAngleSnapping: (flags & OT_PROFILE_FLAG.angleSnapping) !== 0,
|
|
105
|
+
otRippleControl: (flags & OT_PROFILE_FLAG.rippleControl) !== 0,
|
|
106
|
+
otSlamClickFilter: (flags & OT_PROFILE_FLAG.slamClickFilter) !== 0,
|
|
107
|
+
otMotionSyncResponsive: (flags & OT_PROFILE_FLAG.motionSyncResponsive) !== 0,
|
|
108
|
+
otMotionSyncSmooth: (flags & OT_PROFILE_FLAG.motionSyncSmooth) !== 0,
|
|
109
|
+
otSensitivityX: effect.sensitivityX,
|
|
110
|
+
otSensitivityY: effect.sensitivityY,
|
|
111
|
+
otAcceleration: effect.acceleration,
|
|
112
|
+
otJitterCorrection: effect.jitterCorrection,
|
|
113
|
+
otLedStages: effect.red.map((r, i) => ({
|
|
114
|
+
r,
|
|
115
|
+
g: effect.green[i] ?? 0,
|
|
116
|
+
b: effect.blue[i] ?? 0,
|
|
117
|
+
})),
|
|
118
|
+
otButtonActions: buttonActions,
|
|
119
|
+
otHasRgbEffect: this.profile.hasRgbEffect,
|
|
120
|
+
otRgbMode: effect.rgbMode,
|
|
121
|
+
otRgbColor: { r: effect.rgbRed, g: effect.rgbGreen, b: effect.rgbBlue },
|
|
122
|
+
otRgbBrightness: effect.rgbBrightness,
|
|
123
|
+
otRgbSpeed: effect.rgbSpeed,
|
|
124
|
+
otBattery: telemetry ? { level: telemetry.batteryLevel, charging: telemetry.charging } : null,
|
|
125
|
+
otFirmwareRaw: this.firmwareRaw,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async setDpi(dpi) {
|
|
129
|
+
this.assertCpi(dpi);
|
|
130
|
+
const confirmed = await this.updateProfile(0, (effect) => {
|
|
131
|
+
for (let i = 0; i < OT_CPI_COUNT; i += 1) {
|
|
132
|
+
effect.cpi[i] = dpi;
|
|
133
|
+
effect.cpiY[i] = dpi;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const back = confirmed.cpi[confirmed.cpiIndex] ?? -1;
|
|
137
|
+
if (back !== dpi)
|
|
138
|
+
throw new Error(`The mouse kept CPI stage at ${back} instead of ${dpi}.`);
|
|
139
|
+
return dpi;
|
|
140
|
+
}
|
|
141
|
+
async setCpiStage(level, x, y) {
|
|
142
|
+
if (!Number.isInteger(level) || level < 0 || level >= OT_CPI_COUNT)
|
|
143
|
+
throw new Error("Invalid CPI stage.");
|
|
144
|
+
this.assertCpi(x);
|
|
145
|
+
this.assertCpi(y);
|
|
146
|
+
const confirmed = await this.updateProfile(0, (effect) => {
|
|
147
|
+
effect.cpi[level] = x;
|
|
148
|
+
effect.cpiY[level] = y;
|
|
149
|
+
});
|
|
150
|
+
if (confirmed.cpi[level] !== x || confirmed.cpiY[level] !== y) {
|
|
151
|
+
throw new Error(`The mouse did not confirm CPI stage ${level + 1}.`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async setPollingRate(rate) {
|
|
155
|
+
const target = [...OT_POLL_RATE_HZ.entries()].find(([, hz]) => hz === rate)?.[0];
|
|
156
|
+
if (target === undefined)
|
|
157
|
+
throw new Error("Unsupported OT polling rate.");
|
|
158
|
+
const confirmed = await this.updateProfile(0, (effect) => {
|
|
159
|
+
effect.pollrateIndex = target;
|
|
160
|
+
});
|
|
161
|
+
const back = otPollRateHz(confirmed.pollrateIndex);
|
|
162
|
+
if (back !== rate)
|
|
163
|
+
throw new Error(`The mouse kept ${back ?? "?"} Hz instead of ${rate} Hz.`);
|
|
164
|
+
return rate;
|
|
165
|
+
}
|
|
166
|
+
async setLiftOffDistance(value) {
|
|
167
|
+
const raw = value === "Medium" ? otLodRaw("1 mm") : value === "High" ? otLodRaw("2 mm") : null;
|
|
168
|
+
if (raw === null)
|
|
169
|
+
throw new Error(`${this.profile.name} exposes only 1 mm and 2 mm lift-off distances.`);
|
|
170
|
+
const confirmed = await this.updateProfile(0, (effect) => {
|
|
171
|
+
effect.dcuThreshold = raw;
|
|
172
|
+
});
|
|
173
|
+
if (confirmed.dcuThreshold !== raw)
|
|
174
|
+
throw new Error("The mouse did not confirm the lift-off distance.");
|
|
175
|
+
}
|
|
176
|
+
async setProcessingFlag(flag, enabled, label) {
|
|
177
|
+
const confirmed = await this.updateProfile(0, (effect) => {
|
|
178
|
+
effect.profileFlags = enabled ? effect.profileFlags | flag : effect.profileFlags & ~flag;
|
|
179
|
+
});
|
|
180
|
+
if (((confirmed.profileFlags & flag) !== 0) !== enabled) {
|
|
181
|
+
throw new Error(`The mouse did not confirm ${label}.`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async setAngleSnapping(enabled) {
|
|
185
|
+
await this.setProcessingFlag(OT_PROFILE_FLAG.angleSnapping, enabled, "angle snapping");
|
|
186
|
+
}
|
|
187
|
+
async setRippleControl(enabled) {
|
|
188
|
+
await this.setProcessingFlag(OT_PROFILE_FLAG.rippleControl, enabled, "ripple control");
|
|
189
|
+
}
|
|
190
|
+
async setSlamClickFilter(enabled) {
|
|
191
|
+
await this.setProcessingFlag(OT_PROFILE_FLAG.slamClickFilter, enabled, "slam-click filter");
|
|
192
|
+
}
|
|
193
|
+
async setMotionSyncResponsive(enabled) {
|
|
194
|
+
await this.setProcessingFlag(OT_PROFILE_FLAG.motionSyncResponsive, enabled, "responsive Motion Sync");
|
|
195
|
+
}
|
|
196
|
+
async setMotionSyncSmooth(enabled) {
|
|
197
|
+
await this.setProcessingFlag(OT_PROFILE_FLAG.motionSyncSmooth, enabled, "smooth Motion Sync");
|
|
198
|
+
}
|
|
199
|
+
buttonLabels() {
|
|
200
|
+
return [...EGG_OT_BUTTON_NAMES];
|
|
201
|
+
}
|
|
202
|
+
decodeButtonAction(slot, value) {
|
|
203
|
+
return otDecodeButtonRemap(slot, value);
|
|
204
|
+
}
|
|
205
|
+
buttonActionLabel(action) {
|
|
206
|
+
switch (action.key) {
|
|
207
|
+
case "mouse": {
|
|
208
|
+
const label = OT_BUTTON_LABELS[(action.eventId ?? 1) - 1];
|
|
209
|
+
return label ?? `Mouse button ${action.eventId}`;
|
|
210
|
+
}
|
|
211
|
+
case "cpi-loop": return "CPI Loop";
|
|
212
|
+
case "cpi-plus": return "CPI +";
|
|
213
|
+
case "cpi-minus": return "CPI −";
|
|
214
|
+
case "cpi-custom": return `CPI stage ${action.eventId}`;
|
|
215
|
+
case "keyboard": return action.usage ? `Keyboard HID 0x${action.usage.toString(16)}` : "Keyboard (unassigned)";
|
|
216
|
+
case "disabled": return "Disabled";
|
|
217
|
+
case "raw": return `Raw event ${action.eventId}`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Vendor firmware flash, byte-for-byte from Custom_HID_Update_Firmware:
|
|
222
|
+
* DlSetup, 2 s settle, indexed data packets with progress. The caller must
|
|
223
|
+
* invoke resetFirmware() afterwards as a separate, deliberate step, exactly
|
|
224
|
+
* like the vendor tool. Never exercised on hardware.
|
|
225
|
+
*/
|
|
226
|
+
async flashFirmware(image, version, onProgress) {
|
|
227
|
+
await this.run(async () => {
|
|
228
|
+
await this.open();
|
|
229
|
+
const { setup, chunks } = otFirmwarePackets(image);
|
|
230
|
+
setup.major = version.major;
|
|
231
|
+
setup.minor = version.minor;
|
|
232
|
+
setup.build = version.build;
|
|
233
|
+
await this.sendPacket(otEncodeFirmwareSetup(setup));
|
|
234
|
+
await this.delay(2000);
|
|
235
|
+
for (let index = 0; index < chunks.length; index += 1) {
|
|
236
|
+
await this.sendPacket(otEncodeFirmwarePacket(index, chunks[index]));
|
|
237
|
+
onProgress?.({ fraction: (10 + (index / chunks.length) * 90) / 100, packet: index, packets: chunks.length });
|
|
238
|
+
await this.delay(5);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
/** Vendor reset magic (kComResetFirmware + 0x0BADF00D). Reboots the mouse. */
|
|
243
|
+
async resetFirmware() {
|
|
244
|
+
await this.run(async () => {
|
|
245
|
+
await this.open();
|
|
246
|
+
await this.sendPacket(otEncodeFirmwareReset());
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
async queryFirmwareRaw() {
|
|
250
|
+
return this.run(async () => {
|
|
251
|
+
await this.open();
|
|
252
|
+
const packet = new Uint8Array(OT_PACKET_SIZE);
|
|
253
|
+
packet[1] = OT_COMTYPE.queryFirmwareVersion;
|
|
254
|
+
const reply = await this.exchange(packet, true);
|
|
255
|
+
if (!reply)
|
|
256
|
+
return null;
|
|
257
|
+
return Array.from(reply.subarray(OT_PAYLOAD_INDEX));
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
async loadProfile(profileIndex) {
|
|
261
|
+
await this.open();
|
|
262
|
+
const replies = new Map();
|
|
263
|
+
// Main block first like the vendor loader (it carries the profile count).
|
|
264
|
+
const blocks = otProfileBlocks().sort((a, b) => (a.block === OT_PROFILE_BLOCK.main ? -1 : a.block) - (b.block === OT_PROFILE_BLOCK.main ? -1 : b.block));
|
|
265
|
+
for (const { block } of blocks) {
|
|
266
|
+
const reply = await this.queryBlock(block, profileIndex);
|
|
267
|
+
replies.set(block, reply);
|
|
268
|
+
}
|
|
269
|
+
const effect = otDecodeEffect(otReassembleEffect(replies));
|
|
270
|
+
const wirelessReply = replies.get(OT_PROFILE_BLOCK.wireless);
|
|
271
|
+
const telemetry = wirelessReply && wirelessReply.length > 8 ? otParseWirelessTelemetry(wirelessReply) : null;
|
|
272
|
+
return { effect, telemetry };
|
|
273
|
+
}
|
|
274
|
+
async queryBlock(block, profileIndex) {
|
|
275
|
+
const reply = await this.exchange(otEncodeQueryPacket(block, profileIndex), true);
|
|
276
|
+
if (!reply)
|
|
277
|
+
throw new Error(`The mouse did not answer OT profile block ${block}.`);
|
|
278
|
+
return reply.subarray(OT_PAYLOAD_INDEX);
|
|
279
|
+
}
|
|
280
|
+
async updateProfile(profileIndex, change) {
|
|
281
|
+
return this.run(async () => {
|
|
282
|
+
const { effect } = await this.loadProfile(profileIndex);
|
|
283
|
+
const patched = {
|
|
284
|
+
...effect,
|
|
285
|
+
cpi: [...effect.cpi],
|
|
286
|
+
cpiY: [...effect.cpiY],
|
|
287
|
+
pollRates: [...effect.pollRates],
|
|
288
|
+
red: [...effect.red],
|
|
289
|
+
green: [...effect.green],
|
|
290
|
+
blue: [...effect.blue],
|
|
291
|
+
buttonRemap: [...effect.buttonRemap],
|
|
292
|
+
hidUsage: [...effect.hidUsage],
|
|
293
|
+
modifier: [...effect.modifier],
|
|
294
|
+
};
|
|
295
|
+
change(patched);
|
|
296
|
+
const bytes = otEncodeEffect(patched);
|
|
297
|
+
for (const packet of otEncodeProfilePackets(bytes)) {
|
|
298
|
+
await this.sendPacket(packet);
|
|
299
|
+
}
|
|
300
|
+
const { effect: confirmed } = await this.loadProfile(profileIndex);
|
|
301
|
+
return confirmed;
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
async sendPacket(packet) {
|
|
305
|
+
await this.open();
|
|
306
|
+
let writeCounter = 0;
|
|
307
|
+
let readCounter = 0;
|
|
308
|
+
let receivedAck = false;
|
|
309
|
+
const payload = Uint8Array.from(packet.subarray(1, 1 + this.packetPayloadLength));
|
|
310
|
+
const expectResponse = packet[1] !== OT_COMTYPE.setProfileData
|
|
311
|
+
&& packet[1] !== OT_COMTYPE.firmwareDlSetup
|
|
312
|
+
&& packet[1] !== OT_COMTYPE.firmwareDataPacket
|
|
313
|
+
&& packet[1] !== OT_COMTYPE.resetFirmware;
|
|
314
|
+
while (writeCounter++ < OT_WRITE_RETRIES) {
|
|
315
|
+
const sent = (await this.device.sendFeatureReport(OT_REPORT_ID, payload));
|
|
316
|
+
// WebHID resolves void on success; node-hid style fakes resolve a byte count.
|
|
317
|
+
if (typeof sent === "number" && sent <= 0)
|
|
318
|
+
continue;
|
|
319
|
+
{
|
|
320
|
+
while (readCounter++ < OT_READ_RETRIES) {
|
|
321
|
+
const reply = await this.receivePacket();
|
|
322
|
+
if (reply[1] !== 0x00) {
|
|
323
|
+
if (expectResponse) {
|
|
324
|
+
if (reply[1] === OT_COMTYPE.ack) {
|
|
325
|
+
receivedAck = true;
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (receivedAck)
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
else if (reply[1] === OT_COMTYPE.ack || reply[1] === OT_COMTYPE.response) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
throw new Error("The Endgame Gear OT mouse did not acknowledge the packet.");
|
|
339
|
+
}
|
|
340
|
+
async exchange(packet, expectResponse) {
|
|
341
|
+
await this.open();
|
|
342
|
+
const payload = Uint8Array.from(packet.subarray(1, 1 + this.packetPayloadLength));
|
|
343
|
+
let writeCounter = 0;
|
|
344
|
+
while (writeCounter++ < OT_WRITE_RETRIES) {
|
|
345
|
+
const sent = (await this.device.sendFeatureReport(OT_REPORT_ID, payload));
|
|
346
|
+
if (typeof sent === "number" && sent <= 0)
|
|
347
|
+
continue;
|
|
348
|
+
let readCounter = 0;
|
|
349
|
+
let receivedAck = false;
|
|
350
|
+
while (readCounter++ < OT_READ_RETRIES) {
|
|
351
|
+
const reply = await this.receivePacket();
|
|
352
|
+
if (reply[1] === 0x00)
|
|
353
|
+
continue;
|
|
354
|
+
if (expectResponse) {
|
|
355
|
+
if (reply[1] === OT_COMTYPE.ack) {
|
|
356
|
+
receivedAck = true;
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (receivedAck)
|
|
360
|
+
return reply;
|
|
361
|
+
}
|
|
362
|
+
else if (reply[1] === OT_COMTYPE.ack || reply[1] === OT_COMTYPE.response) {
|
|
363
|
+
return reply;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
async receivePacket() {
|
|
370
|
+
const view = await Promise.race([
|
|
371
|
+
this.device.receiveFeatureReport(OT_REPORT_ID),
|
|
372
|
+
new Promise((_, reject) => window.setTimeout(() => reject(new Error("OT feature read timed out")), 3000)),
|
|
373
|
+
]);
|
|
374
|
+
const raw = new Uint8Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength));
|
|
375
|
+
return otNormalizeFeatureReport(raw);
|
|
376
|
+
}
|
|
377
|
+
featurePayloadLength(reportId, fallback) {
|
|
378
|
+
const reports = [];
|
|
379
|
+
const collect = (collections) => {
|
|
380
|
+
for (const collection of collections ?? []) {
|
|
381
|
+
reports.push(...(collection.featureReports ?? []).filter((report) => report.reportId === reportId));
|
|
382
|
+
collect(collection.children ?? []);
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
collect(this.device.collections ?? []);
|
|
386
|
+
for (const report of reports) {
|
|
387
|
+
const bits = (report.items ?? []).reduce((sum, item) => sum + item.reportSize * item.reportCount, 0);
|
|
388
|
+
if (bits > 0)
|
|
389
|
+
return Math.ceil(bits / 8);
|
|
390
|
+
}
|
|
391
|
+
return fallback;
|
|
392
|
+
}
|
|
393
|
+
assertCpi(value) {
|
|
394
|
+
if (!otIsValidCpi(this.profile, value)) {
|
|
395
|
+
throw new Error(`${this.profile.name} CPI must be 50 to ${this.profile.maxCpi.toLocaleString()} in 50 CPI steps (100 above 10,000).`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
run(operation) {
|
|
399
|
+
const pending = this.chain.then(operation, operation);
|
|
400
|
+
this.chain = pending.catch(() => undefined);
|
|
401
|
+
return pending;
|
|
402
|
+
}
|
|
403
|
+
delay(milliseconds) {
|
|
404
|
+
return new Promise((resolve) => window.setTimeout(resolve, milliseconds));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=egg-ot-hid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egg-ot-hid.js","sourceRoot":"","sources":["../../../src/drivers/endgame/egg-ot-hid.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,wBAAwB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OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,KAAK,CAAC,YAAoB;QAChC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
|
@@ -46,7 +46,12 @@ export declare class GloriousCore2HidClient {
|
|
|
46
46
|
private readFirmware;
|
|
47
47
|
private readBattery;
|
|
48
48
|
private getUiHints;
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* One key per model, not per product id: the cable and the receiver reach
|
|
51
|
+
* the same mouse and the same profiles — but O2 Pro and D2 Pro must NOT
|
|
52
|
+
* share: a DPI edit on one would otherwise load the other's stage table
|
|
53
|
+
* and write it to the connected mouse.
|
|
54
|
+
*/
|
|
50
55
|
private storageKey;
|
|
51
56
|
private loadProfile;
|
|
52
57
|
private saveProfile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core2-hid.d.ts","sourceRoot":"","sources":["../../../src/drivers/glorious/core2-hid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"core2-hid.d.ts","sourceRoot":"","sources":["../../../src/drivers/glorious/core2-hid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AA0GnE,qBAAa,sBAAsB;IACjC,IAAI,cAAc,IAAI,MAAM,CAAmB;IAC/C,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,uGAAuG;IACvG,OAAO,CAAC,KAAK,CAAuC;gBAExC,MAAM,EAAE,SAAS;IAI7B,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO;IAM9C,yHAAyH;IACzH,OA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Z,WAAW;IAKzB,OAAO,CAAC,UAAU;IAuBlB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,SAAS;IAsBjB,OAAO,CAAC,SAAS;CAOlB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { GLORIOUS_CORE2_DEBOUNCE_DEFAULT_MS, GLORIOUS_CORE2_DEBOUNCE_MAX_MS, GLORIOUS_CORE2_DEBOUNCE_MIN_MS, GLORIOUS_CORE2_DEBOUNCE_STEP_MS, GLORIOUS_CORE2_DPI_MAX, GLORIOUS_CORE2_DPI_MIN, GLORIOUS_CORE2_DPI_STEP, GLORIOUS_CORE2_FRAME_LENGTH, GLORIOUS_CORE2_MAX_DPI_STAGES, GLORIOUS_CORE2_POLLING_CODES, GLORIOUS_CORE2_PRODUCTS, GLORIOUS_CORE2_PROFILE_COUNT, GLORIOUS_CORE2_PROFILE_DEFAULT, GLORIOUS_CORE2_REPORT_ID, GLORIOUS_CORE2_USAGE_PAGE, GLORIOUS_CORE2_VENDOR_ID, GLORIOUS_CORE2_WIRELESS_MAX_POLLING_HZ, decodeGloriousCore2Battery, decodeGloriousCore2Firmware, encodeGloriousCore2ActiveDpiStage, encodeGloriousCore2BatteryRequest, encodeGloriousCore2Debounce, encodeGloriousCore2DpiColors, encodeGloriousCore2DpiStages, encodeGloriousCore2FirmwareRequest, encodeGloriousCore2MotionSync, encodeGloriousCore2PollingRate, encodeGloriousCore2Profile, } from "../../glorious-core2/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Driver for the Glorious Model O 2 PRO 4K/8K, wired (0x258a:0x201b) and
|
|
4
|
-
* through its 2.4 GHz receiver (0x2035)
|
|
4
|
+
* through its 2.4 GHz receiver (0x2035), and the Model D 2 PRO 4K/8K
|
|
5
|
+
* (0x258a:0x201c / 0x2036) — CORE drives both through one handler with
|
|
6
|
+
* identical ranges. Frames follow Glorious CORE's own
|
|
5
7
|
* traffic and code, see ../../glorious-core2/index.ts and
|
|
6
8
|
* captures/glorious-o2-pro-4k8k-wired/.
|
|
7
9
|
*
|
|
@@ -286,9 +288,15 @@ export class GloriousCore2HidClient {
|
|
|
286
288
|
},
|
|
287
289
|
};
|
|
288
290
|
}
|
|
289
|
-
/**
|
|
291
|
+
/**
|
|
292
|
+
* One key per model, not per product id: the cable and the receiver reach
|
|
293
|
+
* the same mouse and the same profiles — but O2 Pro and D2 Pro must NOT
|
|
294
|
+
* share: a DPI edit on one would otherwise load the other's stage table
|
|
295
|
+
* and write it to the connected mouse.
|
|
296
|
+
*/
|
|
290
297
|
storageKey(suffix) {
|
|
291
|
-
|
|
298
|
+
const family = this.device.productId === 0x201c || this.device.productId === 0x2036 ? "d2-pro-4k8k" : "o2-pro-4k8k";
|
|
299
|
+
return `openmouse-glorious-core2-v1:${family}:${suffix}`;
|
|
292
300
|
}
|
|
293
301
|
loadProfile() {
|
|
294
302
|
try {
|