@openmouse/protocol 0.50.0 → 0.51.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.
Files changed (114) hide show
  1. package/README.md +1 -0
  2. package/dist/amkette/index.d.ts +2 -0
  3. package/dist/amkette/index.d.ts.map +1 -0
  4. package/dist/amkette/index.js +2 -0
  5. package/dist/amkette/index.js.map +1 -0
  6. package/dist/amkette/xs.d.ts +63 -0
  7. package/dist/amkette/xs.d.ts.map +1 -0
  8. package/dist/amkette/xs.js +79 -0
  9. package/dist/amkette/xs.js.map +1 -0
  10. package/dist/corsair/bragi.d.ts +70 -12
  11. package/dist/corsair/bragi.d.ts.map +1 -1
  12. package/dist/corsair/bragi.js +85 -16
  13. package/dist/corsair/bragi.js.map +1 -1
  14. package/dist/drivers/amkette/xs-hid.d.ts +142 -0
  15. package/dist/drivers/amkette/xs-hid.d.ts.map +1 -0
  16. package/dist/drivers/amkette/xs-hid.js +683 -0
  17. package/dist/drivers/amkette/xs-hid.js.map +1 -0
  18. package/dist/drivers/corsair/bragi-hid.d.ts +17 -12
  19. package/dist/drivers/corsair/bragi-hid.d.ts.map +1 -1
  20. package/dist/drivers/corsair/bragi-hid.js +35 -15
  21. package/dist/drivers/corsair/bragi-hid.js.map +1 -1
  22. package/dist/drivers/glorious/sinowealth-hid.d.ts +23 -0
  23. package/dist/drivers/glorious/sinowealth-hid.d.ts.map +1 -1
  24. package/dist/drivers/glorious/sinowealth-hid.js +71 -5
  25. package/dist/drivers/glorious/sinowealth-hid.js.map +1 -1
  26. package/dist/drivers/gwolves/products.d.ts.map +1 -1
  27. package/dist/drivers/gwolves/products.js +3 -0
  28. package/dist/drivers/gwolves/products.js.map +1 -1
  29. package/dist/drivers/incott/hid.d.ts +5 -0
  30. package/dist/drivers/incott/hid.d.ts.map +1 -1
  31. package/dist/drivers/incott/hid.js +18 -7
  32. package/dist/drivers/incott/hid.js.map +1 -1
  33. package/dist/drivers/lamzu/hid.d.ts +4 -0
  34. package/dist/drivers/lamzu/hid.d.ts.map +1 -1
  35. package/dist/drivers/lamzu/hid.js +41 -2
  36. package/dist/drivers/lamzu/hid.js.map +1 -1
  37. package/dist/drivers/lamzu-atlantis/hid.d.ts.map +1 -1
  38. package/dist/drivers/lamzu-atlantis/hid.js +2 -3
  39. package/dist/drivers/lamzu-atlantis/hid.js.map +1 -1
  40. package/dist/drivers/logitech/hidpp.d.ts +2 -0
  41. package/dist/drivers/logitech/hidpp.d.ts.map +1 -1
  42. package/dist/drivers/logitech/hidpp.js +28 -13
  43. package/dist/drivers/logitech/hidpp.js.map +1 -1
  44. package/dist/drivers/mchose/hid.d.ts +9 -0
  45. package/dist/drivers/mchose/hid.d.ts.map +1 -1
  46. package/dist/drivers/mchose/hid.js +36 -5
  47. package/dist/drivers/mchose/hid.js.map +1 -1
  48. package/dist/drivers/mouse-types.d.ts +1 -1
  49. package/dist/drivers/mouse-types.d.ts.map +1 -1
  50. package/dist/drivers/ninjutso/hid.d.ts +1 -0
  51. package/dist/drivers/ninjutso/hid.d.ts.map +1 -1
  52. package/dist/drivers/ninjutso/hid.js +18 -11
  53. package/dist/drivers/ninjutso/hid.js.map +1 -1
  54. package/dist/drivers/pulsar/pulsar-hid.js +1 -1
  55. package/dist/drivers/pulsar/pulsar-hid.js.map +1 -1
  56. package/dist/drivers/registry.d.ts +2 -1
  57. package/dist/drivers/registry.d.ts.map +1 -1
  58. package/dist/drivers/registry.js +6 -0
  59. package/dist/drivers/registry.js.map +1 -1
  60. package/dist/drivers/ryunix/kyu-pro-mx1-hid.d.ts.map +1 -1
  61. package/dist/drivers/ryunix/kyu-pro-mx1-hid.js +4 -1
  62. package/dist/drivers/ryunix/kyu-pro-mx1-hid.js.map +1 -1
  63. package/dist/drivers/scyrox/hid.d.ts +5 -0
  64. package/dist/drivers/scyrox/hid.d.ts.map +1 -1
  65. package/dist/drivers/scyrox/hid.js +5 -0
  66. package/dist/drivers/scyrox/hid.js.map +1 -1
  67. package/dist/drivers/vendors.d.ts +7 -2
  68. package/dist/drivers/vendors.d.ts.map +1 -1
  69. package/dist/drivers/vendors.js +35 -9
  70. package/dist/drivers/vendors.js.map +1 -1
  71. package/dist/glorious-sinowealth/index.d.ts +7 -3
  72. package/dist/glorious-sinowealth/index.d.ts.map +1 -1
  73. package/dist/glorious-sinowealth/index.js +8 -4
  74. package/dist/glorious-sinowealth/index.js.map +1 -1
  75. package/dist/incott/index.d.ts +33 -8
  76. package/dist/incott/index.d.ts.map +1 -1
  77. package/dist/incott/index.js +44 -11
  78. package/dist/incott/index.js.map +1 -1
  79. package/dist/index.d.ts +1 -0
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +1 -0
  82. package/dist/index.js.map +1 -1
  83. package/dist/lamzu/atlantis.d.ts +18 -9
  84. package/dist/lamzu/atlantis.d.ts.map +1 -1
  85. package/dist/lamzu/atlantis.js +21 -6
  86. package/dist/lamzu/atlantis.js.map +1 -1
  87. package/dist/lamzu/index.d.ts +8 -5
  88. package/dist/lamzu/index.d.ts.map +1 -1
  89. package/dist/lamzu/index.js +10 -5
  90. package/dist/lamzu/index.js.map +1 -1
  91. package/dist/mchose/index.d.ts +14 -0
  92. package/dist/mchose/index.d.ts.map +1 -1
  93. package/dist/mchose/index.js +25 -2
  94. package/dist/mchose/index.js.map +1 -1
  95. package/dist/ninjutso/index.d.ts.map +1 -1
  96. package/dist/ninjutso/index.js +5 -2
  97. package/dist/ninjutso/index.js.map +1 -1
  98. package/dist/ryunix/index.d.ts +1 -0
  99. package/dist/ryunix/index.d.ts.map +1 -1
  100. package/dist/ryunix/index.js +1 -0
  101. package/dist/ryunix/index.js.map +1 -1
  102. package/dist/ryunix/kyu-pro-mx1.d.ts +10 -1
  103. package/dist/ryunix/kyu-pro-mx1.d.ts.map +1 -1
  104. package/dist/ryunix/kyu-pro-mx1.js +10 -12
  105. package/dist/ryunix/kyu-pro-mx1.js.map +1 -1
  106. package/dist/ryunix/protocol.d.ts +204 -0
  107. package/dist/ryunix/protocol.d.ts.map +1 -0
  108. package/dist/ryunix/protocol.js +366 -0
  109. package/dist/ryunix/protocol.js.map +1 -0
  110. package/dist/scyrox/index.d.ts +5 -0
  111. package/dist/scyrox/index.d.ts.map +1 -1
  112. package/dist/scyrox/index.js +37 -1
  113. package/dist/scyrox/index.js.map +1 -1
  114. package/package.json +6 -1
