@openmouse/protocol 0.1.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 (547) hide show
  1. package/CONTRIBUTING.md +167 -0
  2. package/README.md +89 -0
  3. package/dist/asus/index.d.ts +52 -0
  4. package/dist/asus/index.d.ts.map +1 -0
  5. package/dist/asus/index.js +248 -0
  6. package/dist/asus/index.js.map +1 -0
  7. package/dist/atk/index.d.ts +200 -0
  8. package/dist/atk/index.d.ts.map +1 -0
  9. package/dist/atk/index.js +480 -0
  10. package/dist/atk/index.js.map +1 -0
  11. package/dist/bitmouse/index.d.ts +284 -0
  12. package/dist/bitmouse/index.d.ts.map +1 -0
  13. package/dist/bitmouse/index.js +396 -0
  14. package/dist/bitmouse/index.js.map +1 -0
  15. package/dist/compx/codec.d.ts +31 -0
  16. package/dist/compx/codec.d.ts.map +1 -0
  17. package/dist/compx/codec.js +50 -0
  18. package/dist/compx/codec.js.map +1 -0
  19. package/dist/corsair/index.d.ts +147 -0
  20. package/dist/corsair/index.d.ts.map +1 -0
  21. package/dist/corsair/index.js +223 -0
  22. package/dist/corsair/index.js.map +1 -0
  23. package/dist/dareu/index.d.ts +136 -0
  24. package/dist/dareu/index.d.ts.map +1 -0
  25. package/dist/dareu/index.js +344 -0
  26. package/dist/dareu/index.js.map +1 -0
  27. package/dist/drivers/asus/hid.d.ts +29 -0
  28. package/dist/drivers/asus/hid.d.ts.map +1 -0
  29. package/dist/drivers/asus/hid.js +419 -0
  30. package/dist/drivers/asus/hid.js.map +1 -0
  31. package/dist/drivers/atk/bitmouse-hid.d.ts +80 -0
  32. package/dist/drivers/atk/bitmouse-hid.d.ts.map +1 -0
  33. package/dist/drivers/atk/bitmouse-hid.js +501 -0
  34. package/dist/drivers/atk/bitmouse-hid.js.map +1 -0
  35. package/dist/drivers/atk/hid.d.ts +163 -0
  36. package/dist/drivers/atk/hid.d.ts.map +1 -0
  37. package/dist/drivers/atk/hid.js +1368 -0
  38. package/dist/drivers/atk/hid.js.map +1 -0
  39. package/dist/drivers/atk/products.d.ts +13 -0
  40. package/dist/drivers/atk/products.d.ts.map +1 -0
  41. package/dist/drivers/atk/products.js +13 -0
  42. package/dist/drivers/atk/products.js.map +1 -0
  43. package/dist/drivers/attackshark/dpi.d.ts +41 -0
  44. package/dist/drivers/attackshark/dpi.d.ts.map +1 -0
  45. package/dist/drivers/attackshark/dpi.js +215 -0
  46. package/dist/drivers/attackshark/dpi.js.map +1 -0
  47. package/dist/drivers/attackshark/hid.d.ts +124 -0
  48. package/dist/drivers/attackshark/hid.d.ts.map +1 -0
  49. package/dist/drivers/attackshark/hid.js +728 -0
  50. package/dist/drivers/attackshark/hid.js.map +1 -0
  51. package/dist/drivers/corsair/hid.d.ts +70 -0
  52. package/dist/drivers/corsair/hid.d.ts.map +1 -0
  53. package/dist/drivers/corsair/hid.js +414 -0
  54. package/dist/drivers/corsair/hid.js.map +1 -0
  55. package/dist/drivers/dareu/hid.d.ts +59 -0
  56. package/dist/drivers/dareu/hid.d.ts.map +1 -0
  57. package/dist/drivers/dareu/hid.js +478 -0
  58. package/dist/drivers/dareu/hid.js.map +1 -0
  59. package/dist/drivers/endgame/egg-op1-hid.d.ts +107 -0
  60. package/dist/drivers/endgame/egg-op1-hid.d.ts.map +1 -0
  61. package/dist/drivers/endgame/egg-op1-hid.js +605 -0
  62. package/dist/drivers/endgame/egg-op1-hid.js.map +1 -0
  63. package/dist/drivers/endgame/egg-we-control.d.ts +42 -0
  64. package/dist/drivers/endgame/egg-we-control.d.ts.map +1 -0
  65. package/dist/drivers/endgame/egg-we-control.js +87 -0
  66. package/dist/drivers/endgame/egg-we-control.js.map +1 -0
  67. package/dist/drivers/endgame/egg-we-hid.d.ts +58 -0
  68. package/dist/drivers/endgame/egg-we-hid.d.ts.map +1 -0
  69. package/dist/drivers/endgame/egg-we-hid.js +514 -0
  70. package/dist/drivers/endgame/egg-we-hid.js.map +1 -0
  71. package/dist/drivers/fantech/hid.d.ts +106 -0
  72. package/dist/drivers/fantech/hid.d.ts.map +1 -0
  73. package/dist/drivers/fantech/hid.js +295 -0
  74. package/dist/drivers/fantech/hid.js.map +1 -0
  75. package/dist/drivers/finalmouse/hid.d.ts +31 -0
  76. package/dist/drivers/finalmouse/hid.d.ts.map +1 -0
  77. package/dist/drivers/finalmouse/hid.js +181 -0
  78. package/dist/drivers/finalmouse/hid.js.map +1 -0
  79. package/dist/drivers/gearhub/hid.d.ts +191 -0
  80. package/dist/drivers/gearhub/hid.d.ts.map +1 -0
  81. package/dist/drivers/gearhub/hid.js +542 -0
  82. package/dist/drivers/gearhub/hid.js.map +1 -0
  83. package/dist/drivers/glorious/classic-hid.d.ts +62 -0
  84. package/dist/drivers/glorious/classic-hid.d.ts.map +1 -0
  85. package/dist/drivers/glorious/classic-hid.js +326 -0
  86. package/dist/drivers/glorious/classic-hid.js.map +1 -0
  87. package/dist/drivers/glorious/hid.d.ts +39 -0
  88. package/dist/drivers/glorious/hid.d.ts.map +1 -0
  89. package/dist/drivers/glorious/hid.js +203 -0
  90. package/dist/drivers/glorious/hid.js.map +1 -0
  91. package/dist/drivers/gwolves/hid.d.ts +27 -0
  92. package/dist/drivers/gwolves/hid.d.ts.map +1 -0
  93. package/dist/drivers/gwolves/hid.js +225 -0
  94. package/dist/drivers/gwolves/hid.js.map +1 -0
  95. package/dist/drivers/gwolves/products.d.ts +17 -0
  96. package/dist/drivers/gwolves/products.d.ts.map +1 -0
  97. package/dist/drivers/gwolves/products.js +58 -0
  98. package/dist/drivers/gwolves/products.js.map +1 -0
  99. package/dist/drivers/hyperx/hid.d.ts +59 -0
  100. package/dist/drivers/hyperx/hid.d.ts.map +1 -0
  101. package/dist/drivers/hyperx/hid.js +229 -0
  102. package/dist/drivers/hyperx/hid.js.map +1 -0
  103. package/dist/drivers/incott/hid.d.ts +513 -0
  104. package/dist/drivers/incott/hid.d.ts.map +1 -0
  105. package/dist/drivers/incott/hid.js +1173 -0
  106. package/dist/drivers/incott/hid.js.map +1 -0
  107. package/dist/drivers/index.d.ts +5 -0
  108. package/dist/drivers/index.d.ts.map +1 -0
  109. package/dist/drivers/index.js +5 -0
  110. package/dist/drivers/index.js.map +1 -0
  111. package/dist/drivers/keychron/m6-hid.d.ts +81 -0
  112. package/dist/drivers/keychron/m6-hid.d.ts.map +1 -0
  113. package/dist/drivers/keychron/m6-hid.js +486 -0
  114. package/dist/drivers/keychron/m6-hid.js.map +1 -0
  115. package/dist/drivers/keychron/nape-hid.d.ts +60 -0
  116. package/dist/drivers/keychron/nape-hid.d.ts.map +1 -0
  117. package/dist/drivers/keychron/nape-hid.js +432 -0
  118. package/dist/drivers/keychron/nape-hid.js.map +1 -0
  119. package/dist/drivers/ksnake/hid.d.ts +74 -0
  120. package/dist/drivers/ksnake/hid.d.ts.map +1 -0
  121. package/dist/drivers/ksnake/hid.js +368 -0
  122. package/dist/drivers/ksnake/hid.js.map +1 -0
  123. package/dist/drivers/lamzu/hid.d.ts +58 -0
  124. package/dist/drivers/lamzu/hid.d.ts.map +1 -0
  125. package/dist/drivers/lamzu/hid.js +414 -0
  126. package/dist/drivers/lamzu/hid.js.map +1 -0
  127. package/dist/drivers/lamzu-atlantis/hid.d.ts +148 -0
  128. package/dist/drivers/lamzu-atlantis/hid.d.ts.map +1 -0
  129. package/dist/drivers/lamzu-atlantis/hid.js +587 -0
  130. package/dist/drivers/lamzu-atlantis/hid.js.map +1 -0
  131. package/dist/drivers/logitech/bolt.d.ts +41 -0
  132. package/dist/drivers/logitech/bolt.d.ts.map +1 -0
  133. package/dist/drivers/logitech/bolt.js +105 -0
  134. package/dist/drivers/logitech/bolt.js.map +1 -0
  135. package/dist/drivers/logitech/hidpp.d.ts +525 -0
  136. package/dist/drivers/logitech/hidpp.d.ts.map +1 -0
  137. package/dist/drivers/logitech/hidpp.js +2774 -0
  138. package/dist/drivers/logitech/hidpp.js.map +1 -0
  139. package/dist/drivers/logitech/mode-status.d.ts +53 -0
  140. package/dist/drivers/logitech/mode-status.d.ts.map +1 -0
  141. package/dist/drivers/logitech/mode-status.js +52 -0
  142. package/dist/drivers/logitech/mode-status.js.map +1 -0
  143. package/dist/drivers/logitech/onboard-profiles.d.ts +298 -0
  144. package/dist/drivers/logitech/onboard-profiles.d.ts.map +1 -0
  145. package/dist/drivers/logitech/onboard-profiles.js +965 -0
  146. package/dist/drivers/logitech/onboard-profiles.js.map +1 -0
  147. package/dist/drivers/logitech/rgb-effects.d.ts +20 -0
  148. package/dist/drivers/logitech/rgb-effects.d.ts.map +1 -0
  149. package/dist/drivers/logitech/rgb-effects.js +93 -0
  150. package/dist/drivers/logitech/rgb-effects.js.map +1 -0
  151. package/dist/drivers/mchose/a5-gen1-hid.d.ts +36 -0
  152. package/dist/drivers/mchose/a5-gen1-hid.d.ts.map +1 -0
  153. package/dist/drivers/mchose/a5-gen1-hid.js +219 -0
  154. package/dist/drivers/mchose/a5-gen1-hid.js.map +1 -0
  155. package/dist/drivers/mchose/dock-hid.d.ts +26 -0
  156. package/dist/drivers/mchose/dock-hid.d.ts.map +1 -0
  157. package/dist/drivers/mchose/dock-hid.js +176 -0
  158. package/dist/drivers/mchose/dock-hid.js.map +1 -0
  159. package/dist/drivers/mchose/hid.d.ts +118 -0
  160. package/dist/drivers/mchose/hid.d.ts.map +1 -0
  161. package/dist/drivers/mchose/hid.js +550 -0
  162. package/dist/drivers/mchose/hid.js.map +1 -0
  163. package/dist/drivers/mchose/v3-hid.d.ts +109 -0
  164. package/dist/drivers/mchose/v3-hid.d.ts.map +1 -0
  165. package/dist/drivers/mchose/v3-hid.js +572 -0
  166. package/dist/drivers/mchose/v3-hid.js.map +1 -0
  167. package/dist/drivers/microsoft/hid.d.ts +25 -0
  168. package/dist/drivers/microsoft/hid.d.ts.map +1 -0
  169. package/dist/drivers/microsoft/hid.js +247 -0
  170. package/dist/drivers/microsoft/hid.js.map +1 -0
  171. package/dist/drivers/moddo/hid.d.ts +31 -0
  172. package/dist/drivers/moddo/hid.d.ts.map +1 -0
  173. package/dist/drivers/moddo/hid.js +154 -0
  174. package/dist/drivers/moddo/hid.js.map +1 -0
  175. package/dist/drivers/mouse-types.d.ts +388 -0
  176. package/dist/drivers/mouse-types.d.ts.map +1 -0
  177. package/dist/drivers/mouse-types.js +2 -0
  178. package/dist/drivers/mouse-types.js.map +1 -0
  179. package/dist/drivers/ninjutso/hid.d.ts +62 -0
  180. package/dist/drivers/ninjutso/hid.d.ts.map +1 -0
  181. package/dist/drivers/ninjutso/hid.js +680 -0
  182. package/dist/drivers/ninjutso/hid.js.map +1 -0
  183. package/dist/drivers/orbital/hid.d.ts +24 -0
  184. package/dist/drivers/orbital/hid.d.ts.map +1 -0
  185. package/dist/drivers/orbital/hid.js +85 -0
  186. package/dist/drivers/orbital/hid.js.map +1 -0
  187. package/dist/drivers/orbital/host-protocol.d.ts +59 -0
  188. package/dist/drivers/orbital/host-protocol.d.ts.map +1 -0
  189. package/dist/drivers/orbital/host-protocol.js +884 -0
  190. package/dist/drivers/orbital/host-protocol.js.map +1 -0
  191. package/dist/drivers/pulsar/pulsar-hid.d.ts +63 -0
  192. package/dist/drivers/pulsar/pulsar-hid.d.ts.map +1 -0
  193. package/dist/drivers/pulsar/pulsar-hid.js +381 -0
  194. package/dist/drivers/pulsar/pulsar-hid.js.map +1 -0
  195. package/dist/drivers/pulsar/pulsar-pro-hid.d.ts +46 -0
  196. package/dist/drivers/pulsar/pulsar-pro-hid.d.ts.map +1 -0
  197. package/dist/drivers/pulsar/pulsar-pro-hid.js +343 -0
  198. package/dist/drivers/pulsar/pulsar-pro-hid.js.map +1 -0
  199. package/dist/drivers/pulsar/pulsar-xs1-hid.d.ts +40 -0
  200. package/dist/drivers/pulsar/pulsar-xs1-hid.d.ts.map +1 -0
  201. package/dist/drivers/pulsar/pulsar-xs1-hid.js +251 -0
  202. package/dist/drivers/pulsar/pulsar-xs1-hid.js.map +1 -0
  203. package/dist/drivers/rawm/hid.d.ts +29 -0
  204. package/dist/drivers/rawm/hid.d.ts.map +1 -0
  205. package/dist/drivers/rawm/hid.js +210 -0
  206. package/dist/drivers/rawm/hid.js.map +1 -0
  207. package/dist/drivers/razer/cobra-hid.d.ts +63 -0
  208. package/dist/drivers/razer/cobra-hid.d.ts.map +1 -0
  209. package/dist/drivers/razer/cobra-hid.js +282 -0
  210. package/dist/drivers/razer/cobra-hid.js.map +1 -0
  211. package/dist/drivers/razer/hid-open.d.ts +13 -0
  212. package/dist/drivers/razer/hid-open.d.ts.map +1 -0
  213. package/dist/drivers/razer/hid-open.js +29 -0
  214. package/dist/drivers/razer/hid-open.js.map +1 -0
  215. package/dist/drivers/razer/hid.d.ts +231 -0
  216. package/dist/drivers/razer/hid.d.ts.map +1 -0
  217. package/dist/drivers/razer/hid.js +772 -0
  218. package/dist/drivers/razer/hid.js.map +1 -0
  219. package/dist/drivers/razer/viper-hid.d.ts +33 -0
  220. package/dist/drivers/razer/viper-hid.d.ts.map +1 -0
  221. package/dist/drivers/razer/viper-hid.js +177 -0
  222. package/dist/drivers/razer/viper-hid.js.map +1 -0
  223. package/dist/drivers/razer/viper-mini-hid.d.ts +58 -0
  224. package/dist/drivers/razer/viper-mini-hid.d.ts.map +1 -0
  225. package/dist/drivers/razer/viper-mini-hid.js +273 -0
  226. package/dist/drivers/razer/viper-mini-hid.js.map +1 -0
  227. package/dist/drivers/razer/viper-v4-pro-hid.d.ts +26 -0
  228. package/dist/drivers/razer/viper-v4-pro-hid.d.ts.map +1 -0
  229. package/dist/drivers/razer/viper-v4-pro-hid.js +154 -0
  230. package/dist/drivers/razer/viper-v4-pro-hid.js.map +1 -0
  231. package/dist/drivers/registry.d.ts +70 -0
  232. package/dist/drivers/registry.d.ts.map +1 -0
  233. package/dist/drivers/registry.js +146 -0
  234. package/dist/drivers/registry.js.map +1 -0
  235. package/dist/drivers/steelseries/aerox3-hid.d.ts +53 -0
  236. package/dist/drivers/steelseries/aerox3-hid.d.ts.map +1 -0
  237. package/dist/drivers/steelseries/aerox3-hid.js +172 -0
  238. package/dist/drivers/steelseries/aerox3-hid.js.map +1 -0
  239. package/dist/drivers/steelseries/aerox5-hid.d.ts +54 -0
  240. package/dist/drivers/steelseries/aerox5-hid.d.ts.map +1 -0
  241. package/dist/drivers/steelseries/aerox5-hid.js +173 -0
  242. package/dist/drivers/steelseries/aerox5-hid.js.map +1 -0
  243. package/dist/drivers/steelseries/aerox5-wireless-hid.d.ts +69 -0
  244. package/dist/drivers/steelseries/aerox5-wireless-hid.d.ts.map +1 -0
  245. package/dist/drivers/steelseries/aerox5-wireless-hid.js +234 -0
  246. package/dist/drivers/steelseries/aerox5-wireless-hid.js.map +1 -0
  247. package/dist/drivers/steelseries/aerox9-wireless-hid.d.ts +70 -0
  248. package/dist/drivers/steelseries/aerox9-wireless-hid.d.ts.map +1 -0
  249. package/dist/drivers/steelseries/aerox9-wireless-hid.js +227 -0
  250. package/dist/drivers/steelseries/aerox9-wireless-hid.js.map +1 -0
  251. package/dist/drivers/steelseries/hid.d.ts +48 -0
  252. package/dist/drivers/steelseries/hid.d.ts.map +1 -0
  253. package/dist/drivers/steelseries/hid.js +157 -0
  254. package/dist/drivers/steelseries/hid.js.map +1 -0
  255. package/dist/drivers/steelseries/prime-mini-wireless-hid.d.ts +62 -0
  256. package/dist/drivers/steelseries/prime-mini-wireless-hid.d.ts.map +1 -0
  257. package/dist/drivers/steelseries/prime-mini-wireless-hid.js +215 -0
  258. package/dist/drivers/steelseries/prime-mini-wireless-hid.js.map +1 -0
  259. package/dist/drivers/steelseries/prime-plus-hid.d.ts +51 -0
  260. package/dist/drivers/steelseries/prime-plus-hid.d.ts.map +1 -0
  261. package/dist/drivers/steelseries/prime-plus-hid.js +150 -0
  262. package/dist/drivers/steelseries/prime-plus-hid.js.map +1 -0
  263. package/dist/drivers/steelseries/rival3-wireless-hid.d.ts +61 -0
  264. package/dist/drivers/steelseries/rival3-wireless-hid.d.ts.map +1 -0
  265. package/dist/drivers/steelseries/rival3-wireless-hid.js +185 -0
  266. package/dist/drivers/steelseries/rival3-wireless-hid.js.map +1 -0
  267. package/dist/drivers/steelseries/rival310-hid.d.ts +59 -0
  268. package/dist/drivers/steelseries/rival310-hid.d.ts.map +1 -0
  269. package/dist/drivers/steelseries/rival310-hid.js +182 -0
  270. package/dist/drivers/steelseries/rival310-hid.js.map +1 -0
  271. package/dist/drivers/steelseries/rival650-hid.d.ts +68 -0
  272. package/dist/drivers/steelseries/rival650-hid.d.ts.map +1 -0
  273. package/dist/drivers/steelseries/rival650-hid.js +209 -0
  274. package/dist/drivers/steelseries/rival650-hid.js.map +1 -0
  275. package/dist/drivers/steelseries/sensei-ten-hid.d.ts +62 -0
  276. package/dist/drivers/steelseries/sensei-ten-hid.d.ts.map +1 -0
  277. package/dist/drivers/steelseries/sensei-ten-hid.js +186 -0
  278. package/dist/drivers/steelseries/sensei-ten-hid.js.map +1 -0
  279. package/dist/drivers/teevolution/hid.d.ts +82 -0
  280. package/dist/drivers/teevolution/hid.d.ts.map +1 -0
  281. package/dist/drivers/teevolution/hid.js +607 -0
  282. package/dist/drivers/teevolution/hid.js.map +1 -0
  283. package/dist/drivers/vendors.d.ts +254 -0
  284. package/dist/drivers/vendors.d.ts.map +1 -0
  285. package/dist/drivers/vendors.js +587 -0
  286. package/dist/drivers/vendors.js.map +1 -0
  287. package/dist/drivers/vgn/hid.d.ts +33 -0
  288. package/dist/drivers/vgn/hid.d.ts.map +1 -0
  289. package/dist/drivers/vgn/hid.js +213 -0
  290. package/dist/drivers/vgn/hid.js.map +1 -0
  291. package/dist/drivers/wallhack/keyboard-hid.d.ts +28 -0
  292. package/dist/drivers/wallhack/keyboard-hid.d.ts.map +1 -0
  293. package/dist/drivers/wallhack/keyboard-hid.js +80 -0
  294. package/dist/drivers/wallhack/keyboard-hid.js.map +1 -0
  295. package/dist/drivers/wallhack/mouse-hid.d.ts +45 -0
  296. package/dist/drivers/wallhack/mouse-hid.d.ts.map +1 -0
  297. package/dist/drivers/wallhack/mouse-hid.js +288 -0
  298. package/dist/drivers/wallhack/mouse-hid.js.map +1 -0
  299. package/dist/drivers/webhid.d.ts +59 -0
  300. package/dist/drivers/webhid.d.ts.map +1 -0
  301. package/dist/drivers/webhid.js +2 -0
  302. package/dist/drivers/webhid.js.map +1 -0
  303. package/dist/drivers/wlmouse/hid.d.ts +81 -0
  304. package/dist/drivers/wlmouse/hid.d.ts.map +1 -0
  305. package/dist/drivers/wlmouse/hid.js +576 -0
  306. package/dist/drivers/wlmouse/hid.js.map +1 -0
  307. package/dist/drivers/wooting/hid.d.ts +86 -0
  308. package/dist/drivers/wooting/hid.d.ts.map +1 -0
  309. package/dist/drivers/wooting/hid.js +320 -0
  310. package/dist/drivers/wooting/hid.js.map +1 -0
  311. package/dist/drivers/zaunkoenig/hid.d.ts +31 -0
  312. package/dist/drivers/zaunkoenig/hid.d.ts.map +1 -0
  313. package/dist/drivers/zaunkoenig/hid.js +162 -0
  314. package/dist/drivers/zaunkoenig/hid.js.map +1 -0
  315. package/dist/endgame-gear/op1.d.ts +165 -0
  316. package/dist/endgame-gear/op1.d.ts.map +1 -0
  317. package/dist/endgame-gear/op1.js +384 -0
  318. package/dist/endgame-gear/op1.js.map +1 -0
  319. package/dist/endgame-gear/wireless.d.ts +93 -0
  320. package/dist/endgame-gear/wireless.d.ts.map +1 -0
  321. package/dist/endgame-gear/wireless.js +242 -0
  322. package/dist/endgame-gear/wireless.js.map +1 -0
  323. package/dist/fantech/index.d.ts +9 -0
  324. package/dist/fantech/index.d.ts.map +1 -0
  325. package/dist/fantech/index.js +11 -0
  326. package/dist/fantech/index.js.map +1 -0
  327. package/dist/finalmouse/index.d.ts +41 -0
  328. package/dist/finalmouse/index.d.ts.map +1 -0
  329. package/dist/finalmouse/index.js +106 -0
  330. package/dist/finalmouse/index.js.map +1 -0
  331. package/dist/gearhub/index.d.ts +210 -0
  332. package/dist/gearhub/index.d.ts.map +1 -0
  333. package/dist/gearhub/index.js +282 -0
  334. package/dist/gearhub/index.js.map +1 -0
  335. package/dist/glorious/index.d.ts +89 -0
  336. package/dist/glorious/index.d.ts.map +1 -0
  337. package/dist/glorious/index.js +236 -0
  338. package/dist/glorious/index.js.map +1 -0
  339. package/dist/glorious-classic/index.d.ts +103 -0
  340. package/dist/glorious-classic/index.d.ts.map +1 -0
  341. package/dist/glorious-classic/index.js +304 -0
  342. package/dist/glorious-classic/index.js.map +1 -0
  343. package/dist/gwolves/index.d.ts +82 -0
  344. package/dist/gwolves/index.d.ts.map +1 -0
  345. package/dist/gwolves/index.js +197 -0
  346. package/dist/gwolves/index.js.map +1 -0
  347. package/dist/hyperx/index.d.ts +181 -0
  348. package/dist/hyperx/index.d.ts.map +1 -0
  349. package/dist/hyperx/index.js +303 -0
  350. package/dist/hyperx/index.js.map +1 -0
  351. package/dist/incott/index.d.ts +1067 -0
  352. package/dist/incott/index.d.ts.map +1 -0
  353. package/dist/incott/index.js +1482 -0
  354. package/dist/incott/index.js.map +1 -0
  355. package/dist/index.d.ts +30 -0
  356. package/dist/index.d.ts.map +1 -0
  357. package/dist/index.js +30 -0
  358. package/dist/index.js.map +1 -0
  359. package/dist/keychron/index.d.ts +194 -0
  360. package/dist/keychron/index.d.ts.map +1 -0
  361. package/dist/keychron/index.js +341 -0
  362. package/dist/keychron/index.js.map +1 -0
  363. package/dist/ksnake/index.d.ts +157 -0
  364. package/dist/ksnake/index.d.ts.map +1 -0
  365. package/dist/ksnake/index.js +314 -0
  366. package/dist/ksnake/index.js.map +1 -0
  367. package/dist/lamzu/atlantis.d.ts +237 -0
  368. package/dist/lamzu/atlantis.d.ts.map +1 -0
  369. package/dist/lamzu/atlantis.js +263 -0
  370. package/dist/lamzu/atlantis.js.map +1 -0
  371. package/dist/lamzu/index.d.ts +60 -0
  372. package/dist/lamzu/index.d.ts.map +1 -0
  373. package/dist/lamzu/index.js +86 -0
  374. package/dist/lamzu/index.js.map +1 -0
  375. package/dist/logitech/controls.d.ts +138 -0
  376. package/dist/logitech/controls.d.ts.map +1 -0
  377. package/dist/logitech/controls.js +184 -0
  378. package/dist/logitech/controls.js.map +1 -0
  379. package/dist/logitech/friendly-name.d.ts +50 -0
  380. package/dist/logitech/friendly-name.d.ts.map +1 -0
  381. package/dist/logitech/friendly-name.js +74 -0
  382. package/dist/logitech/friendly-name.js.map +1 -0
  383. package/dist/logitech/haptics.d.ts +97 -0
  384. package/dist/logitech/haptics.d.ts.map +1 -0
  385. package/dist/logitech/haptics.js +116 -0
  386. package/dist/logitech/haptics.js.map +1 -0
  387. package/dist/logitech/hosts.d.ts +55 -0
  388. package/dist/logitech/hosts.d.ts.map +1 -0
  389. package/dist/logitech/hosts.js +80 -0
  390. package/dist/logitech/hosts.js.map +1 -0
  391. package/dist/logitech/index.d.ts +127 -0
  392. package/dist/logitech/index.d.ts.map +1 -0
  393. package/dist/logitech/index.js +233 -0
  394. package/dist/logitech/index.js.map +1 -0
  395. package/dist/logitech/wheel.d.ts +117 -0
  396. package/dist/logitech/wheel.d.ts.map +1 -0
  397. package/dist/logitech/wheel.js +133 -0
  398. package/dist/logitech/wheel.js.map +1 -0
  399. package/dist/mchose/a5-gen1.d.ts +38 -0
  400. package/dist/mchose/a5-gen1.d.ts.map +1 -0
  401. package/dist/mchose/a5-gen1.js +60 -0
  402. package/dist/mchose/a5-gen1.js.map +1 -0
  403. package/dist/mchose/buttons.d.ts +66 -0
  404. package/dist/mchose/buttons.d.ts.map +1 -0
  405. package/dist/mchose/buttons.js +184 -0
  406. package/dist/mchose/buttons.js.map +1 -0
  407. package/dist/mchose/dock.d.ts +77 -0
  408. package/dist/mchose/dock.d.ts.map +1 -0
  409. package/dist/mchose/dock.js +133 -0
  410. package/dist/mchose/dock.js.map +1 -0
  411. package/dist/mchose/index.d.ts +299 -0
  412. package/dist/mchose/index.d.ts.map +1 -0
  413. package/dist/mchose/index.js +429 -0
  414. package/dist/mchose/index.js.map +1 -0
  415. package/dist/mchose/v3-buttons.d.ts +64 -0
  416. package/dist/mchose/v3-buttons.d.ts.map +1 -0
  417. package/dist/mchose/v3-buttons.js +258 -0
  418. package/dist/mchose/v3-buttons.js.map +1 -0
  419. package/dist/mchose/v3.d.ts +380 -0
  420. package/dist/mchose/v3.d.ts.map +1 -0
  421. package/dist/mchose/v3.js +608 -0
  422. package/dist/mchose/v3.js.map +1 -0
  423. package/dist/microsoft/index.d.ts +19 -0
  424. package/dist/microsoft/index.d.ts.map +1 -0
  425. package/dist/microsoft/index.js +22 -0
  426. package/dist/microsoft/index.js.map +1 -0
  427. package/dist/moddo/index.d.ts +72 -0
  428. package/dist/moddo/index.d.ts.map +1 -0
  429. package/dist/moddo/index.js +147 -0
  430. package/dist/moddo/index.js.map +1 -0
  431. package/dist/ninjutso/index.d.ts +74 -0
  432. package/dist/ninjutso/index.d.ts.map +1 -0
  433. package/dist/ninjutso/index.js +133 -0
  434. package/dist/ninjutso/index.js.map +1 -0
  435. package/dist/orbital/index.d.ts +14 -0
  436. package/dist/orbital/index.d.ts.map +1 -0
  437. package/dist/orbital/index.js +19 -0
  438. package/dist/orbital/index.js.map +1 -0
  439. package/dist/pulsar/index.d.ts +81 -0
  440. package/dist/pulsar/index.d.ts.map +1 -0
  441. package/dist/pulsar/index.js +185 -0
  442. package/dist/pulsar/index.js.map +1 -0
  443. package/dist/rawm/index.d.ts +55 -0
  444. package/dist/rawm/index.d.ts.map +1 -0
  445. package/dist/rawm/index.js +229 -0
  446. package/dist/rawm/index.js.map +1 -0
  447. package/dist/razer/codec.d.ts +504 -0
  448. package/dist/razer/codec.d.ts.map +1 -0
  449. package/dist/razer/codec.js +648 -0
  450. package/dist/razer/codec.js.map +1 -0
  451. package/dist/razer/devices.d.ts +156 -0
  452. package/dist/razer/devices.d.ts.map +1 -0
  453. package/dist/razer/devices.js +540 -0
  454. package/dist/razer/devices.js.map +1 -0
  455. package/dist/razer/index.d.ts +2 -0
  456. package/dist/razer/index.d.ts.map +1 -0
  457. package/dist/razer/index.js +2 -0
  458. package/dist/razer/index.js.map +1 -0
  459. package/dist/razer/v4.d.ts +19 -0
  460. package/dist/razer/v4.d.ts.map +1 -0
  461. package/dist/razer/v4.js +51 -0
  462. package/dist/razer/v4.js.map +1 -0
  463. package/dist/steelseries/aerox3.d.ts +236 -0
  464. package/dist/steelseries/aerox3.d.ts.map +1 -0
  465. package/dist/steelseries/aerox3.js +311 -0
  466. package/dist/steelseries/aerox3.js.map +1 -0
  467. package/dist/steelseries/aerox5-wireless.d.ts +300 -0
  468. package/dist/steelseries/aerox5-wireless.d.ts.map +1 -0
  469. package/dist/steelseries/aerox5-wireless.js +389 -0
  470. package/dist/steelseries/aerox5-wireless.js.map +1 -0
  471. package/dist/steelseries/aerox5.d.ts +228 -0
  472. package/dist/steelseries/aerox5.d.ts.map +1 -0
  473. package/dist/steelseries/aerox5.js +294 -0
  474. package/dist/steelseries/aerox5.js.map +1 -0
  475. package/dist/steelseries/aerox9-wireless.d.ts +213 -0
  476. package/dist/steelseries/aerox9-wireless.d.ts.map +1 -0
  477. package/dist/steelseries/aerox9-wireless.js +305 -0
  478. package/dist/steelseries/aerox9-wireless.js.map +1 -0
  479. package/dist/steelseries/devices.d.ts +82 -0
  480. package/dist/steelseries/devices.d.ts.map +1 -0
  481. package/dist/steelseries/devices.js +310 -0
  482. package/dist/steelseries/devices.js.map +1 -0
  483. package/dist/steelseries/index.d.ts +13 -0
  484. package/dist/steelseries/index.d.ts.map +1 -0
  485. package/dist/steelseries/index.js +13 -0
  486. package/dist/steelseries/index.js.map +1 -0
  487. package/dist/steelseries/prime-mini-wireless.d.ts +253 -0
  488. package/dist/steelseries/prime-mini-wireless.d.ts.map +1 -0
  489. package/dist/steelseries/prime-mini-wireless.js +351 -0
  490. package/dist/steelseries/prime-mini-wireless.js.map +1 -0
  491. package/dist/steelseries/prime-plus.d.ts +179 -0
  492. package/dist/steelseries/prime-plus.d.ts.map +1 -0
  493. package/dist/steelseries/prime-plus.js +275 -0
  494. package/dist/steelseries/prime-plus.js.map +1 -0
  495. package/dist/steelseries/rival3-wireless.d.ts +222 -0
  496. package/dist/steelseries/rival3-wireless.d.ts.map +1 -0
  497. package/dist/steelseries/rival3-wireless.js +308 -0
  498. package/dist/steelseries/rival3-wireless.js.map +1 -0
  499. package/dist/steelseries/rival3.d.ts +99 -0
  500. package/dist/steelseries/rival3.d.ts.map +1 -0
  501. package/dist/steelseries/rival3.js +147 -0
  502. package/dist/steelseries/rival3.js.map +1 -0
  503. package/dist/steelseries/rival310.d.ts +230 -0
  504. package/dist/steelseries/rival310.d.ts.map +1 -0
  505. package/dist/steelseries/rival310.js +322 -0
  506. package/dist/steelseries/rival310.js.map +1 -0
  507. package/dist/steelseries/rival650.d.ts +215 -0
  508. package/dist/steelseries/rival650.d.ts.map +1 -0
  509. package/dist/steelseries/rival650.js +284 -0
  510. package/dist/steelseries/rival650.js.map +1 -0
  511. package/dist/steelseries/sensei-ten.d.ts +283 -0
  512. package/dist/steelseries/sensei-ten.d.ts.map +1 -0
  513. package/dist/steelseries/sensei-ten.js +389 -0
  514. package/dist/steelseries/sensei-ten.js.map +1 -0
  515. package/dist/teevolution/index.d.ts +211 -0
  516. package/dist/teevolution/index.d.ts.map +1 -0
  517. package/dist/teevolution/index.js +458 -0
  518. package/dist/teevolution/index.js.map +1 -0
  519. package/dist/valkyrie/index.d.ts +19 -0
  520. package/dist/valkyrie/index.d.ts.map +1 -0
  521. package/dist/valkyrie/index.js +43 -0
  522. package/dist/valkyrie/index.js.map +1 -0
  523. package/dist/valkyrie/settings.d.ts +28 -0
  524. package/dist/valkyrie/settings.d.ts.map +1 -0
  525. package/dist/valkyrie/settings.js +84 -0
  526. package/dist/valkyrie/settings.js.map +1 -0
  527. package/dist/vgn/index.d.ts +59 -0
  528. package/dist/vgn/index.d.ts.map +1 -0
  529. package/dist/vgn/index.js +165 -0
  530. package/dist/vgn/index.js.map +1 -0
  531. package/dist/wallhack/index.d.ts +165 -0
  532. package/dist/wallhack/index.d.ts.map +1 -0
  533. package/dist/wallhack/index.js +226 -0
  534. package/dist/wallhack/index.js.map +1 -0
  535. package/dist/wlmouse/index.d.ts +4 -0
  536. package/dist/wlmouse/index.d.ts.map +1 -0
  537. package/dist/wlmouse/index.js +7 -0
  538. package/dist/wlmouse/index.js.map +1 -0
  539. package/dist/wooting/index.d.ts +225 -0
  540. package/dist/wooting/index.d.ts.map +1 -0
  541. package/dist/wooting/index.js +296 -0
  542. package/dist/wooting/index.js.map +1 -0
  543. package/dist/zaunkoenig/index.d.ts +49 -0
  544. package/dist/zaunkoenig/index.d.ts.map +1 -0
  545. package/dist/zaunkoenig/index.js +127 -0
  546. package/dist/zaunkoenig/index.js.map +1 -0
  547. package/package.json +193 -0
