@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.
- package/CONTRIBUTING.md +167 -0
- package/README.md +89 -0
- package/dist/asus/index.d.ts +52 -0
- package/dist/asus/index.d.ts.map +1 -0
- package/dist/asus/index.js +248 -0
- package/dist/asus/index.js.map +1 -0
- package/dist/atk/index.d.ts +200 -0
- package/dist/atk/index.d.ts.map +1 -0
- package/dist/atk/index.js +480 -0
- package/dist/atk/index.js.map +1 -0
- package/dist/bitmouse/index.d.ts +284 -0
- package/dist/bitmouse/index.d.ts.map +1 -0
- package/dist/bitmouse/index.js +396 -0
- package/dist/bitmouse/index.js.map +1 -0
- package/dist/compx/codec.d.ts +31 -0
- package/dist/compx/codec.d.ts.map +1 -0
- package/dist/compx/codec.js +50 -0
- package/dist/compx/codec.js.map +1 -0
- package/dist/corsair/index.d.ts +147 -0
- package/dist/corsair/index.d.ts.map +1 -0
- package/dist/corsair/index.js +223 -0
- package/dist/corsair/index.js.map +1 -0
- package/dist/dareu/index.d.ts +136 -0
- package/dist/dareu/index.d.ts.map +1 -0
- package/dist/dareu/index.js +344 -0
- package/dist/dareu/index.js.map +1 -0
- package/dist/drivers/asus/hid.d.ts +29 -0
- package/dist/drivers/asus/hid.d.ts.map +1 -0
- package/dist/drivers/asus/hid.js +419 -0
- package/dist/drivers/asus/hid.js.map +1 -0
- package/dist/drivers/atk/bitmouse-hid.d.ts +80 -0
- package/dist/drivers/atk/bitmouse-hid.d.ts.map +1 -0
- package/dist/drivers/atk/bitmouse-hid.js +501 -0
- package/dist/drivers/atk/bitmouse-hid.js.map +1 -0
- package/dist/drivers/atk/hid.d.ts +163 -0
- package/dist/drivers/atk/hid.d.ts.map +1 -0
- package/dist/drivers/atk/hid.js +1368 -0
- package/dist/drivers/atk/hid.js.map +1 -0
- package/dist/drivers/atk/products.d.ts +13 -0
- package/dist/drivers/atk/products.d.ts.map +1 -0
- package/dist/drivers/atk/products.js +13 -0
- package/dist/drivers/atk/products.js.map +1 -0
- package/dist/drivers/attackshark/dpi.d.ts +41 -0
- package/dist/drivers/attackshark/dpi.d.ts.map +1 -0
- package/dist/drivers/attackshark/dpi.js +215 -0
- package/dist/drivers/attackshark/dpi.js.map +1 -0
- package/dist/drivers/attackshark/hid.d.ts +124 -0
- package/dist/drivers/attackshark/hid.d.ts.map +1 -0
- package/dist/drivers/attackshark/hid.js +728 -0
- package/dist/drivers/attackshark/hid.js.map +1 -0
- package/dist/drivers/corsair/hid.d.ts +70 -0
- package/dist/drivers/corsair/hid.d.ts.map +1 -0
- package/dist/drivers/corsair/hid.js +414 -0
- package/dist/drivers/corsair/hid.js.map +1 -0
- package/dist/drivers/dareu/hid.d.ts +59 -0
- package/dist/drivers/dareu/hid.d.ts.map +1 -0
- package/dist/drivers/dareu/hid.js +478 -0
- package/dist/drivers/dareu/hid.js.map +1 -0
- package/dist/drivers/endgame/egg-op1-hid.d.ts +107 -0
- package/dist/drivers/endgame/egg-op1-hid.d.ts.map +1 -0
- package/dist/drivers/endgame/egg-op1-hid.js +605 -0
- package/dist/drivers/endgame/egg-op1-hid.js.map +1 -0
- package/dist/drivers/endgame/egg-we-control.d.ts +42 -0
- package/dist/drivers/endgame/egg-we-control.d.ts.map +1 -0
- package/dist/drivers/endgame/egg-we-control.js +87 -0
- package/dist/drivers/endgame/egg-we-control.js.map +1 -0
- package/dist/drivers/endgame/egg-we-hid.d.ts +58 -0
- package/dist/drivers/endgame/egg-we-hid.d.ts.map +1 -0
- package/dist/drivers/endgame/egg-we-hid.js +514 -0
- package/dist/drivers/endgame/egg-we-hid.js.map +1 -0
- package/dist/drivers/fantech/hid.d.ts +106 -0
- package/dist/drivers/fantech/hid.d.ts.map +1 -0
- package/dist/drivers/fantech/hid.js +295 -0
- package/dist/drivers/fantech/hid.js.map +1 -0
- package/dist/drivers/finalmouse/hid.d.ts +31 -0
- package/dist/drivers/finalmouse/hid.d.ts.map +1 -0
- package/dist/drivers/finalmouse/hid.js +181 -0
- package/dist/drivers/finalmouse/hid.js.map +1 -0
- package/dist/drivers/gearhub/hid.d.ts +191 -0
- package/dist/drivers/gearhub/hid.d.ts.map +1 -0
- package/dist/drivers/gearhub/hid.js +542 -0
- package/dist/drivers/gearhub/hid.js.map +1 -0
- package/dist/drivers/glorious/classic-hid.d.ts +62 -0
- package/dist/drivers/glorious/classic-hid.d.ts.map +1 -0
- package/dist/drivers/glorious/classic-hid.js +326 -0
- package/dist/drivers/glorious/classic-hid.js.map +1 -0
- package/dist/drivers/glorious/hid.d.ts +39 -0
- package/dist/drivers/glorious/hid.d.ts.map +1 -0
- package/dist/drivers/glorious/hid.js +203 -0
- package/dist/drivers/glorious/hid.js.map +1 -0
- package/dist/drivers/gwolves/hid.d.ts +27 -0
- package/dist/drivers/gwolves/hid.d.ts.map +1 -0
- package/dist/drivers/gwolves/hid.js +225 -0
- package/dist/drivers/gwolves/hid.js.map +1 -0
- package/dist/drivers/gwolves/products.d.ts +17 -0
- package/dist/drivers/gwolves/products.d.ts.map +1 -0
- package/dist/drivers/gwolves/products.js +58 -0
- package/dist/drivers/gwolves/products.js.map +1 -0
- package/dist/drivers/hyperx/hid.d.ts +59 -0
- package/dist/drivers/hyperx/hid.d.ts.map +1 -0
- package/dist/drivers/hyperx/hid.js +229 -0
- package/dist/drivers/hyperx/hid.js.map +1 -0
- package/dist/drivers/incott/hid.d.ts +513 -0
- package/dist/drivers/incott/hid.d.ts.map +1 -0
- package/dist/drivers/incott/hid.js +1173 -0
- package/dist/drivers/incott/hid.js.map +1 -0
- package/dist/drivers/index.d.ts +5 -0
- package/dist/drivers/index.d.ts.map +1 -0
- package/dist/drivers/index.js +5 -0
- package/dist/drivers/index.js.map +1 -0
- package/dist/drivers/keychron/m6-hid.d.ts +81 -0
- package/dist/drivers/keychron/m6-hid.d.ts.map +1 -0
- package/dist/drivers/keychron/m6-hid.js +486 -0
- package/dist/drivers/keychron/m6-hid.js.map +1 -0
- package/dist/drivers/keychron/nape-hid.d.ts +60 -0
- package/dist/drivers/keychron/nape-hid.d.ts.map +1 -0
- package/dist/drivers/keychron/nape-hid.js +432 -0
- package/dist/drivers/keychron/nape-hid.js.map +1 -0
- package/dist/drivers/ksnake/hid.d.ts +74 -0
- package/dist/drivers/ksnake/hid.d.ts.map +1 -0
- package/dist/drivers/ksnake/hid.js +368 -0
- package/dist/drivers/ksnake/hid.js.map +1 -0
- package/dist/drivers/lamzu/hid.d.ts +58 -0
- package/dist/drivers/lamzu/hid.d.ts.map +1 -0
- package/dist/drivers/lamzu/hid.js +414 -0
- package/dist/drivers/lamzu/hid.js.map +1 -0
- package/dist/drivers/lamzu-atlantis/hid.d.ts +148 -0
- package/dist/drivers/lamzu-atlantis/hid.d.ts.map +1 -0
- package/dist/drivers/lamzu-atlantis/hid.js +587 -0
- package/dist/drivers/lamzu-atlantis/hid.js.map +1 -0
- package/dist/drivers/logitech/bolt.d.ts +41 -0
- package/dist/drivers/logitech/bolt.d.ts.map +1 -0
- package/dist/drivers/logitech/bolt.js +105 -0
- package/dist/drivers/logitech/bolt.js.map +1 -0
- package/dist/drivers/logitech/hidpp.d.ts +525 -0
- package/dist/drivers/logitech/hidpp.d.ts.map +1 -0
- package/dist/drivers/logitech/hidpp.js +2774 -0
- package/dist/drivers/logitech/hidpp.js.map +1 -0
- package/dist/drivers/logitech/mode-status.d.ts +53 -0
- package/dist/drivers/logitech/mode-status.d.ts.map +1 -0
- package/dist/drivers/logitech/mode-status.js +52 -0
- package/dist/drivers/logitech/mode-status.js.map +1 -0
- package/dist/drivers/logitech/onboard-profiles.d.ts +298 -0
- package/dist/drivers/logitech/onboard-profiles.d.ts.map +1 -0
- package/dist/drivers/logitech/onboard-profiles.js +965 -0
- package/dist/drivers/logitech/onboard-profiles.js.map +1 -0
- package/dist/drivers/logitech/rgb-effects.d.ts +20 -0
- package/dist/drivers/logitech/rgb-effects.d.ts.map +1 -0
- package/dist/drivers/logitech/rgb-effects.js +93 -0
- package/dist/drivers/logitech/rgb-effects.js.map +1 -0
- package/dist/drivers/mchose/a5-gen1-hid.d.ts +36 -0
- package/dist/drivers/mchose/a5-gen1-hid.d.ts.map +1 -0
- package/dist/drivers/mchose/a5-gen1-hid.js +219 -0
- package/dist/drivers/mchose/a5-gen1-hid.js.map +1 -0
- package/dist/drivers/mchose/dock-hid.d.ts +26 -0
- package/dist/drivers/mchose/dock-hid.d.ts.map +1 -0
- package/dist/drivers/mchose/dock-hid.js +176 -0
- package/dist/drivers/mchose/dock-hid.js.map +1 -0
- package/dist/drivers/mchose/hid.d.ts +118 -0
- package/dist/drivers/mchose/hid.d.ts.map +1 -0
- package/dist/drivers/mchose/hid.js +550 -0
- package/dist/drivers/mchose/hid.js.map +1 -0
- package/dist/drivers/mchose/v3-hid.d.ts +109 -0
- package/dist/drivers/mchose/v3-hid.d.ts.map +1 -0
- package/dist/drivers/mchose/v3-hid.js +572 -0
- package/dist/drivers/mchose/v3-hid.js.map +1 -0
- package/dist/drivers/microsoft/hid.d.ts +25 -0
- package/dist/drivers/microsoft/hid.d.ts.map +1 -0
- package/dist/drivers/microsoft/hid.js +247 -0
- package/dist/drivers/microsoft/hid.js.map +1 -0
- package/dist/drivers/moddo/hid.d.ts +31 -0
- package/dist/drivers/moddo/hid.d.ts.map +1 -0
- package/dist/drivers/moddo/hid.js +154 -0
- package/dist/drivers/moddo/hid.js.map +1 -0
- package/dist/drivers/mouse-types.d.ts +388 -0
- package/dist/drivers/mouse-types.d.ts.map +1 -0
- package/dist/drivers/mouse-types.js +2 -0
- package/dist/drivers/mouse-types.js.map +1 -0
- package/dist/drivers/ninjutso/hid.d.ts +62 -0
- package/dist/drivers/ninjutso/hid.d.ts.map +1 -0
- package/dist/drivers/ninjutso/hid.js +680 -0
- package/dist/drivers/ninjutso/hid.js.map +1 -0
- package/dist/drivers/orbital/hid.d.ts +24 -0
- package/dist/drivers/orbital/hid.d.ts.map +1 -0
- package/dist/drivers/orbital/hid.js +85 -0
- package/dist/drivers/orbital/hid.js.map +1 -0
- package/dist/drivers/orbital/host-protocol.d.ts +59 -0
- package/dist/drivers/orbital/host-protocol.d.ts.map +1 -0
- package/dist/drivers/orbital/host-protocol.js +884 -0
- package/dist/drivers/orbital/host-protocol.js.map +1 -0
- package/dist/drivers/pulsar/pulsar-hid.d.ts +63 -0
- package/dist/drivers/pulsar/pulsar-hid.d.ts.map +1 -0
- package/dist/drivers/pulsar/pulsar-hid.js +381 -0
- package/dist/drivers/pulsar/pulsar-hid.js.map +1 -0
- package/dist/drivers/pulsar/pulsar-pro-hid.d.ts +46 -0
- package/dist/drivers/pulsar/pulsar-pro-hid.d.ts.map +1 -0
- package/dist/drivers/pulsar/pulsar-pro-hid.js +343 -0
- package/dist/drivers/pulsar/pulsar-pro-hid.js.map +1 -0
- package/dist/drivers/pulsar/pulsar-xs1-hid.d.ts +40 -0
- package/dist/drivers/pulsar/pulsar-xs1-hid.d.ts.map +1 -0
- package/dist/drivers/pulsar/pulsar-xs1-hid.js +251 -0
- package/dist/drivers/pulsar/pulsar-xs1-hid.js.map +1 -0
- package/dist/drivers/rawm/hid.d.ts +29 -0
- package/dist/drivers/rawm/hid.d.ts.map +1 -0
- package/dist/drivers/rawm/hid.js +210 -0
- package/dist/drivers/rawm/hid.js.map +1 -0
- package/dist/drivers/razer/cobra-hid.d.ts +63 -0
- package/dist/drivers/razer/cobra-hid.d.ts.map +1 -0
- package/dist/drivers/razer/cobra-hid.js +282 -0
- package/dist/drivers/razer/cobra-hid.js.map +1 -0
- package/dist/drivers/razer/hid-open.d.ts +13 -0
- package/dist/drivers/razer/hid-open.d.ts.map +1 -0
- package/dist/drivers/razer/hid-open.js +29 -0
- package/dist/drivers/razer/hid-open.js.map +1 -0
- package/dist/drivers/razer/hid.d.ts +231 -0
- package/dist/drivers/razer/hid.d.ts.map +1 -0
- package/dist/drivers/razer/hid.js +772 -0
- package/dist/drivers/razer/hid.js.map +1 -0
- package/dist/drivers/razer/viper-hid.d.ts +33 -0
- package/dist/drivers/razer/viper-hid.d.ts.map +1 -0
- package/dist/drivers/razer/viper-hid.js +177 -0
- package/dist/drivers/razer/viper-hid.js.map +1 -0
- package/dist/drivers/razer/viper-mini-hid.d.ts +58 -0
- package/dist/drivers/razer/viper-mini-hid.d.ts.map +1 -0
- package/dist/drivers/razer/viper-mini-hid.js +273 -0
- package/dist/drivers/razer/viper-mini-hid.js.map +1 -0
- package/dist/drivers/razer/viper-v4-pro-hid.d.ts +26 -0
- package/dist/drivers/razer/viper-v4-pro-hid.d.ts.map +1 -0
- package/dist/drivers/razer/viper-v4-pro-hid.js +154 -0
- package/dist/drivers/razer/viper-v4-pro-hid.js.map +1 -0
- package/dist/drivers/registry.d.ts +70 -0
- package/dist/drivers/registry.d.ts.map +1 -0
- package/dist/drivers/registry.js +146 -0
- package/dist/drivers/registry.js.map +1 -0
- package/dist/drivers/steelseries/aerox3-hid.d.ts +53 -0
- package/dist/drivers/steelseries/aerox3-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/aerox3-hid.js +172 -0
- package/dist/drivers/steelseries/aerox3-hid.js.map +1 -0
- package/dist/drivers/steelseries/aerox5-hid.d.ts +54 -0
- package/dist/drivers/steelseries/aerox5-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/aerox5-hid.js +173 -0
- package/dist/drivers/steelseries/aerox5-hid.js.map +1 -0
- package/dist/drivers/steelseries/aerox5-wireless-hid.d.ts +69 -0
- package/dist/drivers/steelseries/aerox5-wireless-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/aerox5-wireless-hid.js +234 -0
- package/dist/drivers/steelseries/aerox5-wireless-hid.js.map +1 -0
- package/dist/drivers/steelseries/aerox9-wireless-hid.d.ts +70 -0
- package/dist/drivers/steelseries/aerox9-wireless-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/aerox9-wireless-hid.js +227 -0
- package/dist/drivers/steelseries/aerox9-wireless-hid.js.map +1 -0
- package/dist/drivers/steelseries/hid.d.ts +48 -0
- package/dist/drivers/steelseries/hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/hid.js +157 -0
- package/dist/drivers/steelseries/hid.js.map +1 -0
- package/dist/drivers/steelseries/prime-mini-wireless-hid.d.ts +62 -0
- package/dist/drivers/steelseries/prime-mini-wireless-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/prime-mini-wireless-hid.js +215 -0
- package/dist/drivers/steelseries/prime-mini-wireless-hid.js.map +1 -0
- package/dist/drivers/steelseries/prime-plus-hid.d.ts +51 -0
- package/dist/drivers/steelseries/prime-plus-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/prime-plus-hid.js +150 -0
- package/dist/drivers/steelseries/prime-plus-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival3-wireless-hid.d.ts +61 -0
- package/dist/drivers/steelseries/rival3-wireless-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival3-wireless-hid.js +185 -0
- package/dist/drivers/steelseries/rival3-wireless-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival310-hid.d.ts +59 -0
- package/dist/drivers/steelseries/rival310-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival310-hid.js +182 -0
- package/dist/drivers/steelseries/rival310-hid.js.map +1 -0
- package/dist/drivers/steelseries/rival650-hid.d.ts +68 -0
- package/dist/drivers/steelseries/rival650-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/rival650-hid.js +209 -0
- package/dist/drivers/steelseries/rival650-hid.js.map +1 -0
- package/dist/drivers/steelseries/sensei-ten-hid.d.ts +62 -0
- package/dist/drivers/steelseries/sensei-ten-hid.d.ts.map +1 -0
- package/dist/drivers/steelseries/sensei-ten-hid.js +186 -0
- package/dist/drivers/steelseries/sensei-ten-hid.js.map +1 -0
- package/dist/drivers/teevolution/hid.d.ts +82 -0
- package/dist/drivers/teevolution/hid.d.ts.map +1 -0
- package/dist/drivers/teevolution/hid.js +607 -0
- package/dist/drivers/teevolution/hid.js.map +1 -0
- package/dist/drivers/vendors.d.ts +254 -0
- package/dist/drivers/vendors.d.ts.map +1 -0
- package/dist/drivers/vendors.js +587 -0
- package/dist/drivers/vendors.js.map +1 -0
- package/dist/drivers/vgn/hid.d.ts +33 -0
- package/dist/drivers/vgn/hid.d.ts.map +1 -0
- package/dist/drivers/vgn/hid.js +213 -0
- package/dist/drivers/vgn/hid.js.map +1 -0
- package/dist/drivers/wallhack/keyboard-hid.d.ts +28 -0
- package/dist/drivers/wallhack/keyboard-hid.d.ts.map +1 -0
- package/dist/drivers/wallhack/keyboard-hid.js +80 -0
- package/dist/drivers/wallhack/keyboard-hid.js.map +1 -0
- package/dist/drivers/wallhack/mouse-hid.d.ts +45 -0
- package/dist/drivers/wallhack/mouse-hid.d.ts.map +1 -0
- package/dist/drivers/wallhack/mouse-hid.js +288 -0
- package/dist/drivers/wallhack/mouse-hid.js.map +1 -0
- package/dist/drivers/webhid.d.ts +59 -0
- package/dist/drivers/webhid.d.ts.map +1 -0
- package/dist/drivers/webhid.js +2 -0
- package/dist/drivers/webhid.js.map +1 -0
- package/dist/drivers/wlmouse/hid.d.ts +81 -0
- package/dist/drivers/wlmouse/hid.d.ts.map +1 -0
- package/dist/drivers/wlmouse/hid.js +576 -0
- package/dist/drivers/wlmouse/hid.js.map +1 -0
- package/dist/drivers/wooting/hid.d.ts +86 -0
- package/dist/drivers/wooting/hid.d.ts.map +1 -0
- package/dist/drivers/wooting/hid.js +320 -0
- package/dist/drivers/wooting/hid.js.map +1 -0
- package/dist/drivers/zaunkoenig/hid.d.ts +31 -0
- package/dist/drivers/zaunkoenig/hid.d.ts.map +1 -0
- package/dist/drivers/zaunkoenig/hid.js +162 -0
- package/dist/drivers/zaunkoenig/hid.js.map +1 -0
- package/dist/endgame-gear/op1.d.ts +165 -0
- package/dist/endgame-gear/op1.d.ts.map +1 -0
- package/dist/endgame-gear/op1.js +384 -0
- package/dist/endgame-gear/op1.js.map +1 -0
- package/dist/endgame-gear/wireless.d.ts +93 -0
- package/dist/endgame-gear/wireless.d.ts.map +1 -0
- package/dist/endgame-gear/wireless.js +242 -0
- package/dist/endgame-gear/wireless.js.map +1 -0
- package/dist/fantech/index.d.ts +9 -0
- package/dist/fantech/index.d.ts.map +1 -0
- package/dist/fantech/index.js +11 -0
- package/dist/fantech/index.js.map +1 -0
- package/dist/finalmouse/index.d.ts +41 -0
- package/dist/finalmouse/index.d.ts.map +1 -0
- package/dist/finalmouse/index.js +106 -0
- package/dist/finalmouse/index.js.map +1 -0
- package/dist/gearhub/index.d.ts +210 -0
- package/dist/gearhub/index.d.ts.map +1 -0
- package/dist/gearhub/index.js +282 -0
- package/dist/gearhub/index.js.map +1 -0
- package/dist/glorious/index.d.ts +89 -0
- package/dist/glorious/index.d.ts.map +1 -0
- package/dist/glorious/index.js +236 -0
- package/dist/glorious/index.js.map +1 -0
- package/dist/glorious-classic/index.d.ts +103 -0
- package/dist/glorious-classic/index.d.ts.map +1 -0
- package/dist/glorious-classic/index.js +304 -0
- package/dist/glorious-classic/index.js.map +1 -0
- package/dist/gwolves/index.d.ts +82 -0
- package/dist/gwolves/index.d.ts.map +1 -0
- package/dist/gwolves/index.js +197 -0
- package/dist/gwolves/index.js.map +1 -0
- package/dist/hyperx/index.d.ts +181 -0
- package/dist/hyperx/index.d.ts.map +1 -0
- package/dist/hyperx/index.js +303 -0
- package/dist/hyperx/index.js.map +1 -0
- package/dist/incott/index.d.ts +1067 -0
- package/dist/incott/index.d.ts.map +1 -0
- package/dist/incott/index.js +1482 -0
- package/dist/incott/index.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/keychron/index.d.ts +194 -0
- package/dist/keychron/index.d.ts.map +1 -0
- package/dist/keychron/index.js +341 -0
- package/dist/keychron/index.js.map +1 -0
- package/dist/ksnake/index.d.ts +157 -0
- package/dist/ksnake/index.d.ts.map +1 -0
- package/dist/ksnake/index.js +314 -0
- package/dist/ksnake/index.js.map +1 -0
- package/dist/lamzu/atlantis.d.ts +237 -0
- package/dist/lamzu/atlantis.d.ts.map +1 -0
- package/dist/lamzu/atlantis.js +263 -0
- package/dist/lamzu/atlantis.js.map +1 -0
- package/dist/lamzu/index.d.ts +60 -0
- package/dist/lamzu/index.d.ts.map +1 -0
- package/dist/lamzu/index.js +86 -0
- package/dist/lamzu/index.js.map +1 -0
- package/dist/logitech/controls.d.ts +138 -0
- package/dist/logitech/controls.d.ts.map +1 -0
- package/dist/logitech/controls.js +184 -0
- package/dist/logitech/controls.js.map +1 -0
- package/dist/logitech/friendly-name.d.ts +50 -0
- package/dist/logitech/friendly-name.d.ts.map +1 -0
- package/dist/logitech/friendly-name.js +74 -0
- package/dist/logitech/friendly-name.js.map +1 -0
- package/dist/logitech/haptics.d.ts +97 -0
- package/dist/logitech/haptics.d.ts.map +1 -0
- package/dist/logitech/haptics.js +116 -0
- package/dist/logitech/haptics.js.map +1 -0
- package/dist/logitech/hosts.d.ts +55 -0
- package/dist/logitech/hosts.d.ts.map +1 -0
- package/dist/logitech/hosts.js +80 -0
- package/dist/logitech/hosts.js.map +1 -0
- package/dist/logitech/index.d.ts +127 -0
- package/dist/logitech/index.d.ts.map +1 -0
- package/dist/logitech/index.js +233 -0
- package/dist/logitech/index.js.map +1 -0
- package/dist/logitech/wheel.d.ts +117 -0
- package/dist/logitech/wheel.d.ts.map +1 -0
- package/dist/logitech/wheel.js +133 -0
- package/dist/logitech/wheel.js.map +1 -0
- package/dist/mchose/a5-gen1.d.ts +38 -0
- package/dist/mchose/a5-gen1.d.ts.map +1 -0
- package/dist/mchose/a5-gen1.js +60 -0
- package/dist/mchose/a5-gen1.js.map +1 -0
- package/dist/mchose/buttons.d.ts +66 -0
- package/dist/mchose/buttons.d.ts.map +1 -0
- package/dist/mchose/buttons.js +184 -0
- package/dist/mchose/buttons.js.map +1 -0
- package/dist/mchose/dock.d.ts +77 -0
- package/dist/mchose/dock.d.ts.map +1 -0
- package/dist/mchose/dock.js +133 -0
- package/dist/mchose/dock.js.map +1 -0
- package/dist/mchose/index.d.ts +299 -0
- package/dist/mchose/index.d.ts.map +1 -0
- package/dist/mchose/index.js +429 -0
- package/dist/mchose/index.js.map +1 -0
- package/dist/mchose/v3-buttons.d.ts +64 -0
- package/dist/mchose/v3-buttons.d.ts.map +1 -0
- package/dist/mchose/v3-buttons.js +258 -0
- package/dist/mchose/v3-buttons.js.map +1 -0
- package/dist/mchose/v3.d.ts +380 -0
- package/dist/mchose/v3.d.ts.map +1 -0
- package/dist/mchose/v3.js +608 -0
- package/dist/mchose/v3.js.map +1 -0
- package/dist/microsoft/index.d.ts +19 -0
- package/dist/microsoft/index.d.ts.map +1 -0
- package/dist/microsoft/index.js +22 -0
- package/dist/microsoft/index.js.map +1 -0
- package/dist/moddo/index.d.ts +72 -0
- package/dist/moddo/index.d.ts.map +1 -0
- package/dist/moddo/index.js +147 -0
- package/dist/moddo/index.js.map +1 -0
- package/dist/ninjutso/index.d.ts +74 -0
- package/dist/ninjutso/index.d.ts.map +1 -0
- package/dist/ninjutso/index.js +133 -0
- package/dist/ninjutso/index.js.map +1 -0
- package/dist/orbital/index.d.ts +14 -0
- package/dist/orbital/index.d.ts.map +1 -0
- package/dist/orbital/index.js +19 -0
- package/dist/orbital/index.js.map +1 -0
- package/dist/pulsar/index.d.ts +81 -0
- package/dist/pulsar/index.d.ts.map +1 -0
- package/dist/pulsar/index.js +185 -0
- package/dist/pulsar/index.js.map +1 -0
- package/dist/rawm/index.d.ts +55 -0
- package/dist/rawm/index.d.ts.map +1 -0
- package/dist/rawm/index.js +229 -0
- package/dist/rawm/index.js.map +1 -0
- package/dist/razer/codec.d.ts +504 -0
- package/dist/razer/codec.d.ts.map +1 -0
- package/dist/razer/codec.js +648 -0
- package/dist/razer/codec.js.map +1 -0
- package/dist/razer/devices.d.ts +156 -0
- package/dist/razer/devices.d.ts.map +1 -0
- package/dist/razer/devices.js +540 -0
- package/dist/razer/devices.js.map +1 -0
- package/dist/razer/index.d.ts +2 -0
- package/dist/razer/index.d.ts.map +1 -0
- package/dist/razer/index.js +2 -0
- package/dist/razer/index.js.map +1 -0
- package/dist/razer/v4.d.ts +19 -0
- package/dist/razer/v4.d.ts.map +1 -0
- package/dist/razer/v4.js +51 -0
- package/dist/razer/v4.js.map +1 -0
- package/dist/steelseries/aerox3.d.ts +236 -0
- package/dist/steelseries/aerox3.d.ts.map +1 -0
- package/dist/steelseries/aerox3.js +311 -0
- package/dist/steelseries/aerox3.js.map +1 -0
- package/dist/steelseries/aerox5-wireless.d.ts +300 -0
- package/dist/steelseries/aerox5-wireless.d.ts.map +1 -0
- package/dist/steelseries/aerox5-wireless.js +389 -0
- package/dist/steelseries/aerox5-wireless.js.map +1 -0
- package/dist/steelseries/aerox5.d.ts +228 -0
- package/dist/steelseries/aerox5.d.ts.map +1 -0
- package/dist/steelseries/aerox5.js +294 -0
- package/dist/steelseries/aerox5.js.map +1 -0
- package/dist/steelseries/aerox9-wireless.d.ts +213 -0
- package/dist/steelseries/aerox9-wireless.d.ts.map +1 -0
- package/dist/steelseries/aerox9-wireless.js +305 -0
- package/dist/steelseries/aerox9-wireless.js.map +1 -0
- package/dist/steelseries/devices.d.ts +82 -0
- package/dist/steelseries/devices.d.ts.map +1 -0
- package/dist/steelseries/devices.js +310 -0
- package/dist/steelseries/devices.js.map +1 -0
- package/dist/steelseries/index.d.ts +13 -0
- package/dist/steelseries/index.d.ts.map +1 -0
- package/dist/steelseries/index.js +13 -0
- package/dist/steelseries/index.js.map +1 -0
- package/dist/steelseries/prime-mini-wireless.d.ts +253 -0
- package/dist/steelseries/prime-mini-wireless.d.ts.map +1 -0
- package/dist/steelseries/prime-mini-wireless.js +351 -0
- package/dist/steelseries/prime-mini-wireless.js.map +1 -0
- package/dist/steelseries/prime-plus.d.ts +179 -0
- package/dist/steelseries/prime-plus.d.ts.map +1 -0
- package/dist/steelseries/prime-plus.js +275 -0
- package/dist/steelseries/prime-plus.js.map +1 -0
- package/dist/steelseries/rival3-wireless.d.ts +222 -0
- package/dist/steelseries/rival3-wireless.d.ts.map +1 -0
- package/dist/steelseries/rival3-wireless.js +308 -0
- package/dist/steelseries/rival3-wireless.js.map +1 -0
- package/dist/steelseries/rival3.d.ts +99 -0
- package/dist/steelseries/rival3.d.ts.map +1 -0
- package/dist/steelseries/rival3.js +147 -0
- package/dist/steelseries/rival3.js.map +1 -0
- package/dist/steelseries/rival310.d.ts +230 -0
- package/dist/steelseries/rival310.d.ts.map +1 -0
- package/dist/steelseries/rival310.js +322 -0
- package/dist/steelseries/rival310.js.map +1 -0
- package/dist/steelseries/rival650.d.ts +215 -0
- package/dist/steelseries/rival650.d.ts.map +1 -0
- package/dist/steelseries/rival650.js +284 -0
- package/dist/steelseries/rival650.js.map +1 -0
- package/dist/steelseries/sensei-ten.d.ts +283 -0
- package/dist/steelseries/sensei-ten.d.ts.map +1 -0
- package/dist/steelseries/sensei-ten.js +389 -0
- package/dist/steelseries/sensei-ten.js.map +1 -0
- package/dist/teevolution/index.d.ts +211 -0
- package/dist/teevolution/index.d.ts.map +1 -0
- package/dist/teevolution/index.js +458 -0
- package/dist/teevolution/index.js.map +1 -0
- package/dist/valkyrie/index.d.ts +19 -0
- package/dist/valkyrie/index.d.ts.map +1 -0
- package/dist/valkyrie/index.js +43 -0
- package/dist/valkyrie/index.js.map +1 -0
- package/dist/valkyrie/settings.d.ts +28 -0
- package/dist/valkyrie/settings.d.ts.map +1 -0
- package/dist/valkyrie/settings.js +84 -0
- package/dist/valkyrie/settings.js.map +1 -0
- package/dist/vgn/index.d.ts +59 -0
- package/dist/vgn/index.d.ts.map +1 -0
- package/dist/vgn/index.js +165 -0
- package/dist/vgn/index.js.map +1 -0
- package/dist/wallhack/index.d.ts +165 -0
- package/dist/wallhack/index.d.ts.map +1 -0
- package/dist/wallhack/index.js +226 -0
- package/dist/wallhack/index.js.map +1 -0
- package/dist/wlmouse/index.d.ts +4 -0
- package/dist/wlmouse/index.d.ts.map +1 -0
- package/dist/wlmouse/index.js +7 -0
- package/dist/wlmouse/index.js.map +1 -0
- package/dist/wooting/index.d.ts +225 -0
- package/dist/wooting/index.d.ts.map +1 -0
- package/dist/wooting/index.js +296 -0
- package/dist/wooting/index.js.map +1 -0
- package/dist/zaunkoenig/index.d.ts +49 -0
- package/dist/zaunkoenig/index.d.ts.map +1 -0
- package/dist/zaunkoenig/index.js +127 -0
- package/dist/zaunkoenig/index.js.map +1 -0
- 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
|