@openmouse/protocol 0.49.0 → 0.50.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.
Files changed (83) hide show
  1. package/README.md +1 -0
  2. package/dist/drivers/atk/hid.d.ts.map +1 -1
  3. package/dist/drivers/atk/hid.js +2 -2
  4. package/dist/drivers/atk/hid.js.map +1 -1
  5. package/dist/drivers/atk/products.d.ts +7 -0
  6. package/dist/drivers/atk/products.d.ts.map +1 -1
  7. package/dist/drivers/atk/products.js +19 -2
  8. package/dist/drivers/atk/products.js.map +1 -1
  9. package/dist/drivers/gwolves/products.d.ts +5 -0
  10. package/dist/drivers/gwolves/products.d.ts.map +1 -1
  11. package/dist/drivers/gwolves/products.js +14 -10
  12. package/dist/drivers/gwolves/products.js.map +1 -1
  13. package/dist/drivers/gwolves/xvi-hid.d.ts +1 -0
  14. package/dist/drivers/gwolves/xvi-hid.d.ts.map +1 -1
  15. package/dist/drivers/gwolves/xvi-hid.js +14 -7
  16. package/dist/drivers/gwolves/xvi-hid.js.map +1 -1
  17. package/dist/drivers/hitscan/xvi-hid.d.ts +110 -0
  18. package/dist/drivers/hitscan/xvi-hid.d.ts.map +1 -0
  19. package/dist/drivers/hitscan/xvi-hid.js +803 -0
  20. package/dist/drivers/hitscan/xvi-hid.js.map +1 -0
  21. package/dist/drivers/motospeed/hid.js +1 -1
  22. package/dist/drivers/motospeed/hid.js.map +1 -1
  23. package/dist/drivers/mouse-types.d.ts +16 -0
  24. package/dist/drivers/mouse-types.d.ts.map +1 -1
  25. package/dist/drivers/razer/hid.d.ts +0 -1
  26. package/dist/drivers/razer/hid.d.ts.map +1 -1
  27. package/dist/drivers/razer/hid.js +14 -9
  28. package/dist/drivers/razer/hid.js.map +1 -1
  29. package/dist/drivers/redragon/hid.d.ts +44 -63
  30. package/dist/drivers/redragon/hid.d.ts.map +1 -1
  31. package/dist/drivers/redragon/hid.js +207 -270
  32. package/dist/drivers/redragon/hid.js.map +1 -1
  33. package/dist/drivers/registry.d.ts.map +1 -1
  34. package/dist/drivers/registry.js +6 -1
  35. package/dist/drivers/registry.js.map +1 -1
  36. package/dist/drivers/vendors.d.ts +1 -1
  37. package/dist/drivers/vendors.d.ts.map +1 -1
  38. package/dist/drivers/vendors.js +6 -4
  39. package/dist/drivers/vendors.js.map +1 -1
  40. package/dist/gearhub/index.d.ts +8 -0
  41. package/dist/gearhub/index.d.ts.map +1 -1
  42. package/dist/gearhub/index.js +18 -0
  43. package/dist/gearhub/index.js.map +1 -1
  44. package/dist/hitscan/index.d.ts +2 -0
  45. package/dist/hitscan/index.d.ts.map +1 -1
  46. package/dist/hitscan/index.js +2 -0
  47. package/dist/hitscan/index.js.map +1 -1
  48. package/dist/hitscan/xvi-inputs.d.ts +81 -0
  49. package/dist/hitscan/xvi-inputs.d.ts.map +1 -0
  50. package/dist/hitscan/xvi-inputs.js +393 -0
  51. package/dist/hitscan/xvi-inputs.js.map +1 -0
  52. package/dist/hitscan/xvi.d.ts +278 -0
  53. package/dist/hitscan/xvi.d.ts.map +1 -0
  54. package/dist/hitscan/xvi.js +773 -0
  55. package/dist/hitscan/xvi.js.map +1 -0
  56. package/dist/keychron/index.d.ts.map +1 -1
  57. package/dist/keychron/index.js +4 -0
  58. package/dist/keychron/index.js.map +1 -1
  59. package/dist/razer/codec.d.ts +3 -2
  60. package/dist/razer/codec.d.ts.map +1 -1
  61. package/dist/razer/codec.js +5 -4
  62. package/dist/razer/codec.js.map +1 -1
  63. package/dist/redragon/deprecated.d.ts +24 -0
  64. package/dist/redragon/deprecated.d.ts.map +1 -0
  65. package/dist/redragon/deprecated.js +54 -0
  66. package/dist/redragon/deprecated.js.map +1 -0
  67. package/dist/redragon/holtek.d.ts +127 -0
  68. package/dist/redragon/holtek.d.ts.map +1 -0
  69. package/dist/redragon/holtek.js +232 -0
  70. package/dist/redragon/holtek.js.map +1 -0
  71. package/dist/redragon/index.d.ts +9 -203
  72. package/dist/redragon/index.d.ts.map +1 -1
  73. package/dist/redragon/index.js +11 -430
  74. package/dist/redragon/index.js.map +1 -1
  75. package/dist/redragon/m612.d.ts +82 -0
  76. package/dist/redragon/m612.d.ts.map +1 -0
  77. package/dist/redragon/m612.js +166 -0
  78. package/dist/redragon/m612.js.map +1 -0
  79. package/dist/redragon/m724.d.ts +47 -0
  80. package/dist/redragon/m724.d.ts.map +1 -0
  81. package/dist/redragon/m724.js +107 -0
  82. package/dist/redragon/m724.js.map +1 -0
  83. package/package.json +1 -1
