@openmouse/protocol 0.22.0 → 0.23.1
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/coolermaster/index.d.ts +166 -0
- package/dist/coolermaster/index.d.ts.map +1 -0
- package/dist/coolermaster/index.js +475 -0
- package/dist/coolermaster/index.js.map +1 -0
- package/dist/drivers/attackshark/hid.d.ts +9 -2
- package/dist/drivers/attackshark/hid.d.ts.map +1 -1
- package/dist/drivers/attackshark/hid.js +81 -12
- package/dist/drivers/attackshark/hid.js.map +1 -1
- package/dist/drivers/coolermaster/hid.d.ts +39 -0
- package/dist/drivers/coolermaster/hid.d.ts.map +1 -0
- package/dist/drivers/coolermaster/hid.js +476 -0
- package/dist/drivers/coolermaster/hid.js.map +1 -0
- package/dist/drivers/delux/hid.d.ts +3 -1
- package/dist/drivers/delux/hid.d.ts.map +1 -1
- package/dist/drivers/delux/hid.js +26 -3
- package/dist/drivers/delux/hid.js.map +1 -1
- package/dist/drivers/endgame/egg-op1-hid.d.ts +13 -8
- package/dist/drivers/endgame/egg-op1-hid.d.ts.map +1 -1
- package/dist/drivers/endgame/egg-op1-hid.js +49 -36
- package/dist/drivers/endgame/egg-op1-hid.js.map +1 -1
- package/dist/drivers/fater/hid.d.ts +22 -0
- package/dist/drivers/fater/hid.d.ts.map +1 -0
- package/dist/drivers/fater/hid.js +81 -0
- package/dist/drivers/fater/hid.js.map +1 -0
- package/dist/drivers/keychron/launcher-mouse.d.ts +4 -3
- package/dist/drivers/keychron/launcher-mouse.d.ts.map +1 -1
- package/dist/drivers/keychron/launcher-mouse.js +64 -9
- package/dist/drivers/keychron/launcher-mouse.js.map +1 -1
- package/dist/drivers/keychron/mouse-8k-hid.js +1 -1
- package/dist/drivers/keychron/mouse-8k-hid.js.map +1 -1
- package/dist/drivers/logitech/bolt.d.ts +4 -1
- package/dist/drivers/logitech/bolt.d.ts.map +1 -1
- package/dist/drivers/logitech/bolt.js +6 -1
- package/dist/drivers/logitech/bolt.js.map +1 -1
- package/dist/drivers/logitech/hidpp.d.ts +14 -0
- package/dist/drivers/logitech/hidpp.d.ts.map +1 -1
- package/dist/drivers/logitech/hidpp.js +83 -6
- package/dist/drivers/logitech/hidpp.js.map +1 -1
- package/dist/drivers/logitech/onboard-profiles.d.ts +12 -0
- package/dist/drivers/logitech/onboard-profiles.d.ts.map +1 -1
- package/dist/drivers/logitech/onboard-profiles.js +54 -2
- package/dist/drivers/logitech/onboard-profiles.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/razer/hid.d.ts +36 -1
- package/dist/drivers/razer/hid.d.ts.map +1 -1
- package/dist/drivers/razer/hid.js +191 -1
- package/dist/drivers/razer/hid.js.map +1 -1
- package/dist/drivers/registry.d.ts +3 -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/vendors.d.ts +4 -0
- package/dist/drivers/vendors.d.ts.map +1 -1
- package/dist/drivers/vendors.js +13 -0
- package/dist/drivers/vendors.js.map +1 -1
- package/dist/endgame-gear/op1.d.ts +13 -7
- package/dist/endgame-gear/op1.d.ts.map +1 -1
- package/dist/endgame-gear/op1.js +36 -13
- package/dist/endgame-gear/op1.js.map +1 -1
- package/dist/fater/index.d.ts +62 -0
- package/dist/fater/index.d.ts.map +1 -0
- package/dist/fater/index.js +94 -0
- package/dist/fater/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/razer/codec.d.ts +70 -8
- package/dist/razer/codec.d.ts.map +1 -1
- package/dist/razer/codec.js +148 -10
- package/dist/razer/codec.js.map +1 -1
- package/dist/razer/devices.d.ts +18 -0
- package/dist/razer/devices.d.ts.map +1 -1
- package/dist/razer/devices.js +12 -3
- package/dist/razer/devices.js.map +1 -1
- package/package.json +9 -1
|
@@ -3,7 +3,7 @@ import { BOLT_INDEX_PROBE_TIMEOUT_MS, boltSupportScore, classifyHidpp20Probe, co
|
|
|
3
3
|
import { LOGITECH_CHANGE_HOST, LOGITECH_FRIENDLY_NAME, LOGITECH_KEY_FLAG, LOGITECH_REPROG_CONTROLS, buildControlDiversionClearWrite, buildControlRemapWrite, decodeControlInfo, decodeControlReporting, logitechControlName, logitechTaskName, remappableControlTargets, LOGITECH_HAPTIC, LOGITECH_HAPTIC_EFFECTS, LOGITECH_HIRES_WHEEL, LOGITECH_HIRES_WHEEL_BIT, LOGITECH_HOSTS, LOGITECH_SMART_SHIFT, LOGITECH_SMART_SHIFT_LEGACY, LOGITECH_SMART_SHIFT_OFF, LOGITECH_THUMB_WHEEL, buildFriendlyNameWrite, buildRatchetControlWrite, buildThumbWheelWrite, decodeHiresWheelCapabilities, decodeHiresWheelMode, decodeRatchetControl, decodeThumbWheelStatus, decodeThumbWheelSupportsInvert, encodeHiresWheelMode, buildHostSwitchWrite, decodeFriendlyNameChunk, decodeFriendlyNameLengths, decodeFriendlyNameText, decodeHostPaired, decodeHostsInfo, rejectFriendlyName, rejectHostSwitch, buildHapticConfigWrite, decodeHapticConfig, encodeHapticFlags, isLogitechHapticEffect, isLogitechHapticIntensity, DEVICE_INDEX_DIRECT, decodeBatteryLevelState, decodeReportRateBitmap, decodeUnifiedBatteryState, hidppDeviceIndexCandidates, hidppErrorForRequest, isBoltReceiverProduct, isDirectConnectProduct, isDirectConnection, OnboardOnlyError, withSoftwareId, } from "@openmouse/protocol/logitech";
|
|
4
4
|
export { collapseBoltPeers, hasHidppBluetoothCollection, hasHidppLongCollection, hasHidppShortCollection, } from "./bolt.js";
|
|
5
5
|
import { MODE_STATUS, buildModeStatusWriteMany, decodeModeStatus, } from "./mode-status.js";
|
|
6
|
-
import { ONBOARD_MODE, PROFILE_FN, PROFILE_NAME_MAX_CHARS, applyCrc, capabilitiesForFormat, decodeLiftOffLevel, decodeOnboardProfile, describeProfileFormat, dpiStageCapabilitiesForOptions, isProfileWritable, isLodWritableForProduct, encodeDpiStages, encodeAnalogButtons, encodeButtonAssignment, encodeMacroButtonAssignment, encodeMacroSector, encodeProfileName, encodeReportRate, factoryProfileForFormat, validateDpiStagePlan, layoutForFormat, parseDirectory, parseProfilesInfo, profileCrc, reportRateCapabilitiesFor, reportRatesForDevice, setDirectoryEnabled, storedCrc, supportsProfileWriteProbe, validateBunnyHoppingMs, } from "./onboard-profiles.js";
|
|
6
|
+
import { ONBOARD_MODE, PROFILE_FN, PROFILE_NAME_MAX_CHARS, applyCrc, capabilitiesForFormat, decodeLiftOffLevel, decodeOnboardProfile, describeProfileFormat, dpiStageCapabilitiesForOptions, isProfileWritable, isLodWritableForProduct, encodeDpiStages, encodeAnalogButtons, encodeButtonAssignment, encodeMacroButtonAssignment, encodeMacroSector, encodeProfileName, encodeReportRate, factoryDirectoryForFormat, factoryProfileForFormat, isBlankDirectory, validateDpiStagePlan, layoutForFormat, parseDirectory, parseProfilesInfo, profileCrc, reportRateCapabilitiesFor, reportRatesForDevice, setDirectoryEnabled, storedCrc, supportsProfileWriteProbe, validateBunnyHoppingMs, } from "./onboard-profiles.js";
|
|
7
7
|
import { encodeLogitechRgbEffect, encodeLogitechColorLedEffect, logitechColorLedLighting, logitechRgbLighting, } from "./rgb-effects.js";
|
|
8
8
|
/**
|
|
9
9
|
* Master switch for writing DPI slots into profile flash.
|
|
@@ -324,7 +324,12 @@ export class LogitechHidppClient {
|
|
|
324
324
|
return "hidpp20";
|
|
325
325
|
}
|
|
326
326
|
catch (error) {
|
|
327
|
-
|
|
327
|
+
const outcome = classifyHidpp20Probe(error, error instanceof HidppTimeoutError);
|
|
328
|
+
// The request never left the host, so every other index would fail the
|
|
329
|
+
// same way; surface the transport error instead of a wrong "not a mouse".
|
|
330
|
+
if (outcome === "unreachable")
|
|
331
|
+
throw error;
|
|
332
|
+
return outcome;
|
|
328
333
|
}
|
|
329
334
|
}
|
|
330
335
|
/**
|
|
@@ -1156,6 +1161,75 @@ export class LogitechHidppClient {
|
|
|
1156
1161
|
await this.setOnboardMode("Onboard").catch(() => undefined);
|
|
1157
1162
|
}
|
|
1158
1163
|
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Gives a mouse that has no profiles yet (G HUB has never linked it) the
|
|
1166
|
+
* factory set, so OpenMouse does not need G HUB to initialise it: every
|
|
1167
|
+
* factory profile sector, then a directory listing them with the first
|
|
1168
|
+
* enabled, then profile 1 selected.
|
|
1169
|
+
*
|
|
1170
|
+
* WRITES FLASH. Only for a format whose factory sectors and directory were
|
|
1171
|
+
* captured from G HUB, and only when the directory is truly blank. The
|
|
1172
|
+
* directory goes last, so a failure part-way leaves the mouse as blank as it
|
|
1173
|
+
* started instead of pointing at half-written sectors. The sequence was
|
|
1174
|
+
* captured from G HUB's reset on a linked PRO X 3 SUPERSTRIKE; it has not
|
|
1175
|
+
* been run against a never-linked mouse.
|
|
1176
|
+
*/
|
|
1177
|
+
async initializeBlankOnboardProfiles() {
|
|
1178
|
+
await this.open();
|
|
1179
|
+
const feature = await this.getFeature(FEATURE.onboardProfiles);
|
|
1180
|
+
if (!feature.index) {
|
|
1181
|
+
throw new Error("This Logitech mouse does not expose onboard-profile controls.");
|
|
1182
|
+
}
|
|
1183
|
+
const info = parseProfilesInfo(await this.request(feature.index, PROFILE_FN.getInfo));
|
|
1184
|
+
const sectorSize = info.sectorSize > 0 && info.sectorSize <= 1024 ? info.sectorSize : 255;
|
|
1185
|
+
const factoryProfile = factoryProfileForFormat(info.profileFormatId, sectorSize);
|
|
1186
|
+
const factoryDirectory = factoryDirectoryForFormat(info.profileFormatId, sectorSize);
|
|
1187
|
+
if (!factoryProfile || !factoryDirectory) {
|
|
1188
|
+
throw new Error(`Factory profiles have not been captured for profile format ${info.profileFormatId}.`);
|
|
1189
|
+
}
|
|
1190
|
+
if (profileCrc(factoryProfile) !== storedCrc(factoryProfile) || profileCrc(factoryDirectory) !== storedCrc(factoryDirectory)) {
|
|
1191
|
+
throw new Error("The built-in factory profiles failed their checksum; refusing to write.");
|
|
1192
|
+
}
|
|
1193
|
+
const existing = await this.readProfileSector(feature.index, 0x0000, sectorSize);
|
|
1194
|
+
if (!isBlankDirectory(existing)) {
|
|
1195
|
+
throw new Error("This mouse already has onboard profiles; use reset instead.");
|
|
1196
|
+
}
|
|
1197
|
+
const sectors = parseDirectory(factoryDirectory).map((entry) => entry.sector);
|
|
1198
|
+
// The directory layout was captured from one model. Only write it to a mouse
|
|
1199
|
+
// that itself reports at least that many profiles.
|
|
1200
|
+
if (info.profileCount < sectors.length) {
|
|
1201
|
+
throw new Error(`This mouse reports ${info.profileCount} profiles but the captured factory layout has ${sectors.length}; refusing to write it.`);
|
|
1202
|
+
}
|
|
1203
|
+
const firstSector = sectors[0];
|
|
1204
|
+
// Host mode keeps the mouse from loading a sector while it is being filled.
|
|
1205
|
+
await this.setOnboardMode("Host");
|
|
1206
|
+
let finished = false;
|
|
1207
|
+
try {
|
|
1208
|
+
for (const sector of sectors) {
|
|
1209
|
+
await this.writeProfileSector(feature.index, sector, factoryProfile);
|
|
1210
|
+
const confirmed = await this.readProfileSector(feature.index, sector, sectorSize);
|
|
1211
|
+
if (!confirmed.every((byte, index) => byte === factoryProfile[index])) {
|
|
1212
|
+
throw new Error(`Profile ${sector} did not confirm its factory image.`);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
await this.writeProfileSector(feature.index, 0x0000, factoryDirectory);
|
|
1216
|
+
const confirmedDirectory = await this.readProfileSector(feature.index, 0x0000, sectorSize);
|
|
1217
|
+
if (!confirmedDirectory.every((byte, index) => byte === factoryDirectory[index])) {
|
|
1218
|
+
throw new Error("The mouse did not confirm the new profile directory.");
|
|
1219
|
+
}
|
|
1220
|
+
await this.request(feature.index, PROFILE_FN.setCurrentProfile, (firstSector >> 8) & 0xff, firstSector & 0xff);
|
|
1221
|
+
await this.setOnboardMode("Onboard");
|
|
1222
|
+
const current = await this.request(feature.index, PROFILE_FN.getCurrentProfile);
|
|
1223
|
+
if ((((current[3] ?? 0) << 8) | (current[4] ?? 0)) !== firstSector) {
|
|
1224
|
+
throw new Error("The profiles were created, but the mouse did not select the first one.");
|
|
1225
|
+
}
|
|
1226
|
+
finished = true;
|
|
1227
|
+
}
|
|
1228
|
+
finally {
|
|
1229
|
+
if (!finished)
|
|
1230
|
+
await this.setOnboardMode("Onboard").catch(() => undefined);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1159
1233
|
/**
|
|
1160
1234
|
* Sets the bunny-hop timeout on the active profile.
|
|
1161
1235
|
*
|
|
@@ -2823,10 +2897,13 @@ export class LogitechHidppClient {
|
|
|
2823
2897
|
async requestWithOptions(featureIndex, functionId, parameters, options = {}) {
|
|
2824
2898
|
// Bolt feature traffic only answers on long reports, and Bluetooth has no
|
|
2825
2899
|
// short report at all: its descriptor declares report 0x11 alone, so a
|
|
2826
|
-
// sendReport(0x10) is rejected outright.
|
|
2827
|
-
//
|
|
2828
|
-
//
|
|
2829
|
-
|
|
2900
|
+
// sendReport(0x10) is rejected outright. The same happens on platforms that
|
|
2901
|
+
// split a receiver's top-level collections into separate HIDDevices (one
|
|
2902
|
+
// per usage): the usage-2 one carries report 0x11 only, so a short request
|
|
2903
|
+
// on it fails before reaching the receiver. Lightspeed and wired mice with
|
|
2904
|
+
// the short collection keep the short form for the three-parameter path
|
|
2905
|
+
// they were verified with; longer payloads still go through requestLong.
|
|
2906
|
+
if (this.isBoltReceiver || this.isBluetooth || !hasHidppShortCollection(this.reportDevice)) {
|
|
2830
2907
|
return this.requestLong(featureIndex, functionId, parameters, options.timeoutMs);
|
|
2831
2908
|
}
|
|
2832
2909
|
if (parameters.length > 3) {
|