@@ -0,0 +1,648 @@
1
+ /**
2
+ * Razer control protocol: 90-byte feature reports exchanged on report ID 0.
3
+ *
4
+ * Razer does not declare this report in its HID descriptor, so the collection
5
+ * carries no feature report of its own; the exchange still succeeds because
6
+ * WebHID does not validate report IDs against the descriptor. The control
7
+ * interface is the one whose only collection is Generic Desktop Mouse.
8
+ */
9
+ export const RAZER_REPORT_ID = 0;
10
+ export const RAZER_PACKET_LENGTH = 90;
11
+ /**
12
+ * Razer's three transaction ids.
13
+ *
14
+ * Named by value on purpose. They carry no meaning beyond "which firmware
15
+ * generation answers to this", they do not order neatly by device age, and
16
+ * every name that tried to describe them has been wrong: `_LEGACY` for `0x3f`
17
+ * read as "the oldest one" when `0xff` is older, and `_DEFAULT` for `0xff`
18
+ * read as "use this when unsure" when there is no safe default at all. A
19
+ * mismatch is silent — the mouse simply never replies — so every product must
20
+ * state its own id and none may be inferred from a family name.
21
+ *
22
+ * The same three values are what OpenRazer's driver selects between, and what
23
+ * the reference notes type as `"ff" | "3f" | "1f"`.
24
+ */
25
+ export const RAZER_TRANSACTION_ID_FF = 0xff;
26
+ export const RAZER_TRANSACTION_ID_3F = 0x3f;
27
+ export const RAZER_TRANSACTION_ID_1F = 0x1f;
28
+ /**
29
+ * Default for `encodeRazerRequest`. Verified against Viper V3 Pro firmware 1.12
30
+ * on both transports; the per-product table overrides it for everything else.
31
+ */
32
+ export const RAZER_TRANSACTION_ID = RAZER_TRANSACTION_ID_1F;
33
+ /**
34
+ * The button-mapping write (class `0x02`) is the one command on this mouse
35
+ * that rejects `RAZER_TRANSACTION_ID` silently: status `0x02` (ok), the
36
+ * read-back even changes, but the physical button keeps its old function.
37
+ * Confirmed on hardware by writing a plain mouse-button action, pressing the
38
+ * button, and finding it unchanged with `0x1f` and correct with any other id
39
+ * (`0x02` and `0x10` both round-tripped and worked physically). Every other
40
+ * write on this mouse uses `0x1f` without issue, so this is specific to class
41
+ * `0x02` rather than a general transport quirk.
42
+ */
43
+ export const RAZER_BUTTON_TRANSACTION_ID = 0x10;
44
+ const ARGS_OFFSET = 8;
45
+ const CHECKSUM_INDEX = 88;
46
+ const CHECKSUM_FIRST = 2;
47
+ const CHECKSUM_LAST = 88;
48
+ const STAGE_OFFSET = 3;
49
+ const STAGE_LENGTH = 7;
50
+ const BATTERY_SCALE = 255;
51
+ export const RAZER_STATUS = {
52
+ busy: 0x01,
53
+ ok: 0x02,
54
+ failure: 0x03,
55
+ timeout: 0x04,
56
+ unsupported: 0x05,
57
+ };
58
+ /**
59
+ * Razer selects a value store per command. Firmware 1.12 reports the same DPI
60
+ * from either store, and writes were confirmed against this one, so reads and
61
+ * writes both use it rather than risking a stale read from the other. The V2
62
+ * generation (DeathAdder V2 and its siblings) reads and writes through
63
+ * NOSTORE (`0x00`) instead, which OpenRazer's driver selects per device.
64
+ */
65
+ export const RAZER_STORAGE = 0x01;
66
+ /** The underglow's led id in openrazer's extended-matrix family. */
67
+ const RAZER_LED_LOGO = 0x04;
68
+ /** Read-only commands confirmed against Viper V3 Pro firmware 1.12. */
69
+ export const RAZER_READ = {
70
+ firmware: { commandClass: 0x00, commandId: 0x81, dataSize: 0x02 },
71
+ serial: { commandClass: 0x00, commandId: 0x82, dataSize: 0x16 },
72
+ battery: { commandClass: 0x07, commandId: 0x80, dataSize: 0x02 },
73
+ charging: { commandClass: 0x07, commandId: 0x84, dataSize: 0x02 },
74
+ sleepTimeout: { commandClass: 0x07, commandId: 0x83, dataSize: 0x02 },
75
+ lowPowerThreshold: { commandClass: 0x07, commandId: 0x81, dataSize: 0x02 },
76
+ dpi: { commandClass: 0x04, commandId: 0x85, dataSize: 0x07, args: [RAZER_STORAGE] },
77
+ dpiStages: { commandClass: 0x04, commandId: 0x86, dataSize: 0x26, args: [0x00] },
78
+ pollingRate: { commandClass: 0x00, commandId: 0x85, dataSize: 0x01 },
79
+ pollingRateExtended: { commandClass: 0x00, commandId: 0xc0, dataSize: 0x02, args: [0x00] },
80
+ liftOff: { commandClass: 0x0b, commandId: 0x85, dataSize: 0x05 },
81
+ /**
82
+ * One control's button mapping. `args` is `[0x01, controlIndex, layer]`.
83
+ * `controlIndex` reliably selects the right control — confirmed by reading
84
+ * several controls back to back and always getting that control's own data.
85
+ * `layer` is not honored the same way: requesting Hypershift (`0x01`) for a
86
+ * control whose Standard mapping was just read back returned the Standard
87
+ * value again. Only Standard-layer reads are trusted.
88
+ */
89
+ buttonMapping: { commandClass: 0x02, commandId: 0x8c, dataSize: 0x0a },
90
+ };
91
+ /**
92
+ * Write commands confirmed against Viper V3 Pro firmware 1.12.
93
+ *
94
+ * Razer pairs each read with a write that clears the high bit of the command
95
+ * id. Only commands verified on hardware belong here — in particular the DPI
96
+ * stage table (`0x04`/`0x06`) is absent on purpose, because a wrong length
97
+ * there is the one realistic way to corrupt stored settings.
98
+ */
99
+ export const RAZER_WRITE = {
100
+ dpi: { commandClass: 0x04, commandId: 0x05, dataSize: 0x07 },
101
+ pollingRate: { commandClass: 0x00, commandId: 0x05, dataSize: 0x01 },
102
+ pollingRateExtended: { commandClass: 0x00, commandId: 0x40, dataSize: 0x02 },
103
+ liftOff: { commandClass: 0x0b, commandId: 0x05, dataSize: 0x0a },
104
+ sensorSetting: { commandClass: 0x0b, commandId: 0x0b, dataSize: 0x04 },
105
+ sleepTimeout: { commandClass: 0x07, commandId: 0x03, dataSize: 0x02 },
106
+ lowPowerThreshold: { commandClass: 0x07, commandId: 0x01, dataSize: 0x02 },
107
+ /**
108
+ * Silently rejects `RAZER_TRANSACTION_ID` — see `RAZER_BUTTON_TRANSACTION_ID`.
109
+ * `razerSetButtonMappingCommand` and `razerSetToggleControlCommand` are the
110
+ * only places that should build this.
111
+ *
112
+ * **Stored in device memory, not volatile.** Confirmed on a Viper V3 Pro
113
+ * (`0x00c1`): Mouse Button 4 was disabled, the host application closed, the
114
+ * mouse powered off at its switch for 10 seconds and powered back on. The
115
+ * button was still dead on reconnect and the read reported Disabled, with
116
+ * Synapse never running. So a caller does not need to re-apply mappings
117
+ * after a power cycle, and a user's change survives independently of any
118
+ * host software.
119
+ *
120
+ * The leading argument byte is always `0x01` here. On this device `0x01` is
121
+ * also `RAZER_STORAGE`, the persistent store DPI writes through, which makes
122
+ * a storage selector the obvious reading — but that byte has never been
123
+ * varied on this command, so it is recorded as an unknown rather than
124
+ * assigned that meaning.
125
+ */
126
+ buttonMapping: {
127
+ commandClass: 0x02,
128
+ commandId: 0x0c,
129
+ dataSize: 0x0a,
130
+ transactionId: RAZER_BUTTON_TRANSACTION_ID,
131
+ },
132
+ };
133
+ export function razerSetDpiCommand(x, y, storageByte = RAZER_STORAGE) {
134
+ return {
135
+ ...RAZER_WRITE.dpi,
136
+ args: [storageByte, (x >> 8) & 0xff, x & 0xff, (y >> 8) & 0xff, y & 0xff, 0x00, 0x00],
137
+ };
138
+ }
139
+ /**
140
+ * The DPI read, parameterized by the store byte. The V3 family reads the
141
+ * storage byte (`0x01`), but the V2 generation reads the no-store byte (`0x00`)
142
+ * — OpenRazer's driver calls `get_dpi_xy(NOSTORE)` for them — so the shared
143
+ * `RAZER_READ.dpi` cannot be used verbatim.
144
+ */
145
+ export function razerReadDpiCommand(storageByte = RAZER_STORAGE) {
146
+ return { ...RAZER_READ.dpi, args: [storageByte] };
147
+ }
148
+ /** Seconds, big-endian, in the same encoding the matching read returns. */
149
+ export function razerSetSleepTimeoutCommand(seconds) {
150
+ return { ...RAZER_WRITE.sleepTimeout, args: [(seconds >> 8) & 0xff, seconds & 0xff] };
151
+ }
152
+ /**
153
+ * The payload mirrors the matching read byte for byte: the level on the 0–255
154
+ * scale first, then a trailing zero. Confirmed on hardware by writing 85% and
155
+ * finding `d9 00` still held after a reload.
156
+ */
157
+ export function razerSetLowPowerThresholdCommand(percent) {
158
+ return { ...RAZER_WRITE.lowPowerThreshold, args: [encodeBatteryLevel(percent), 0x00] };
159
+ }
160
+ function pollingDivisor(ceiling, pollingRateHz) {
161
+ const divisor = ceiling / pollingRateHz;
162
+ if (!Number.isInteger(divisor) || divisor < 1 || divisor > 0xff) {
163
+ throw new RazerProtocolError(`${pollingRateHz} Hz is not a rate this mouse can encode.`);
164
+ }
165
+ return divisor;
166
+ }
167
+ export function razerSetLegacyPollingCommand(pollingRateHz) {
168
+ return { ...RAZER_WRITE.pollingRate, args: [pollingDivisor(1000, pollingRateHz)] };
169
+ }
170
+ /** The receiver takes the same leading argument its read echoes back. */
171
+ export function razerSetExtendedPollingCommand(pollingRateHz) {
172
+ return { ...RAZER_WRITE.pollingRateExtended, args: [0x00, pollingDivisor(8000, pollingRateHz)] };
173
+ }
174
+ /** Effect ids from openrazer's `razer_chroma_extended_matrix_effect_*` family. */
175
+ export const RAZER_EFFECT = {
176
+ off: 0x00,
177
+ static: 0x01,
178
+ spectrum: 0x03,
179
+ reactive: 0x05,
180
+ "breathing-random": 0x02,
181
+ "breathing-single": 0x02,
182
+ "breathing-dual": 0x02,
183
+ };
184
+ /** Synapse's reactive speed scale: 1 is fast, 4 is slow. */
185
+ export const RAZER_EFFECT_SPEED = { 1: 1, 2: 2, 3: 3, 4: 4 };
186
+ export function parseRazerColor(hex) {
187
+ const match = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
188
+ if (!match)
189
+ throw new RazerProtocolError(`${hex} is not a "#rrggbb" colour.`);
190
+ const value = Number.parseInt(match[1], 16);
191
+ return [(value >> 16) & 0xff, (value >> 8) & 0xff, value & 0xff];
192
+ }
193
+ /**
194
+ * Extended effect command for the Viper Mini's extended-matrix family (`0x0f` /
195
+ * `0x02`), matching openrazer's `razer_chroma_extended_matrix_effect_*`
196
+ * functions, which this mouse dispatches through with `VARSTORE` and the logo
197
+ * led. The mouse's one 1x1 matrix means a single underglow zone.
198
+ *
199
+ * All effects share the `[VARSTORE, logo, effect]` header. Breathing variants
200
+ * differ only in the colour count byte and payload length, and reactive adds a
201
+ * speed level between the header and its single colour.
202
+ */
203
+ export function razerSetExtendedEffectCommand(effect, options = {}) {
204
+ const args = [RAZER_STORAGE, RAZER_LED_LOGO, RAZER_EFFECT[effect]];
205
+ switch (effect) {
206
+ case "off":
207
+ case "spectrum":
208
+ case "breathing-random":
209
+ args.push(0x00, 0x00, 0x00);
210
+ break;
211
+ case "static":
212
+ if (!options.color)
213
+ throw new RazerProtocolError(`${effect} needs a colour.`);
214
+ args.push(0x00, 0x00, 0x01, ...parseRazerColor(options.color));
215
+ break;
216
+ case "reactive":
217
+ if (!options.color)
218
+ throw new RazerProtocolError(`${effect} needs a colour.`);
219
+ if (!options.speed)
220
+ throw new RazerProtocolError("Reactive needs a speed.");
221
+ args.push(0x00, RAZER_EFFECT_SPEED[options.speed], 0x01, ...parseRazerColor(options.color));
222
+ break;
223
+ case "breathing-single":
224
+ if (!options.color)
225
+ throw new RazerProtocolError("Breathing single needs a colour.");
226
+ args.push(0x01, 0x00, 0x01, ...parseRazerColor(options.color));
227
+ break;
228
+ case "breathing-dual":
229
+ if (!options.color || !options.color2)
230
+ throw new RazerProtocolError("Breathing dual needs two colours.");
231
+ args.push(0x02, 0x00, 0x02, ...parseRazerColor(options.color), ...parseRazerColor(options.color2));
232
+ break;
233
+ }
234
+ return {
235
+ commandClass: 0x0f,
236
+ commandId: 0x02,
237
+ dataSize: args.length,
238
+ args,
239
+ };
240
+ }
241
+ export class RazerProtocolError extends Error {
242
+ status;
243
+ /**
244
+ * The reply belonged to an earlier exchange, so re-reading may still find the
245
+ * right one. Distinct from a failure status, which the mouse meant for us.
246
+ */
247
+ stale;
248
+ constructor(message, status = null, stale = false) {
249
+ super(message);
250
+ this.name = "RazerProtocolError";
251
+ this.status = status;
252
+ this.stale = stale;
253
+ }
254
+ }
255
+ /**
256
+ * Razer pairs each read with a write that clears the high bit of the command
257
+ * id, so the bit is what separates a question from an instruction. Repeating a
258
+ * question costs nothing; repeating an instruction is what the reference means
259
+ * by "do not automatically retry writes".
260
+ */
261
+ export function isRazerGetter(command) {
262
+ return (command.commandId & 0x80) !== 0;
263
+ }
264
+ export function razerChecksum(packet) {
265
+ let checksum = 0;
266
+ for (let index = CHECKSUM_FIRST; index < CHECKSUM_LAST; index += 1)
267
+ checksum ^= packet[index];
268
+ return checksum;
269
+ }
270
+ export function encodeRazerRequest(command, transactionId = RAZER_TRANSACTION_ID) {
271
+ const packet = new Uint8Array(RAZER_PACKET_LENGTH);
272
+ packet[1] = transactionId;
273
+ packet[5] = command.dataSize;
274
+ packet[6] = command.commandClass;
275
+ packet[7] = command.commandId;
276
+ packet.set(command.args ?? [], ARGS_OFFSET);
277
+ packet[CHECKSUM_INDEX] = razerChecksum(packet);
278
+ return packet;
279
+ }
280
+ function describe(command, problem) {
281
+ const hex = (value) => `0x${value.toString(16).padStart(2, "0")}`;
282
+ return `Class ${hex(command.commandClass)} command ${hex(command.commandId)} ${problem}.`;
283
+ }
284
+ /** Returns the reply arguments, or throws with the reported status. */
285
+ export function decodeRazerResponse(packet, command) {
286
+ if (packet.length !== RAZER_PACKET_LENGTH) {
287
+ throw new RazerProtocolError(describe(command, `returned ${packet.length} bytes instead of ${RAZER_PACKET_LENGTH}`));
288
+ }
289
+ if (packet[CHECKSUM_INDEX] !== razerChecksum(packet)) {
290
+ throw new RazerProtocolError(describe(command, "returned a reply with a bad checksum"));
291
+ }
292
+ const status = packet[0];
293
+ if (status === RAZER_STATUS.unsupported) {
294
+ throw new RazerProtocolError(describe(command, "is not supported by this mouse"), status);
295
+ }
296
+ if (status !== RAZER_STATUS.ok) {
297
+ throw new RazerProtocolError(describe(command, `returned status ${`0x${status.toString(16).padStart(2, "0")}`}`), status);
298
+ }
299
+ if (packet[6] !== command.commandClass || packet[7] !== command.commandId) {
300
+ throw new RazerProtocolError(describe(command, "was answered by a different command"), status, true);
301
+ }
302
+ const length = Math.min(packet[5], RAZER_PACKET_LENGTH - ARGS_OFFSET);
303
+ return packet.slice(ARGS_OFFSET, ARGS_OFFSET + length);
304
+ }
305
+ export function decodeFirmwareVersion(args) {
306
+ return `${args[0]}.${args[1]}`;
307
+ }
308
+ export function decodeSerial(args) {
309
+ let text = "";
310
+ for (const byte of args) {
311
+ if (byte === 0)
312
+ break;
313
+ text += String.fromCharCode(byte);
314
+ }
315
+ return text.trim();
316
+ }
317
+ export function decodeBatteryPercent(args) {
318
+ return Math.round((args[1] * 100) / BATTERY_SCALE);
319
+ }
320
+ /**
321
+ * The low-power threshold shares the battery level's 0–255 scale rather than
322
+ * being a percentage, so 0x4d is 30% and reading it as a percent is wrong by a
323
+ * factor of two and a half.
324
+ *
325
+ * It also sits in the *first* argument byte, where battery, charging and sleep
326
+ * all pad with a leading zero and answer in the second. The mouse replied
327
+ * `4d 00` where Synapse showed 30%, so the class is not consistent about this
328
+ * and the shared decoder cannot be reused.
329
+ */
330
+ export function decodeLowPowerThreshold(args) {
331
+ return Math.round((args[0] * 100) / BATTERY_SCALE);
332
+ }
333
+ export function encodeBatteryLevel(percent) {
334
+ return Math.round((percent * BATTERY_SCALE) / 100);
335
+ }
336
+ export function decodeCharging(args) {
337
+ return args[1] === 1;
338
+ }
339
+ /**
340
+ * Idle sleep is a whole number of seconds, unlike battery and charging in the
341
+ * same class, which pad their one meaningful byte with a leading zero.
342
+ */
343
+ export function decodeSleepTimeout(args) {
344
+ return (args[0] << 8) | args[1];
345
+ }
346
+ export function decodeDpi(args) {
347
+ return { x: (args[1] << 8) | args[2], y: (args[3] << 8) | args[4] };
348
+ }
349
+ export function decodeDpiStages(args) {
350
+ const count = args[2];
351
+ const stages = [];
352
+ for (let index = 0; index < count; index += 1) {
353
+ const offset = STAGE_OFFSET + index * STAGE_LENGTH;
354
+ if (offset + 4 >= args.length)
355
+ break;
356
+ stages.push({
357
+ x: (args[offset + 1] << 8) | args[offset + 2],
358
+ y: (args[offset + 3] << 8) | args[offset + 4],
359
+ });
360
+ }
361
+ return { active: args[1], stages };
362
+ }
363
+ /** Indexed by the byte the mouse reports, so the order is the encoding. */
364
+ export const RAZER_TRACKING_DISTANCES = ["Low", "Medium", "High"];
365
+ /** Synapse's own numbering. Landing must stay strictly below lift-off. */
366
+ export const RAZER_LIFT_OFF_MIN = 2;
367
+ export const RAZER_LIFT_OFF_MAX = 26;
368
+ export const RAZER_LANDING_MIN = 1;
369
+ export const RAZER_LANDING_MAX = 25;
370
+ /**
371
+ * Second argument of every class 0x0b write the vendor software was observed
372
+ * making. It reads as a feature selector — smart tracking — and the mouse
373
+ * rejects the packet without it.
374
+ */
375
+ const RAZER_SENSOR_SELECTOR = 0x04;
376
+ /**
377
+ * Third argument of `0x0b`/`0x0b`, choosing which setting the fourth carries.
378
+ * Both were read off the vendor software's own traffic and confirmed on
379
+ * hardware.
380
+ */
381
+ const RAZER_SENSOR_SETTING = {
382
+ trackingDistance: 0x01,
383
+ asymmetric: 0x04,
384
+ };
385
+ /**
386
+ * Both asymmetric levels are stored one below the number Synapse displays, so
387
+ * lift-off 26 is 0x19 and landing 25 is 0x18. Confirmed at 5/4, 16/11 and 26/25,
388
+ * with the middle reading predicted before it was measured.
389
+ *
390
+ * Byte[0] echoes whatever argument the request carried and byte[1] was zero in
391
+ * every capture, so neither is read here — arguments 0x00 through 0x07 all
392
+ * returned the same levels, which rules out a per-profile store.
393
+ */
394
+ export function decodeLiftOff(args) {
395
+ return {
396
+ tracking: RAZER_TRACKING_DISTANCES[args[2]] ?? null,
397
+ liftOff: args[3] + 1,
398
+ landing: args[4] + 1,
399
+ };
400
+ }
401
+ /**
402
+ * The highest landing a given lift-off permits: lift-off 10 allows 9, and so on
403
+ * down to the floor of 1.
404
+ *
405
+ * Landing is bounded by lift-off rather than locked to it — the vendor software
406
+ * caps its own slider the same way, and 16/11 is a perfectly ordinary pair. The
407
+ * firmware stores an inverted pair without complaint, and one session left the
408
+ * mouse holding lift-off 2 with landing 26, which the vendor software cannot
409
+ * even express. Nothing downstream catches that, so the rule is enforced here.
410
+ */
411
+ export function razerMaxLanding(liftOff) {
412
+ return Math.min(RAZER_LANDING_MAX, Math.max(RAZER_LANDING_MIN, liftOff - 1));
413
+ }
414
+ /**
415
+ * Selects the mouse's symmetric tracking distance, and by doing so switches it
416
+ * out of asymmetric mode.
417
+ *
418
+ * The mouse has no readable mode bit and no mode flag to set. It honours
419
+ * whichever of the two stores was written most recently, so writing a tracking
420
+ * level *is* the way to return to symmetric — confirmed by the asymmetric pair
421
+ * write being rejected immediately afterwards.
422
+ */
423
+ export function razerSetTrackingDistanceCommand(distance) {
424
+ const level = RAZER_TRACKING_DISTANCES.indexOf(distance);
425
+ if (level < 0)
426
+ throw new RazerProtocolError(`${distance} is not a tracking distance this mouse offers.`);
427
+ return {
428
+ ...RAZER_WRITE.sensorSetting,
429
+ args: [0x00, RAZER_SENSOR_SELECTOR, RAZER_SENSOR_SETTING.trackingDistance, level],
430
+ };
431
+ }
432
+ /**
433
+ * Unlocks the asymmetric pair write, which the mouse rejects with status `0x03`
434
+ * in symmetric mode — and rejects while still moving what the read reports, so
435
+ * skipping this produces a driver that appears to work and never touches the
436
+ * sensor.
437
+ *
438
+ * There is no matching disable. Sending value `0x00` was accepted and changed
439
+ * nothing; the vendor software leaves asymmetric mode by writing a tracking
440
+ * level instead, which is what `razerSetTrackingDistanceCommand` does.
441
+ */
442
+ export function razerEnableAsymmetricLiftOffCommand() {
443
+ return {
444
+ ...RAZER_WRITE.sensorSetting,
445
+ args: [0x00, RAZER_SENSOR_SELECTOR, RAZER_SENSOR_SETTING.asymmetric, 0x01],
446
+ };
447
+ }
448
+ /**
449
+ * Canonical asymmetric lift-off unlock: the same sensor-setting write as
450
+ * `razerEnableAsymmetricLiftOffCommand` with value `0x00`. The 1.14 sweep found
451
+ * both values arm the pair write, but only the `0x01` form is verified on
452
+ * 1.12, so this is the driver's fallback arm, never the shipped form.
453
+ */
454
+ export function razerEnableAsymmetricLiftOffCanonicalCommand() {
455
+ return {
456
+ ...RAZER_WRITE.sensorSetting,
457
+ args: [0x00, RAZER_SENSOR_SELECTOR, RAZER_SENSOR_SETTING.asymmetric, 0x00],
458
+ };
459
+ }
460
+ /**
461
+ * Calibration-mode-on step, `0x0b`/`0x03` `00 04 01`. Not required on the
462
+ * swept firmware 1.14 units, where the unlock alone arms the pair write, so it
463
+ * is sent only as the last-resort arm in `setLiftOff` for a unit that refuses
464
+ * both unlock values. Carries the same sensor selector as the settings writes;
465
+ * the layout is read off the experiment notes rather than verified on
466
+ * hardware, which is why it comes last.
467
+ */
468
+ export function razerEnableSensorCalibrationCommand() {
469
+ return {
470
+ commandClass: 0x0b,
471
+ commandId: 0x03,
472
+ dataSize: 0x03,
473
+ args: [0x00, RAZER_SENSOR_SELECTOR, 0x01],
474
+ };
475
+ }
476
+ /**
477
+ * Lift-off write, transcribed from the vendor software's own packet rather than
478
+ * inferred: `dataSize 0x0a`, then `00 04` before the pair. It does NOT mirror
479
+ * the read's layout, which is what three earlier guesses assumed — each was
480
+ * answered `0x03` while still disturbing the stored values.
481
+ *
482
+ * Must be preceded by `razerEnableAsymmetricLiftOffCommand`.
483
+ *
484
+ * Confirmed on hardware: status `0x02`, read-back exact, and the change is
485
+ * felt at the sensor, which a read-back alone cannot establish.
486
+ */
487
+ export function razerSetLiftOffCommand(liftOff, landing) {
488
+ if (!Number.isInteger(liftOff) || liftOff < RAZER_LIFT_OFF_MIN || liftOff > RAZER_LIFT_OFF_MAX) {
489
+ throw new RazerProtocolError(`Lift-off must be a whole number between ${RAZER_LIFT_OFF_MIN} and ${RAZER_LIFT_OFF_MAX}.`);
490
+ }
491
+ if (!Number.isInteger(landing) || landing < RAZER_LANDING_MIN || landing > RAZER_LANDING_MAX) {
492
+ throw new RazerProtocolError(`Landing must be a whole number between ${RAZER_LANDING_MIN} and ${RAZER_LANDING_MAX}.`);
493
+ }
494
+ // The firmware stores an inverted pair without complaint — a write of
495
+ // landing 26 against lift-off 2 round-tripped and left the mouse in a state
496
+ // the vendor software cannot express. Nothing downstream will catch this.
497
+ if (landing >= liftOff) {
498
+ throw new RazerProtocolError(`Landing (${landing}) must be below lift-off (${liftOff}).`);
499
+ }
500
+ return {
501
+ ...RAZER_WRITE.liftOff,
502
+ args: [0x00, RAZER_SENSOR_SELECTOR, liftOff - 1, landing - 1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
503
+ };
504
+ }
505
+ /**
506
+ * Legacy polling encodes the rate as a divisor of 1000, so it cannot express
507
+ * the HyperPolling rates. Wireless answers this command as unsupported.
508
+ */
509
+ export function decodeLegacyPollingRate(args) {
510
+ if (!args[0])
511
+ throw new RazerProtocolError("The mouse reported an unknown polling rate.");
512
+ return Math.round(1000 / args[0]);
513
+ }
514
+ /**
515
+ * HyperPolling rates encode as a divisor of 8000. The first reply byte echoes
516
+ * the request argument, so the rate lives in the second. Wired answers this
517
+ * command as unsupported.
518
+ */
519
+ export function decodeExtendedPollingRate(args) {
520
+ if (!args[1])
521
+ throw new RazerProtocolError("The mouse reported an unknown polling rate.");
522
+ return Math.round(8000 / args[1]);
523
+ }
524
+ export const RAZER_BUTTON_CONTROLS = ["leftClick", "rightClick", "mouse4", "mouse5"];
525
+ const RAZER_BUTTON_CONTROL_INDEX = {
526
+ leftClick: 0x01,
527
+ rightClick: 0x02,
528
+ mouse4: 0x04,
529
+ mouse5: 0x05,
530
+ };
531
+ /** Every mapping the panel can offer: each control's own action, plus Disabled. */
532
+ export const RAZER_BUTTON_MAPPINGS = ["Left Click", "Right Click", "Mouse Button 4", "Mouse Button 5", "Disabled"];
533
+ // Each control's own label doubles as the mapping that plays its native
534
+ // action, so the type carries that: "leftClick"'s label is also a valid
535
+ // RazerButtonMapping, not just display text.
536
+ export const RAZER_BUTTON_CONTROL_LABEL = {
537
+ leftClick: "Left Click",
538
+ rightClick: "Right Click",
539
+ mouse4: "Mouse Button 4",
540
+ mouse5: "Mouse Button 5",
541
+ };
542
+ const RAZER_MAPPING_CONTROL = Object.fromEntries(RAZER_BUTTON_CONTROLS.map((control) => [RAZER_BUTTON_CONTROL_LABEL[control], control]));
543
+ /**
544
+ * Encodes a mapping into the write's trailing `[type, len, value]`.
545
+ * `type=0x01, len=0x01, value=<control index>` makes the target control
546
+ * perform *that* index's action — confirmed cross-control on hardware, not
547
+ * just identity: Mouse Button 4 written with Right Click's index physically
548
+ * right-clicked. `type=0x00` is Disabled.
549
+ */
550
+ function razerEncodeButtonMapping(mapping) {
551
+ if (mapping === "Disabled")
552
+ return [0x00, 0x00, 0x00];
553
+ const control = RAZER_MAPPING_CONTROL[mapping];
554
+ if (!control)
555
+ throw new RazerProtocolError(`"${mapping}" is not a button mapping this driver can send.`);
556
+ return [0x01, 0x01, RAZER_BUTTON_CONTROL_INDEX[control]];
557
+ }
558
+ /**
559
+ * Decodes a button-mapping reply back to a label. Returns null for an
560
+ * encoding this driver does not recognise — a keyboard shortcut, a control
561
+ * outside the four shipped here, or anything else unmapped — so a caller can
562
+ * preserve it rather than misrepresent it as one of the known five.
563
+ */
564
+ export function razerDecodeButtonMapping(args) {
565
+ const type = args[3];
566
+ const value = args[5];
567
+ if (type === 0x00)
568
+ return "Disabled";
569
+ if (type !== 0x01)
570
+ return null;
571
+ const control = RAZER_BUTTON_CONTROLS.find((candidate) => RAZER_BUTTON_CONTROL_INDEX[candidate] === value);
572
+ return control ? RAZER_BUTTON_CONTROL_LABEL[control] : null;
573
+ }
574
+ /** Only the Standard layer is trusted for reads — see `RAZER_READ.buttonMapping`. */
575
+ export function razerReadButtonMappingCommand(control) {
576
+ return { ...RAZER_READ.buttonMapping, args: [0x01, RAZER_BUTTON_CONTROL_INDEX[control], 0x00] };
577
+ }
578
+ /**
579
+ * Left Click cannot be reassigned or disabled on the Standard layer — Synapse
580
+ * enforces the same restriction, presumably because it is the only reliable
581
+ * way to interact with Windows (and with Synapse itself) at all. Exported so
582
+ * the UI can disable the control outright instead of letting a user hit the
583
+ * error.
584
+ */
585
+ export const RAZER_LOCKED_BUTTON_CONTROL = "leftClick";
586
+ export function razerSetButtonMappingCommand(control, mapping) {
587
+ if (control === RAZER_LOCKED_BUTTON_CONTROL && mapping !== RAZER_BUTTON_CONTROL_LABEL[RAZER_LOCKED_BUTTON_CONTROL]) {
588
+ throw new RazerProtocolError(`${RAZER_BUTTON_CONTROL_LABEL[RAZER_LOCKED_BUTTON_CONTROL]} is fixed on the Standard layer and cannot be reassigned or disabled.`);
589
+ }
590
+ const [type, len, value] = razerEncodeButtonMapping(mapping);
591
+ return {
592
+ ...RAZER_WRITE.buttonMapping,
593
+ args: [0x01, RAZER_BUTTON_CONTROL_INDEX[control], 0x00, type, len, value, 0x00, 0x00, 0x00, 0x00],
594
+ };
595
+ }
596
+ export const RAZER_TOGGLE_CONTROLS = ["scrollUp", "scrollDown", "sensitivityButton"];
597
+ export const RAZER_TOGGLE_CONTROL_INFO = {
598
+ scrollUp: { index: 0x09, label: "Scroll Up", enabledLabel: "Scroll Up", enabledArgs: [0x01, 0x01, 0x09] },
599
+ scrollDown: { index: 0x0a, label: "Scroll Down", enabledLabel: "Scroll Down", enabledArgs: [0x01, 0x01, 0x0a] },
600
+ sensitivityButton: {
601
+ index: 0x60,
602
+ label: "Sensitivity Button",
603
+ enabledLabel: "Cycle Up Sensitivity Stages",
604
+ enabledArgs: [0x06, 0x01, 0x06],
605
+ },
606
+ };
607
+ /** Only the Standard layer is trusted for reads — see `RAZER_READ.buttonMapping`. */
608
+ export function razerReadToggleControlCommand(control) {
609
+ return { ...RAZER_READ.buttonMapping, args: [0x01, RAZER_TOGGLE_CONTROL_INFO[control].index, 0x00] };
610
+ }
611
+ /**
612
+ * Decodes a toggle control's reply to its own enabled label or "Disabled".
613
+ * Returns null for anything else — Hypershift data, a Synapse reassignment
614
+ * this driver has never captured, or noise — so a caller can preserve it
615
+ * rather than misrepresent it as one of the two known states.
616
+ */
617
+ export function razerDecodeToggleControl(control, args) {
618
+ const type = args[3];
619
+ const len = args[4];
620
+ const value = args[5];
621
+ if (type === 0x00 && len === 0x00 && value === 0x00)
622
+ return "Disabled";
623
+ const info = RAZER_TOGGLE_CONTROL_INFO[control];
624
+ const [enabledType, enabledLen, enabledValue] = info.enabledArgs;
625
+ if (type === enabledType && len === enabledLen && value === enabledValue)
626
+ return info.enabledLabel;
627
+ return null;
628
+ }
629
+ export function razerSetToggleControlCommand(control, label) {
630
+ const info = RAZER_TOGGLE_CONTROL_INFO[control];
631
+ let type;
632
+ let len;
633
+ let value;
634
+ if (label === "Disabled") {
635
+ [type, len, value] = [0x00, 0x00, 0x00];
636
+ }
637
+ else if (label === info.enabledLabel) {
638
+ [type, len, value] = info.enabledArgs;
639
+ }
640
+ else {
641
+ throw new RazerProtocolError(`${info.label} only supports "${info.enabledLabel}" or "Disabled".`);
642
+ }
643
+ return {
644
+ ...RAZER_WRITE.buttonMapping,
645
+ args: [0x01, info.index, 0x00, type, len, value, 0x00, 0x00, 0x00, 0x00],
646
+ };
647
+ }
648
+ //# sourceMappingURL=codec.js.map