@@ -1,73 +1,30 @@
1
1
  import type { MouseLighting, MouseStatus } from "../mouse-types.js";
2
+ declare const LIFT_OFF_LEVELS: readonly ["Low", "Medium", "High"];
3
+ type LiftOff = (typeof LIFT_OFF_LEVELS)[number];
2
4
  /**
3
- * Redragon K1NG 1K (M724, `04d9:fc7a`) WebHID control.
5
+ * Redragon Holtek mice (K1NG 1K M724 `04d9:fc7a`, Predator M612 `04d9:fc61`)
6
+ * over WebHID.
4
7
  *
5
- * Transport: Holtek vendor collection `0xFFA0:0x01` on USB interface 2,
6
- * 16-byte numbered feature report 2, `SET_FEATURE` writes of the form
7
- * `[F3 sub profile section ...]` (see `@openmouse/protocol/redragon`).
8
- * The device STALLs malformed writes and never answers reads: RDCfg pushes
9
- * its whole profile table at startup and issues no `GET_REPORT` at all, so
10
- * this driver is write-only like the SteelSeries Rival 3. `readStatus`
11
- * therefore reports this session's last-written stages (or the factory
12
- * table before any write) with `valuesVerified: false`, and the only
13
- * hardware probe is the `FA FA` marker every `GET_FEATURE` echo carries.
8
+ * Both keep their settings in one flat memory on the `0xFFA0:0x01`
9
+ * collection (see `@openmouse/protocol/redragon`): every value shown is
10
+ * read from the mouse with `F2`, and every write runs inside the vendor
11
+ * bracket, is followed by the commit block, and is read back before it is
12
+ * reported as done. DPI stages, polling, buttons, and (on the M724)
13
+ * lighting live per onboard profile, so they follow the active profile.
14
14
  */