@@ -56,13 +56,21 @@ const KNOWN_RECEIVER_PRODUCT_IDS = new Set(LOGITECH_RECEIVER_PRODUCT_IDS);
56
56
  * model id, like the Superstrike detection.
57
57
  */
58
58
  const MODE_STATUS_POWER_ONLY_MODEL_IDS = new Set([
59
- "B03C40B10000", // G309 LIGHTSPEED
60
59
  "407400000000", // G305 LIGHTSPEED
61
60
  ]);
61
+ const LIGHTFORCE_MODE_WITHOUT_LIFT_OFF_MODEL_IDS = new Set([
62
+ "B03C40B10000", // G309 LIGHTSPEED
63
+ ]);
62
64
  /** Whether 0x8090 on this model is the power-mode-only variant. */
63
65
  export function isPowerOnlyModeStatus(modelId) {
64
66
  return MODE_STATUS_POWER_ONLY_MODEL_IDS.has(modelId ?? "");
65
67
  }
68
+ /** Whether the model exposes LightForce mode, even without a live lift-off control. */
69
+ export function hasLightforceModeControl(modelId, hasLiveLiftOffControl, hasAnalogButtons) {
70
+ return !isPowerOnlyModeStatus(modelId)
71
+ && !hasAnalogButtons
72
+ && (hasLiveLiftOffControl || LIGHTFORCE_MODE_WITHOUT_LIFT_OFF_MODEL_IDS.has(modelId ?? ""));
73
+ }
66
74
  /**
67
75
  * Whether the mouse exposes lift-off levels it can drive: only extended DPI
68
76
  * (0x2202) carries one, and its byte 0 is the "no lift-off control" value, so
@@ -253,7 +261,11 @@ export class LogitechHidppClient {
253
261
  return failure !== null;
254
262
  });
255
263
  if (failedIndex >= 0) {
256
- this.waiters.splice(failedIndex, 1)[0].reject(new Error(failure ?? "The mouse rejected that request."));
264
+ const [waiter] = this.waiters.splice(failedIndex, 1);
265
+ const request = waiter
266
+ ? ` (feature 0x${waiter.featureIndex.toString(16).padStart(2, "0")}, function 0x${waiter.functionId.toString(16).padStart(2, "0")})`
267
+ : "";
268
+ waiter?.reject(new Error(`${failure ?? "The mouse rejected that request."}${request}`));
257
269
  }
258
270
  return;
259
271
  }
@@ -602,9 +614,8 @@ export class LogitechHidppClient {
602
614
  onboardProfileFormat,
603
615
  // HID++ exposes no per-field support mask for status1. A power-only
604
616
  // variant can leave it reserved at zero, which would falsely decode as
605
- // Surface Auto and LightForce Optical. Only expose that control bank when
606
- // the sensor positively reports the related live LOD capability; this is
607
- // deliberately conservative and avoids a product/model exception.
617
+ // Surface Auto and LightForce Optical. Require live LOD capability
618
+ // except for models whose status fields have been verified separately.
608
619
  ...wheel,
609
620
  friendlyName: friendly?.name ?? null,
610
621
  friendlyNameMaxLength: friendly?.maxLength ?? null,
@@ -614,10 +625,10 @@ export class LogitechHidppClient {
614
625
  hapticIntensity: haptics?.intensity ?? null,
615
626
  hapticEnabled: haptics?.enabled ?? null,
616
627
  hapticBatterySaving: haptics?.batterySaving ?? null,
617
- gamingSurfaceMode: modeStatus === null || !hasLiveLiftOffControl
628
+ gamingSurfaceMode: modeStatus === null || !hasLiveLiftOffControl || isPowerOnlyModeStatus(identity.modelId)
618
629
  ? null
619
630
  : decodeModeStatus(modeStatus, MODE_STATUS.gamingSurface),
620
- lightforceSwitchMode: modeStatus === null || !hasLiveLiftOffControl || !hasLightforceSwitches(Boolean(analogButtonsFeature.index))
631
+ lightforceSwitchMode: modeStatus === null || !hasLightforceModeControl(identity.modelId, hasLiveLiftOffControl, Boolean(analogButtonsFeature.index))
621
632
  ? null
622
633
  : decodeModeStatus(modeStatus, MODE_STATUS.lightforce),
623
634
  lighting: lighting ?? undefined,
@@ -925,16 +936,19 @@ export class LogitechHidppClient {
925
936
  await this.ensureHostControl();
926
937
  const feature = await this.getFeature(FEATURE.extendedDpi);
927
938
  const current = await this.readDpiConfiguration(feature.index);
939
+ const capabilities = await this.readDpiCapabilities(feature.index);
940
+ const writeDpiY = capabilities.separateAxes ? dpiY : 0;
941
+ const writeLod = capabilities.liftOff ? current.lod : 0;
928
942
  await this.requestLong(feature.index, 0x60, [
929
943
  0x00,
930
944
  dpi >> 8,
931
945
  dpi & 0xff,
932
- dpiY >> 8,
933
- dpiY & 0xff,
934
- current.lod,
946
+ writeDpiY >> 8,
947
+ writeDpiY & 0xff,
948
+ writeLod,
935
949
  ]);
936
950
  const confirmed = await this.readDpiConfiguration(feature.index);
937
- if (confirmed.x !== dpi || confirmed.y !== dpiY) {
951
+ if (confirmed.x !== dpi || (capabilities.separateAxes && confirmed.y !== dpiY)) {
938
952
  throw new Error(`The mouse kept ${confirmed.x}/${confirmed.y} DPI instead of ${dpi}/${dpiY} DPI.`);
939
953
  }
940
954
  return confirmed.x;
@@ -952,12 +966,13 @@ export class LogitechHidppClient {
952
966
  throw new Error("This mouse does not expose lift-off-distance controls.");
953
967
  }
954
968
  const current = await this.readDpiConfiguration(feature.index);
969
+ const capabilities = await this.readDpiCapabilities(feature.index);
955
970
  await this.requestLong(feature.index, 0x60, [
956
971
  0x00,
957
972
  current.x >> 8,
958
973
  current.x & 0xff,
959
- current.y >> 8,
960
- current.y & 0xff,
974
+ capabilities.separateAxes ? current.y >> 8 : 0,
975
+ capabilities.separateAxes ? current.y & 0xff : 0,
961
976
  lod,
962
977
  ]);
963
978
  const confirmed = await this.readDpiConfiguration(feature.index);