15
15
  export declare class RedragonHidClient {
16
16
  readonly device: HIDDevice;
17
+ private readonly model;
17
18
  private queue;
18
- private lastStages;
19
- private lastPollingHz;
19
+ /** Throws for a PID without a model descriptor; `isSupported` filters those out first. */
20
20
  constructor(device: HIDDevice);
21
+ /** Holtek VID, a catalogued PID, and the config collection (the mouse and keyboard interfaces lack it). */
21
22
  static isSupported(device: HIDDevice): boolean;
22
23
  get supportedPollingRates(): number[];
23
24
  getDpiOptions(): number[];
24
25
  open(): Promise<void>;
25
26
  close(): Promise<void>;
26
27
  readStatus(): Promise<MouseStatus>;
27
- /**
28
- * Writes the whole profile-1 DPI table in one vendor session bracket,
29
- * closed by the commit block. Bisected live: RDCfg re-pushes the table on
30
- * every Apply and the change is felt immediately; a lone slot write is
31
- * stored but only takes effect at boot, and the trailing `F1` block is
32
- * what activates it. Sibling stages come from this session's cache
33
- * (factory table before any write): editing in RDCfg meanwhile makes the
34
- * cache stale, exactly like any write-only driver.
35
- */
36
- setDpiStageValue(stage: number, dpi: number): Promise<number>;
37
- /**
38
- * Writes the polling rate inside the same session bracket + commit block
39
- * as DPI writes (the vendor sends it mid-push; the trailing `F1` block is
40
- * what activates writes, verified live for DPI).
41
- */
42
- setPollingRate(hz: number): Promise<number>;
43
- /**
44
- * The `FA FA` echo every `GET_FEATURE` carries doubles as the proof that
45
- * the granted interface is the config channel: the mouse and keyboard
46
- * interfaces expose no feature report 2 at all. The marker is matched as
47
- * the last two payload bytes so both WebHID framings (report id stripped
48
- * or kept) validate.
49
- */
50
- protected probeConfigChannel(): Promise<void>;
51
- protected sendFrame(frame: Uint8Array): Promise<void>;
52
- private sendSessionFrame;
53
- protected writeSession(operation: () => Promise<void>): Promise<void>;
54
- protected run<T>(operation: () => Promise<T>): Promise<T>;
55
- }
56
- /**
57
- * Redragon Predator M612 (`04d9:fc61`) WebHID control.
58
- *
59
- * Same Holtek transport as the M724, but the M612 answers `F2` reads (see
60
- * `redragonEncodeRead`), so every value shown is read from the mouse and
61
- * every write is read back before it is reported as done. Reads need no
62
- * session bracket; writes use the vendor bracket and commit block.
63
- *
64
- * DPI stages live per onboard profile, so writes target whichever profile
65
- * the mouse reports as active. DPI values snap to the positions RDCfg's
66
- * slider offers and report its label for them.
67
- */
68
- export declare class RedragonM612HidClient extends RedragonHidClient {
69
- getDpiOptions(): number[];
70
- readStatus(): Promise<MouseStatus>;
71
28
  /**
72
29
  * Rewrites one stage slot of the active profile, keeping its enabled byte,
73
30
  * then reads it back. Returns the DPI label the mouse now holds, which
@@ -76,9 +33,13 @@ export declare class RedragonM612HidClient extends RedragonHidClient {
76
33
  setDpiStageValue(stage: number, dpi: number): Promise<number>;
77
34
  /** Selects the active DPI stage of the active profile, as the DPI button does. */
78
35
  setActiveDpiStage(stage: number): Promise<number>;
79
- /** Rewrites the polling code, keeping the block's other bytes. */
36
+ /** Rewrites the active profile's polling code, keeping the byte after it. */
80
37
  setPollingRate(hz: number): Promise<number>;
81
- /** Switches the onboard profile (1-5), exactly as RDCfg's MODE menu does. */
38
+ /**
39
+ * Switches the onboard profile (1-5) as RDCfg's MODE menu does: the profile
40
+ * byte outside any bracket, `F1 02 01`, then the commit block. Without the
41
+ * block the M724 stores the byte but keeps the old profile running.
42
+ */
82
43
  setProfile(profile: number): Promise<void>;
83
44
  /**
84
45
  * Assigns an action from `buttonOptions` to one button of the active
@@ -86,22 +47,42 @@ export declare class RedragonM612HidClient extends RedragonHidClient {
86
47
  * leave the mouse unable to click.
87
48
  */
88
49
  setButtonMapping(button: string, action: string): Promise<void>;
50
+ /** Sets the lift-off height (M724 only): Low, Medium, or High. */
51
+ setLiftOffDistance(value: LiftOff): Promise<LiftOff>;
89
52
  /**
90
- * Writes the effect selector and that effect's parameter block. Lighting is
91
- * global, not per profile. A colour, speed, or brightness equal to what
92
- * the current effect shows is treated as unchanged, so switching effects
93
- * keeps the target effect's own stored values.
53
+ * Writes the lighting. On the M612 that is the global effect selector and
54
+ * that effect's parameter block, where a colour, speed, or brightness equal
55
+ * to what the current effect shows is treated as unchanged, so switching
56
+ * effects keeps the target effect's own stored values. On the M724 it is
57
+ * the active profile's single block.
94
58
  */
95
59
  setLighting(lighting: MouseLighting): Promise<void>;
60
+ /** Names every button of `profile` with its decoded action, from one ranged read. */
96
61
  private readButtonMappings;
97
- private readLighting;
62
+ /** M724: the profile's block; brightness is hidden when the effect is Off. */
63
+ private readProfileLighting;
64
+ /** M612: the global effect bit and that effect's parameter block (none for Off). */
65
+ private readEffectLighting;
66
+ /** Null on models without lift-off, or for a level byte outside 0-2. */
67
+ private readLiftOff;
68
+ /** Reads any length in transfers of at most 8 bytes. */
98
69
  private readRange;
70
+ /** Active profile, its stage table and active stage, and its polling rate; rejects values the firmware never holds. */
99
71
  private readSettings;
72
+ /** The active profile index 0-4, rejecting anything else. */
100
73
  private readActiveProfile;
101
74
  private readBytes;
102
75
  /** One write inside the vendor bracket + commit block, then a read-back. */
103
76
  private writeAndConfirm;
104
77
  /** Reads `data.length` bytes back and throws unless they match. */
105
78
  private confirm;
79
+ private sendFrame;
80
+ /** The bracket is always closed: a session left open hangs the interface. */
81
+ private writeSession;
82
+ private run;
83
+ }
84
+ /** @deprecated `RedragonHidClient` serves the M612 too; the model follows the PID. */
85
+ export declare class RedragonM612HidClient extends RedragonHidClient {
106
86
  }
87
+ export {};
107
88
  //# sourceMappingURL=hid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hid.d.ts","sourceRoot":"","sources":["../../../src/drivers/redragon/hid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAqB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8DvF;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,aAAa,CAAuB;gBAEhC,MAAM,EAAE,SAAS;IAU7B,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO;IAM9C,IAAI,qBAAqB,IAAI,MA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