Compare commits

...
195 Commits
Author SHA1 Message Date
Adam Honse 1177e9fa68 OpenRGB version 0.4 2020-09-09 01:05:11 -05:00
Adam Honse 91b139987f Undo Corsair mouse LED change as the zones differ between mice 2020-09-08 17:48:22 -05:00
Adam Honse 72233ffed6 Add Corsair Sabre RGB 2020-09-08 12:37:59 -05:00
Adam Honse bc31490085 Start labeling Corsair mouse LEDs 2020-09-08 12:22:01 -05:00
Adam Honse fa4d330933 Fix LED name on HyperX Pulsefire Surge 2020-09-08 11:55:10 -05:00
Adam Honse 346beed0eb Standardize common mouse zone/LED names 2020-09-08 11:51:26 -05:00
Adam Honse e74faeb6be Rename Static mode to Direct mode for RGB Fusion 2 SMBus 2020-09-08 11:38:35 -05:00
Adam Honse 70c51abff7 Change order of HyperX DRAM so that sticks are in order 2020-09-08 02:11:28 -05:00
Adam Honse d2ebd167b3 Don't update Polychrome LEDs when the active mode doesn't require an update 2020-09-08 01:42:46 -05:00
TheRogueZeta a605d5581a Update zones on mode update
Minor cleanup, logic tweak to only update per-zone modes for Polychrome V1 by Adam Honse <[email protected]>
2020-09-07 16:36:26 -05:00
TheRogueZeta 759e09b3a3 Rework Polychrome v1 to be separate from ASRLED/V2
Code cleanup and some register name changes by Adam Honse <[email protected]>
2020-09-07 16:27:52 -05:00
Adam Honse a8b3279c1d Add X470 Aorus Gaming 7 Wifi 2020-09-07 13:14:20 -05:00
TheRogueZeta 3f2b925dd0 Update remaining controlers 2020-09-07 03:09:49 -05:00
TheRogueZeta 0cab595ef6 Fix G PRO speed slider. 2020-09-07 03:05:29 -05:00
Adam Honse 1a946268ba Update detection list for RGB Fusion 2 SMBus 2020-09-06 15:24:20 -05:00
Adam Honse 1f1548929d Use working directory for all file accesses, some old file accesses always used the executable directory 2020-09-06 12:56:20 -05:00
Adam Honse 3e62c91ed3 Add location to Polychrome controller 2020-09-06 12:44:34 -05:00
Adam Honse 9be25d1ca4 Make zone LED count a char as it can only be up to 0xFF 2020-09-06 12:25:52 -05:00
k1-801 290fddaf55 Fix incorrect font color detection for DeviceView (threshold 50) 2020-09-06 02:36:53 -05:00
Adam Honse 8823e28fa0 Call update device list callback after detection is finished 2020-09-06 02:29:22 -05:00
k1-801 ec77c658f2 Rudimentary rescanning implemented but button for it not added due to SDK conflicts. Stop detection button.
Commit amended by Adam Honse <[email protected]>
2020-09-06 01:37:16 -05:00
Adam Honse be84a60af6 More Polychrome V1 changes, set LED selection register for ASRLED/Polychrome V1 2020-09-05 02:00:56 -05:00
Adam Honse e40617e417 Set LED select register for Polychrome V1 2020-09-05 01:33:18 -05:00
Adam Honse 7556a2872c Rework LED handling for Polychrome V1 2020-09-05 01:13:38 -05:00
TheRogueZeta 7ccb3cd9e6 Fix reversed G PRO modes 2020-09-04 11:49:23 -05:00
TheRogueZeta cbf867c0ee Change zone name and move Polychrome_V1 2020-09-04 11:33:03 -05:00
Adam Honse b7ee237fbf Add Razer Cynosa Chroma keymap and add ISO keys to other Razer layouts 2020-09-03 16:21:29 -05:00
Adam Honse 0345eb582b More warning fixes 2020-09-02 19:03:43 -05:00
Adam Honse f568253c51 Clean up more warnings 2020-09-02 18:25:58 -05:00
Adam Honse 2251feb701 Add AUMA0-E8K4-0101 Aura SMBus controller as a V2 register device 2020-09-02 09:45:50 -05:00
k1-801 8b8451017e Non-important warnings removed
Commit amended by Adam Honse <[email protected]> due to merging from a different branch.
2020-09-01 23:29:00 -05:00
Adam Honse 94c18fc9b4 Change less than or equal to less than. This shouldn't change anything, but it seems the Media Next key has issues as it was and this fixes that 2020-08-31 23:30:29 -05:00
TheRogueZeta f741cb7c6b Add Logitech Powerplay mat and add speed opt GPW 2020-08-31 23:06:51 -05:00
TheRogueZeta d19b5bc87d Update Logitech Lighspeed nameing and openrgb.rule 2020-08-31 22:41:10 -05:00
Carson Mathre 319f19e65d Update RGBController/RGBController_Tecknet.cpp 2020-08-31 17:30:21 -05:00
Adam Honse ad97bf8c08 Rename Key: Cal to Key: Calculator on Ducky keyboard controller 2020-08-31 14:16:33 -05:00
Adam Honse 835a007445 Draw color wheel with transparent background rather than by pulling background color from palette, as it didn't always get the background the right color 2020-08-31 11:17:59 -05:00
k1-801 66fd8ab394 Dark theme icons 2020-08-31 09:35:35 -05:00
Adam Honse 9407ef7f4d Add X470 AORUS GAMING 5 WIFI to RGB Fusion 2 SMBus supported motherboard list 2020-08-31 08:29:37 -05:00
Adam Honse fb420b3928 Add X470 AORUS ULTRA GAMING to RGB Fusion 2 SMBus detection list 2020-08-30 18:01:33 -05:00
Adam Honse bc3e351f26 Add X470 AORUS ULTRA GAMING-CF to RGB Fusion 2 SMBus detection list 2020-08-30 17:13:54 -05:00
Adam Honse edbccc345f Change LED configuration offset for AUDA0-E6K5-0101 Aura SMBus controller 2020-08-30 17:06:54 -05:00
Adam Honse db3c3e9fb1 Use DMI information to detect RGB Fusion 2 SMBus controller. Only one board added for now. 2020-08-30 16:30:47 -05:00
Adam Honse 6af7324840 Fix missing comma in Ducky key name list 2020-08-30 15:25:04 -05:00
Adam Honse 640f7c7cde Add keymap to Ducky keyboard controller 2020-08-30 15:13:16 -05:00
Adam Honse 37224a6c4d Add support for ASRock Polychrome addressable header as a single LED zone 2020-08-30 14:24:37 -05:00
Adam Honse 6235bcb2b4 Update README 2020-08-30 13:24:59 -05:00
Adam Honse 90ca955343 ASRock zones created based on LED configuration register rather than pre-defined board layouts 2020-08-30 13:07:00 -05:00
Adam Honse d38dcc038a Remove boolean for ASR LED and replace it with an ASRock type enum with ASR LED, Polychrome V1, and Polychrome V2. 2020-08-30 01:57:13 -05:00
Adam Honse f577e5ef3c Add more sleeps to prevent mode corruption and add a function for reading the LED configuration register 2020-08-30 01:43:14 -05:00
Adam Honse 877469cd2d Fix case typo 2020-08-30 01:06:10 -05:00
Adam Honse 4d506588b5 Add sleeps after i2c operations to make ASRock controller more reliable 2020-08-30 00:59:45 -05:00
Adam Honse e972335872 Move speed setting to mode function, add struct to hold board information, remove firmware version from name string and add it to firmware version field. 2020-08-30 00:48:51 -05:00
Adam Honse 9f584b1f76 Hard coded test with all B450M Steel Legend LEDs (except addressable) 2020-08-30 00:48:51 -05:00
k1-801 45dc619076 Expand large keys to fill empty spaces in the matrix, if possible
Change manually picked from merge request by Adam Honse <[email protected]>
2020-08-30 00:31:18 -05:00
Kryesh 81c8ec6684 Allow for multiple RGBFusion 2 Controllers
See issue 529
2020-08-30 00:11:32 -05:00
k1-801 1c7bfdaeb4 Proper UTF-8 labels
Commit amended by Adam Honse <[email protected]>
2020-08-29 01:40:59 -05:00
crashniels f6812a5c88 Corsair Layout changes
Added the KeyIDs for the K95 and K95 platinum as well as the European specific keys. IDs from ckb-next. https://github.com/ckb-next/ckb-next/blob/ba063cedb751cecb1b8b1abf1af3f6e8dc31e9fe/src/daemon/keymap.c
2020-08-29 00:32:40 -05:00
Adam Honse c76dbc943f Update udev rules for G502 Lightspeed with Powerplay Mousepad 2020-08-29 00:22:16 -05:00
Ryakna cd1ceed5df Added detection for Logitech G502 Lightspeed when connected through the Logitech Powerplay Mousepad 2020-08-29 00:18:06 -05:00
Rafail Giavrimis 1558ffc61f Added Support for Steelseries Apex 5 2020-08-29 00:10:25 -05:00
k1-801 06b75f5ae7 Add debug keyboard
Commit modified by Adam Honse <[email protected]> to remove wingdings portion of change.
2020-08-29 00:07:29 -05:00
Adam Honse 95275ebf39 Make linear zones linear in demo devices 2020-08-28 17:46:48 -05:00
Adam Honse d5f86baa73 Create a debug controller with fake devices for SDK testing. Enable with debug_<type> lines in debug.txt 2020-08-28 16:47:38 -05:00
Adam Honse c386a6c571 Add i2c tool for reading multiple bytes from an SMBus device register 2020-08-27 19:12:37 -05:00
Adam Honse 4e95bc55d8 Add the ability to disable device detection using a text file 2020-08-26 19:44:24 -05:00
Adam Honse ae4c88fef8 Fix missing parameter in i2c call 2020-08-26 15:14:25 -05:00
Adam Honse 989dc7fc5d Select all zones before applying Polychrome colors 2020-08-26 15:04:43 -05:00
dumbasPL 1b863fdc7b Add support for Corsair H150i Pro RGB 2020-08-25 15:06:50 -05:00
Adam Honse 933ea93c25 Update README 2020-08-24 22:54:20 -05:00
Adam Honse 7daa5b6556 Use horizontal layouts for buttons and detection elements, repaint device view when selecting all 2020-08-24 22:36:18 -05:00
k1-801 1598fc8de4 Add apply and select all buttons.
Select all button and some minor rework by Adam Honse <[email protected]>
2020-08-24 22:12:09 -05:00
Adam Honse b03fce33ca Update Key: Context to Key: Menu in device view label lookup 2020-08-24 00:51:34 -05:00
Adam Honse 6d9aea38a6 Fix setting mode specific colors and not changing to direct mode when the mode has no configurable colors 2020-08-24 00:40:44 -05:00
Adam Honse a2ed9571cf Add button to toggle graphical LED view and default to hidden 2020-08-24 00:40:44 -05:00
Adam Honse ba24efe544 Fix display for devices with multiple matrix zones 2020-08-24 00:40:44 -05:00
Adam Honse f750654b3e Check for size changes and refresh data if size has changed 2020-08-24 00:40:44 -05:00
Adam Honse b0b46dd3a5 Use QString for LED labels vector 2020-08-24 00:40:44 -05:00
Adam Honse 5e002107ef Add key labels based on key names 2020-08-24 00:40:44 -05:00
Adam Honse b6824b8a46 Don't update the mode UI when the update callback occurs for now 2020-08-24 00:40:44 -05:00
Adam Honse 342d90b82a Add function to unregister update callback when device page is deleted 2020-08-24 00:40:44 -05:00
k1-801 63f005d4fc Forgot a DeviceView update in setSelectionColor 2020-08-24 00:40:44 -05:00
k1-801 4601b91f1f Fixed multiple selection, temporarily disabled interface updates due to update spam from a controler
Code style changes and integration by Adam Honse <[email protected]>
2020-08-24 00:40:44 -05:00
k1-801 c8ea2ff36f Zones overlapping fixed
Code from RGBController moved to DeviceView by Adam Honse <[email protected]>
2020-08-24 00:40:44 -05:00
k1-801 7781b1425d Ctrl-held selection fix 2020-08-24 00:40:43 -05:00
k1-801 7977a3ef50 Fix some signedness warnings, add size caching 2020-08-24 00:40:43 -05:00
k1-801 3000d625fa WIP: Zone names displayed fine now, but off-center 2020-08-24 00:40:43 -05:00
k1-801 bbc3c1de5b WIP: Instant color setting, buttons removed
Code cleanup by Adam Honse <[email protected]>
2020-08-24 00:40:43 -05:00
k1-801 a2a394492b WIP: Multiple selection test
Rework of LED position data from RGBController into DeviceView, code style cleanup modified by Adam Honse <[email protected]>
2020-08-24 00:40:43 -05:00
Adam Honse c6b10d9316 Center the device view horizontally 2020-08-24 00:40:43 -05:00
Adam Honse 177cd2ec92 Use matrix map when available 2020-08-24 00:40:43 -05:00
Adam Honse f787c5e63f Move device view above other controls, begin working on matrix display 2020-08-24 00:40:43 -05:00
Adam Honse d3993547c3 Device view resizes width to fit window size, UI updates on SDKcontroller update 2020-08-24 00:40:43 -05:00
Adam Honse 17f1390f36 Add widget that displays the current color of all LEDs on a controller 2020-08-24 00:40:43 -05:00
Adam Honse 38f8808bea Rename Key: Context to Key: Menu 2020-08-23 21:40:06 -05:00
Adam Honse c58d458062 Remove non-direct modes 2020-08-23 15:18:08 -05:00
Adam Honse d96fd19c6c Clean up profile setup packets 2020-08-23 15:16:09 -05:00
Adam Honse 9f91170240 Initial implementation of Pulsefire Surge direct mode (requires new firmware?) 2020-08-23 15:16:09 -05:00
Adam Honse 2440ab8fc9 Update Linux CI scripts to use temporary linuxdeploy path as the main release is broken 2020-08-23 00:16:28 -05:00
Denzil S.T. Ferreira 6ec3cfb1de Add support for NZXT Kraken M22 AIO
Reworked to use device information table by Adam Honse <[email protected]>
2020-08-22 14:06:03 -05:00
Adam Honse ebae2a3ba3 Fix typo in MSIGPUController 2020-08-22 13:24:36 -05:00
Felipe Cavalcanti effa243adb Adding support for CPU Cooler Gigabyte Aorus ATC800 2020-08-22 12:57:50 -05:00
Azymm 715099d768 Update MSIGPUControllerDetect.cpp 2020-08-22 12:42:20 -05:00
Adam Honse e6531e5379 Add HyperX Alloy Origins Core PID 2020-08-21 23:23:32 -05:00
Adam Honse 41762d4670 Add additional Corsair Hydro modes 2020-08-21 00:22:09 -05:00
Adam Honse ce836ce7b6 Fix E1.31 device name strings 2020-08-20 15:06:59 -05:00
Adam Honse c517257cb0 Add initialization packet to Corsair Hydro controller 2020-08-18 13:01:10 -05:00
Adam Honse ed368fba12 Add Corsair H115i PRO RGB to udev rules 2020-08-18 12:10:45 -05:00
Adam Honse 0b7b42b8f5 Add Corsair H115i PRO RGB to Corsair Hydro list 2020-08-18 12:06:47 -05:00
Adam Honse 68a16fadc2 Initial support for Corsair Hydro Series devices (only H100i Pro RGB for now) 2020-08-18 00:34:42 -05:00
Adam Honse 4f5cf83e47 Add keepalive option for E1.31 output 2020-08-17 15:53:44 -05:00
Adam Honse ed01850926 Initialize new map 2020-08-14 01:33:50 -05:00
Adam Honse 29e2626471 Generate matrix maps for E1.31 matrix configurations 2020-08-14 01:32:35 -05:00
Adam Honse 4f0cf752f5 Add e131.txt parser for matrix configuration. 2020-08-13 22:19:14 -05:00
Térence Clastres 6c52e3ce11 Fix hang when deleting busses 2020-08-13 00:05:29 -05:00
Térence Clastres 53379c5482 Fixes for memory issues detected by valgrind 2020-08-12 23:48:03 -05:00
Adam Honse ff07a488a2 Update Blackwidow Elite keymap 2020-08-12 23:34:33 -05:00
Adam Honse 73a8a50848 Add Blackwidow Elite keymap 2020-08-12 15:22:31 -05:00
Adam Honse 78a8a2c4a9 Add Blackwidow 2019 keymap 2020-08-12 15:14:21 -05:00
AnierinB 9939d7e4f1 Add support for RTX 2060 Z with Sub-Device ID 0x3752
USB controller: NVIDIA Corporation Device 1ada (rev a1) (prog-if 30 [XHCI])
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 3752

Signed-off-by: AnierinB <[email protected]>
2020-08-11 00:01:20 -05:00
xyz 9cf32593ae add PID of Logitech G502H 2020-08-10 19:14:21 -05:00
santeri3700 7294fa8180 Enable support for Corsair Scimitar PRO RGB 2020-08-09 14:10:47 -05:00
edbgon bd35a83837 Added missing key for US layouts 2020-08-09 14:09:12 -05:00
edbgon 3da5a4f6ba Update to add Apex Pro keyboard 2020-08-08 22:13:39 -05:00
Adam Honse c571ea124f Add GitLab URL to the Software Information page 2020-08-08 02:46:41 -05:00
Adam Honse 9db92e9afa Show Software Information and SMBus Tools tabs after device list has been refreshed 2020-08-07 23:37:23 -05:00
Adam Honse 634ec9f488 Wait on asynchronous device detection before performing CLI operations that require device list 2020-08-07 23:01:20 -05:00
Adam Honse 9c4e73bbed Set default percentage to 100% so that the progress bar goes away if device detection is skipped 2020-08-07 14:02:00 -05:00
Térence Clastres f8af9980fd Fix crash on close while detecting devices 2020-08-07 14:01:59 -05:00
Adam Honse 06b2cd87c6 Clean up progress bar initial state 2020-08-07 14:01:59 -05:00
Adam Honse f716a05947 Add detector names and display them in the progress bar 2020-08-07 14:01:59 -05:00
Adam Honse 75899f973b Load sizes after detection is complete 2020-08-07 14:01:59 -05:00
Adam Honse e84cb98055 Add detection progress bar to the user interface 2020-08-07 14:01:59 -05:00
Adam Honse aaa2ecddc7 Move i2c bus detectors to their respective files and add a detector macro for i2c busses so they can be detected asynchronously. Fix WMI and DMI info. 2020-08-07 14:01:59 -05:00
Adam Honse 7898e9b95d Initial prototype of asynchronous detection. DMI information broken 2020-08-07 14:01:59 -05:00
TheRogueZeta 5270b46e31 Re-order Zones 2020-08-07 12:54:56 -05:00
TheRogueZeta d0ab5a4de4 Fix Lighting Control packet typo. 2020-08-07 12:53:32 -05:00
TheRogueZeta 9be8ab8371 Add Logitech G Pro Wireless 2020-08-07 11:58:29 -05:00
Chris f0be42db38 Added 'X570 AORUS ULTRA' to known layouts 2020-08-07 11:44:03 -05:00
Adam Honse 8667211180 Move console attachment to main and only perform if running in a terminal. (!102) 2020-08-05 21:49:20 -05:00
Chris 8168e1cadb Initial controller for Tecknet mice 2020-08-05 21:35:23 -05:00
kernzerfall c15ceaa26c Add support for Logitech G502 Proteus Spectrum and G512 RGB.
- Set the G512 RGB to use G810 driver
- Add driver and interface for the G502 Proteus Spectrum
2020-08-05 21:06:30 -05:00
kernzerfall ee61b87fe4 Add udev rules 2020-08-05 21:06:12 -05:00
pobrn ddc69778dc Modular detection system with resource manager.
Includes pull request !87 with modifications by Adam Honse ([email protected]).
2020-08-05 00:23:34 -05:00
Adam Honse b3a7b7be81 Add 32-bit AppImage build target 2020-08-04 17:26:44 -05:00
Adam Honse f05df3768b Add number pad to Ducky matrix map 2020-08-04 10:26:38 -05:00
Katzenbiber 1be9f6e460 Add support for Logitech G203 Lightsync 2020-08-02 22:49:14 -05:00
santeri3700 3bbc3da48b Enable support for Holtek USB Gaming Mouse 2020-08-02 22:45:15 -05:00
santeri3700 92f7fe7dc4 Add support for Holtek USB Gaming Mouse 2020-08-02 22:42:56 -05:00
Ahmad Nassri f1d42d27ce docs(readme): include note about VS 2019 runtime 2020-08-02 22:41:24 -05:00
Adam Honse f288f63087 Update default DPI and add some modes to Pulsefire Surge controller 2020-08-02 22:38:42 -05:00
Adam Honse 226045cb8e Update key names on SteelSeries Apex controller 2020-07-31 22:36:21 -05:00
edbgon 4660870c22 Update SteelSeries Apex controller for Apex 7 TKL version 2020-07-31 22:08:57 -05:00
Adam Honse 412c819699 Set matrix map pointers to NULL for HyperX Pulsefire Surge 2020-07-31 12:29:08 -05:00
Adam Honse 635dcce7f0 Use the name Direct for all custom/static modes that transition smoothly without flicker 2020-07-31 10:49:25 -05:00
B Horn 1457831840 Modifying find_usb_serial_port() to return a vector 2020-07-31 08:47:39 -05:00
Adam Honse 00cc6978a2 Initial HyperX Pulsefire Surge controller 2020-07-28 20:37:12 -05:00
Chris d26e4da9f1 Added B550 Aorus Pro & Elite layouts
* Added MBName2Layout map
* Changed layouts to accomodate
2020-07-27 10:46:52 -05:00
Adam Honse 0a821526fa Fix typo 2020-07-27 10:17:28 -05:00
crashniels 68a92d0219 Read device mode and colours 2020-07-26 23:13:13 -05:00
crashniels 5221d93fc0 Changed UpdateMode() to DeviceUpdateMode() 2020-07-26 23:13:07 -05:00
crashniels 22deb13ac0 Added Galax modes in 2020-07-26 23:12:28 -05:00
crashniels 58b875d5ed Added missing references in the Qt Project file 2020-07-26 23:12:15 -05:00
crashniels 12f5d6070f WIP Galax RTX GPU support
Setting RGB values works. Modes still unknown.
2020-07-26 23:07:35 -05:00
crashniels 5e0b1fa3cc Added 0x3A to the Aura Ram Address list 2020-07-26 20:04:35 -05:00
Roger Roger 1ee3a7c3e2 Fix crash related to Razer Naga Trinity
Not all devices have static_mode at position 1, just setting it without
checking can crash the app
2020-07-26 15:49:39 -05:00
edbgon 43c13db970 Updated HID feature report with report ID for Windows compatibility 2020-07-26 15:46:20 -05:00
edbgon b5818d22af Update HID feature report to include report number for windows compatibility 2020-07-26 15:45:45 -05:00
Adam Honse fd7a5fc057 Add empty files/classes for HyperX Pulsefire Surge 2020-07-25 17:36:24 -05:00
Adam Honse 5af1ca9363 Fix formatting 2020-07-25 16:51:56 -05:00
Adam Honse c4d096e60c Update warning section in README to clarify a few things 2020-07-25 16:50:41 -05:00
Adam Honse 174b0743a9 Update timer resolution every 500ms to ensure it stays set while OpenRGB is active 2020-07-25 01:51:39 -05:00
Adam Honse 4b50533560 Uncomment timer initialization... 2020-07-25 01:33:18 -05:00
Adam Honse 1555dae1c8 Set timer resolution to 0.5ms on Windows 2020-07-25 01:20:49 -05:00
Chris 8b5717470a Fix for Gigabyte Fusion2 USB detection
* Adjusted the selection criteria for  USE_HID_USAGE flags
* Slight changes to the Fusion2USB controller to avoid crashes
* Updated DMIInfo to return correct Motherboard name on windows
2020-07-24 12:41:25 -05:00
edbgon 38b2cf03b0 LED name for 3rd LED group fixed 2020-07-24 12:39:24 -05:00
cjber 1293b07c9e add MSI 2070S Gaming X Support 2020-07-24 12:37:39 -05:00
Adam Honse aa4c41ddf7 Add Razer Blade Stealth and Blade Pro (2017) keymaps 2020-07-24 12:02:16 -05:00
Chris 628f423171 Minor fix for the Razer Blackwidow X Chroma 1532:0216
* Changed the 'w' to 'W' to match upstream
2020-07-23 21:57:21 -05:00
roger roger a9d179f93a Fixed typo that prevented the razer naga trinity from being detected 2020-07-23 21:56:26 -05:00
衛俊儒 4955dc0844 Update MSIGPUControllerDetect.cpp
MSI RTX2080 Sea Hawk EK X
2020-07-23 21:55:04 -05:00
Al_eXs 3f66f0d67a Fix Tab navigation order in the GUI 2020-07-23 21:48:31 -05:00
Adam Honse bc7ab5170a Add Razer BlackWidow Chroma Tournament Edition keymap 2020-07-23 21:18:30 -05:00
Adam Honse d61649f748 Add Razer BlackWidow Chroma keymap 2020-07-23 21:09:38 -05:00
Adam Honse 9a33a78574 Add keymap support to OpenRazer code and add a keymap for the Huntsman Elite 2020-07-23 14:42:34 -05:00
Adam Honse 030c0c60f3 Add (ANSI) and (ISO) specifiers to keys that differ between layouts 2020-07-23 11:17:23 -05:00
Adam Honse 19ff834d99 Fix apostrophe key on G810 2020-07-23 10:54:59 -05:00
Adam Honse 400a078a05 Fix media key names 2020-07-23 10:46:45 -05:00
Adam Honse 618bebc46b Update key names for G810 and Poseidon Z RGB 2020-07-23 10:26:16 -05:00
Adam Honse dee23ec52e Use synchronous mode update function in CLI 2020-07-22 23:29:32 -05:00
Adam Honse baca85b8cd Create a detection list for MSI GPU controller with card names 2020-07-22 22:32:00 -05:00
Arturo Casal 00b1cfcb3b Added Identifiers for MSI RTX 2080 Gaming X Trio 2020-07-22 20:47:55 -05:00
Shawn a9dbf5ef70 Add support for MSI 2060 Gaming X 2020-07-22 20:45:45 -05:00
Jeff Geer a0b1153ec3 Added Identifiers for MSI RTX 2080 Ti Gaming X Trio 2020-07-21 23:22:15 -05:00
Adam Honse 39a5e0eba0 Increment version number post-release 2020-07-21 23:21:10 -05:00
231 changed files with 11735 additions and 2320 deletions
+19 -3
View File
@@ -21,9 +21,25 @@ before_script:
- echo "started by ${GITLAB_USER_NAME}"
#-----------------------------------------------------------------------#
# Linux (AppImage) Build Target #
# Linux (AppImage) 32-bit Build Target #
#-----------------------------------------------------------------------#
build_linux:
build_linux_32:
image: i386/ubuntu:bionic
stage: build
script:
- apt update
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
- ./scripts/build-appimage-32.sh
artifacts:
paths:
- OpenRGB-i386.AppImage
expire_in: 1337 years
#-----------------------------------------------------------------------#
# Linux (AppImage) 64-bit Build Target #
#-----------------------------------------------------------------------#
build_linux_64:
image: ubuntu:bionic
stage: build
script:
@@ -35,7 +51,7 @@ build_linux:
paths:
- OpenRGB-x86_64.AppImage
expire_in: 1337 years
#-----------------------------------------------------------------------#
# Windows (32-bit) Build Target #
#-----------------------------------------------------------------------#
+37
View File
@@ -19,6 +19,11 @@ KERNEL=="hidraw*", SUBSYSTEM=="hidraw", TAG+="uaccess"
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0051", TAG+="uaccess"
#---------------------------------------------------------------#
# Aorus Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1044", ATTR{idProduct}=="7a42", TAG+="uaccess"
#---------------------------------------------------------------#
# ASUS Aura Core Devices #
#---------------------------------------------------------------#
@@ -43,6 +48,17 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18f3", TAG+="uacces
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0109", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Hydro Series Devices #
# #
# Corsair H100i Pro RGB #
# Corsair H115i Pro RGB #
# Corsair H150i Pro RGB #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c15", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c13", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c12", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Lighting Node Devices #
# #
@@ -126,12 +142,33 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16be", TAG+="uacces
# #
# Mice: #
# Logitech G203 Prodigy #
# Logitech G203 Lightsync #
# Logitech G403 Prodigy #
# Logitech G403 Hero #
# Logitech G502 Proteus Spectrum #
# Logitech G Lightspeed Wireless Gaming Mouse #
# Logitech G Pro Wireless Gaming Mouse (Wired) #
# Logitech G Powerplay Mousepad with Lightspeed #
# #
# Keyboards: #
# Logitech G512 #
# Logitech G512 RGB #
# Logitech G810 #1 #
# Logitech G810 #2 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c084", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c092", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c083", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c332", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c539", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c088", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c53a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c342", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c33c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c337", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c331", TAG+="uaccess"
#---------------------------------------------------------------#
# MSI Mysticlight #
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AMDWraithPrismController.h"
#include "RGBController.h"
#include "RGBController_AMDWraithPrism.h"
@@ -49,3 +50,5 @@ void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controller
info = info->next;
}
}
REGISTER_DETECTOR("AMD Wraith Prism", DetectAMDWraithPrismControllers);
@@ -0,0 +1,116 @@
/*-----------------------------------------*\
| ATC800Controller.cpp |
| |
| Driver for Aorus ATC800 CPU Cooler |
| |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "ATC800Controller.h"
#include <cstring>
ATC800Controller::ATC800Controller(hid_device* dev_handle)
{
dev = dev_handle;
}
ATC800Controller::~ATC800Controller()
{
hid_close(dev);
}
void ATC800Controller::SendCoolerMode
(
unsigned char mode,
unsigned short /*speed*/,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[9];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
if (channel == AORUS_ATC800_TOP_ZONE)
{
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xbe;
usb_buf[0x08] = 0xcc;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xc9;
usb_buf[0x02] = mode;
usb_buf[0x03] = 0x3c;
usb_buf[0x04] = 0x02;
usb_buf[0x05] = 0x00;
usb_buf[0x06] = 0x00;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xbc;
usb_buf[0x02] = red;
usb_buf[0x03] = green;
usb_buf[0x04] = blue;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xb6;
}
else if (channel == AORUS_ATC800_FANS_ZONE)
{
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xc9;
usb_buf[0x02] = mode;
usb_buf[0x03] = 0x3c;
usb_buf[0x04] = 0x02;
usb_buf[0x05] = 0x00;
usb_buf[0x06] = 0x01;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xb0;
usb_buf[0x02] = mode;
usb_buf[0x03] = red;
usb_buf[0x04] = green;
usb_buf[0x05] = blue;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
for(int i = 0xb0; i <= 0xb3; i++)
{
usb_buf[0x01] = i; //zone b0->b3
hid_send_feature_report(dev, usb_buf, 9);
}
}
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xb6;
hid_send_feature_report(dev, usb_buf, 9);
}
@@ -0,0 +1,59 @@
/*-----------------------------------------*\
| ATC800Controller.h |
| |
| Definitions and types for ATC800 CPU |
| Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AORUS_ATC800_MODE_OFF = 0x00,
AORUS_ATC800_MODE_STATIC = 0x01,
AORUS_ATC800_MODE_PULSE = 0x02,
AORUS_ATC800_MODE_FLASHING = 0x04,
AORUS_ATC800_MODE_DOUBLE_FLASH = 0x05,
};
enum
{
AORUS_ATC800_SPEED_SLOWEST = 0x00, /* Slowest speed */
AORUS_ATC800_SPEED_SLOW = 0x01, /* Slow speed */
AORUS_ATC800_SPEED_NORMAL = 0x02, /* Normal speed */
AORUS_ATC800_SPEED_FAST = 0x03, /* Fast speed */
AORUS_ATC800_SPEED_FASTEST = 0x04, /* Fastest speed */
};
enum
{
AORUS_ATC800_FANS_ZONE = 0,
AORUS_ATC800_TOP_ZONE = 1
};
class ATC800Controller
{
public:
ATC800Controller(hid_device* dev_handle);
~ATC800Controller();
void SendCoolerMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
};
@@ -0,0 +1,87 @@
#include "Detector.h"
#include "RGBController.h"
#include "ATC800Controller.h"
#include "RGBController_AorusATC800.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Vendor ID |
\*-----------------------------------------------------*/
#define HOLTEK_VID 0x1044
/*-----------------------------------------------------*\
| Controller product ids |
\*-----------------------------------------------------*/
#define ATC_800_CONTROLLER_PID 0x7A42
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
char usb_interface;
device_type type;
const char * name;
} device;
#define NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const device device_list[] =
{
{ HOLTEK_VID, ATC_800_CONTROLLER_PID, 0, DEVICE_TYPE_KEYBOARD, "Aorus ATC800 CPU Cooler" },
};
/******************************************************************************************\
* *
* DetectAorusCPUCoolerControllers *
* *
* Tests the USB address to see if a Aorus RGB CPU Cooler exists there. *
* *
\******************************************************************************************/
void DetectAorusCPUCoolerControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_init();
for(unsigned int device_idx = 0; device_idx < NUM_DEVICES; device_idx++)
{
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
while(info)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid)
#ifdef USE_HID_USAGE
&&(info->interface_number == device_list[device_idx].usb_interface)
&&(info->usage_page == 0xFF01)
&&(info->usage == 1))
#else
&&(info->interface_number == device_list[device_idx].usb_interface))
#endif
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
switch(device_list[device_idx].usb_pid)
{
case ATC_800_CONTROLLER_PID:
{
ATC800Controller* controller = new ATC800Controller(dev);
RGBController_AorusATC800* rgb_controller = new RGBController_AorusATC800(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
}
}
}
info = info->next;
}
hid_free_enumeration(info);
}
}
REGISTER_DETECTOR("Aorus CPU Coolers", DetectAorusCPUCoolerControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AuraCoreController.h"
#include "RGBController.h"
#include "RGBController_AuraCore.h"
@@ -43,3 +44,5 @@ void DetectAuraCoreControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
REGISTER_DETECTOR("ASUS Aura Core", DetectAuraCoreControllers);
@@ -6,6 +6,7 @@
| Jan Rettig (Klapstuhl) 14.02.2020 |
\*-----------------------------------------*/
#include "Detector.h"
#include "AuraGPUController.h"
#include "RGBController.h"
#include "RGBController_AuraGPU.h"
@@ -82,4 +83,6 @@ void DetectAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
std::this_thread::sleep_for(1ms);
}
}
} /* DetectAuraGPUControllers() */
} /* DetectAuraGPUControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura GPU", DetectAuraGPUControllers);
@@ -10,6 +10,21 @@
#include "AuraSMBusController.h"
#include <cstring>
static const char* aura_channels[] = /* Aura channel strings */
{
"Audio",
"Backplate",
"Back I/O",
"Center",
"Center",
"DRAM",
"PCIe",
"RGB Header",
"RGB Header 2",
"RGB Header",
"Unknown",
};
AuraSMBusController::AuraSMBusController(i2c_smbus_interface* bus, aura_dev_id dev)
{
this->bus = bus;
@@ -45,7 +60,7 @@ AuraSMBusController::AuraSMBusController(i2c_smbus_interface* bus, aura_dev_id d
{
direct_reg = AURA_REG_COLORS_DIRECT_V2;
effect_reg = AURA_REG_COLORS_EFFECT_V2;
channel_cfg = AURA_CONFIG_CHANNEL_V2;
channel_cfg = AURA_CONFIG_CHANNEL_V1;
}
// AUMA0-E6K5-0106 - Second generation motherboard controller
else if (strcmp(device_name, "AUMA0-E6K5-0106") == 0)
@@ -68,6 +83,13 @@ AuraSMBusController::AuraSMBusController(i2c_smbus_interface* bus, aura_dev_id d
effect_reg = AURA_REG_COLORS_EFFECT_V2;
channel_cfg = AURA_CONFIG_CHANNEL_V2;
}
// AUMA0-E8K4-0101 - Second generation motherboard controller
else if (strcmp(device_name, "AUMA0-E8K4-0101") == 0)
{
direct_reg = AURA_REG_COLORS_DIRECT_V2;
effect_reg = AURA_REG_COLORS_EFFECT_V2;
channel_cfg = AURA_CONFIG_CHANNEL_V2;
}
// Assume first generation controller if string does not match
else
{
@@ -66,21 +66,6 @@ enum
AURA_LED_CHANNEL_RGB_HEADER_3 = 0x91, /* RGB Header 3 LED channel */
};
static const char* aura_channels[] = /* Aura channel strings */
{
"Audio",
"Backplate",
"Back I/O",
"Center",
"Center",
"DRAM",
"PCIe",
"RGB Header",
"RGB Header 2",
"RGB Header",
"Unknown",
};
enum
{
AURA_CONFIG_LED_COUNT = 0x02, /* LED Count configuration offset */
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AuraSMBusController.h"
#include "RGBController.h"
#include "RGBController_AuraSMBus.h"
@@ -11,7 +12,7 @@ using namespace std::chrono_literals;
/*----------------------------------------------------------------------*\
| This list contains the available SMBus addresses for mapping Aura RAM |
\*----------------------------------------------------------------------*/
#define AURA_RAM_ADDRESS_COUNT 22
#define AURA_RAM_ADDRESS_COUNT 23
static const unsigned char aura_ram_addresses[] =
{
@@ -34,6 +35,7 @@ static const unsigned char aura_ram_addresses[] =
0x66,
0x67,
0x39,
0x3A,
0x3B,
0x3C,
0x3D
@@ -187,3 +189,5 @@ void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::
}
} /* DetectAuraSMBusControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAuraSMBusControllers);
@@ -40,7 +40,7 @@ void AuraAddressableController::SetChannelLEDs(unsigned char channel, RGBColor *
leds_to_send = num_colors - leds_sent;
}
for(int led_idx = 0; led_idx < leds_to_send; led_idx++)
for(unsigned int led_idx = 0; led_idx < leds_to_send; led_idx++)
{
led_data[(led_idx * 3) + 0] = RGBGetRValue(colors[led_idx + leds_sent]);
led_data[(led_idx * 3) + 1] = RGBGetGValue(colors[led_idx + leds_sent]);
@@ -44,7 +44,7 @@ void AuraMainboardController::SetChannelLEDs(unsigned char channel, RGBColor * c
leds_to_send = num_colors - leds_sent;
}
for(int led_idx = 0; led_idx < leds_to_send; led_idx++)
for(unsigned int led_idx = 0; led_idx < leds_to_send; led_idx++)
{
led_data[(led_idx * 3) + 0] = RGBGetRValue(colors[led_idx + leds_sent]);
led_data[(led_idx * 3) + 1] = RGBGetGValue(colors[led_idx + leds_sent]);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AuraAddressableController.h"
#include "AuraMainboardController.h"
#include "RGBController.h"
@@ -74,4 +75,6 @@ void DetectAuraUSBControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
}
} /* DetectAuraUSBControllers() */
REGISTER_DETECTOR("ASUS Aura USB", DetectAuraUSBControllers);
@@ -9,18 +9,38 @@
#include "CMMP750Controller.h"
static unsigned char colour_mode_data[][6] =
{
{ 0x01, 0x04, 0xFF, 0x00, 0xFF, 0x00 }, /* Static */
{ 0x02, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Blinking */
{ 0x03, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Breathing */
{ 0x04, 0x04, 0x80, 0x00, 0x00, 0x00 }, /* Colour Cycle */
{ 0x05, 0x04, 0x80, 0x00, 0x00, 0x00 } /* Colour Breath */
};
static unsigned char speed_mode_data[][9] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },/* Static */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Blinking */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Breathing */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Colour Cycle */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 } /* Colour Breath */
};
CMMP750Controller::CMMP750Controller(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path)
{
int tmp_size = wcslen(_vendor);
dev = dev_handle;
location = _path;
std::size_t tmp_size = wcslen(_vendor);
dev = dev_handle;
location = _path;
for (int i=0; ( i<tmp_size && i<CM_DEVICE_NAME_SIZE); i++)
for(std::size_t i = 0; (i < tmp_size) && (i < CM_DEVICE_NAME_SIZE); i++)
{
device_name[i] = (char)_vendor[i];
}
for (int j=0; ( j<wcslen(_vendor) && tmp_size+j<CM_DEVICE_NAME_SIZE); j++)
device_name[tmp_size+j] = (char)_device_name[j];
for(std::size_t j = 0; (j < wcslen(_vendor)) && (tmp_size + j < CM_DEVICE_NAME_SIZE); j++)
{
device_name[tmp_size + j] = (char)_device_name[j];
}
GetStatus(); //When setting up device get current status
}
@@ -39,20 +59,22 @@ void CMMP750Controller::GetStatus()
hid_write(dev, buffer, buffer_size);
hid_read(dev, buffer, buffer_size);
if( buffer[0] == 0x80 && buffer[1] == 0x05 )
if((buffer[0] == 0x80) && (buffer[1] == 0x05))
{
current_mode = buffer[2] - 1;
current_red = buffer[3];
current_green = buffer[4];
current_blue = buffer[5];
for( int i = 0; speed_mode_data[current_mode][i] >= buffer[6]; i++)
for(int i = 0; speed_mode_data[current_mode][i] >= buffer[6]; i++)
{
current_speed = i;
}
}
else
{
//Code should never reach here however just in case there is a failure set something
current_mode = MP750_MODE_COLOR_CYCLE; //Unicorn Spew
current_mode = MP750_MODE_COLOR_CYCLE; //Unicorn Spew
current_red = 0xFF;
current_green = 0xFF;
current_blue = 0xFF;
@@ -122,7 +144,7 @@ void CMMP750Controller::SendUpdate()
unsigned char buffer[0x40] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
for(int i = 0; i < CM_COLOUR_MODE_DATA_SIZE; i++)
for(std::size_t i = 0; i < CM_COLOUR_MODE_DATA_SIZE; i++)
{
buffer[i] = colour_mode_data[current_mode][i];
}
@@ -130,16 +152,16 @@ void CMMP750Controller::SendUpdate()
if(current_mode > MP750_MODE_BREATHING)
{
//If the mode is random colours set SPEED at BYTE2
buffer[CM_RED_BYTE] = speed_mode_data[current_mode][current_speed];
buffer[CM_RED_BYTE] = speed_mode_data[current_mode][current_speed];
}
else
{
//Otherwise SPEED is BYTE5
buffer[CM_RED_BYTE] = current_red;
buffer[CM_GREEN_BYTE] = current_green;
buffer[CM_BLUE_BYTE] = current_blue;
buffer[CM_SPEED_BYTE] = speed_mode_data[current_mode][current_speed];
buffer[CM_RED_BYTE] = current_red;
buffer[CM_GREEN_BYTE] = current_green;
buffer[CM_BLUE_BYTE] = current_blue;
buffer[CM_SPEED_BYTE] = speed_mode_data[current_mode][current_speed];
}
hid_write(dev, buffer, buffer_size);
}
}
@@ -44,24 +44,6 @@ enum
MP750_MODE_BREATH_CYCLE = 0x04 //Breathing Cycle Mode
};
static unsigned char colour_mode_data[][6] =
{
{ 0x01, 0x04, 0xFF, 0x00, 0xFF, 0x00 }, /* Static */
{ 0x02, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Blinking */
{ 0x03, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Breathing */
{ 0x04, 0x04, 0x80, 0x00, 0x00, 0x00 }, /* Colour Cycle */
{ 0x05, 0x04, 0x80, 0x00, 0x00, 0x00 } /* Colour Breath */
};
static unsigned char speed_mode_data[][9] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },/* Static */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Blinking */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Breathing */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Colour Cycle */
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 } /* Colour Breath */
};
enum
{
MP750_SPEED_SLOWEST = 0x00, /* Slowest speed */
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CMMP750Controller.h"
#include "RGBController.h"
#include "RGBController_CMMP750Controller.h"
@@ -43,7 +44,7 @@ void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
hid_device* dev = NULL;
if(info->vendor_id == COOLERMASTER_VID)
{
for(int cm_pid_idx = 0; cm_pid_idx < COOLERMASTER_NUM_DEVICES; cm_pid_idx++)
for(unsigned int cm_pid_idx = 0; cm_pid_idx < COOLERMASTER_NUM_DEVICES; cm_pid_idx++)
{
if((info->product_id == cm_pids[cm_pid_idx][CM_PID])
&&(info->interface_number == cm_pids[cm_pid_idx][CM_INTERFACE]))
@@ -63,4 +64,6 @@ void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
hid_free_enumeration(info);
}
} /* DetectCoolerMasterControllers() */
REGISTER_DETECTOR("Cooler Master", DetectCoolerMasterControllers);
@@ -0,0 +1,251 @@
/*---------------------------------------------------------*\
| Processing Code for Corsair Hydro Series |
| |
| Adam Honse ([email protected]), 8/17/2020 |
\*---------------------------------------------------------*/
#include "CorsairHydroController.h"
#include <cstring>
CorsairHydroController::CorsairHydroController(libusb_device_handle* dev_handle)
{
dev = dev_handle;
SendInit();
SendFirmwareRequest();
}
std::string CorsairHydroController::GetFirmwareString()
{
return(firmware_version);
}
void CorsairHydroController::SetBlink
(
std::vector<RGBColor> & colors,
unsigned char speed
)
{
SendColors(colors);
SendSpeed(speed);
SendApplyBlink();
}
void CorsairHydroController::SetFixed
(
std::vector<RGBColor> & colors
)
{
SendColors(colors);
/*-----------------------------------------------------*\
| Fixed mode seems to just be shift mode with the same |
| value for both colors |
\*-----------------------------------------------------*/
SendApplyShift();
}
void CorsairHydroController::SetPulse
(
std::vector<RGBColor> & colors,
unsigned char speed
)
{
SendColors(colors);
SendSpeed(speed);
SendApplyPulse();
}
void CorsairHydroController::SetShift
(
std::vector<RGBColor> & colors,
unsigned char speed
)
{
SendColors(colors);
SendSpeed(speed);
SendApplyShift();
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairHydroController::SendApplyBlink()
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Apply Blink packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x58;
usb_buf[1] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendApplyPulse()
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Apply Pulse packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x52;
usb_buf[1] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendApplyShift()
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Apply Shift packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x55;
usb_buf[1] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendFirmwareRequest()
{
unsigned char usb_buf[8];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Firmware Request packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0xAA;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 1, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 7, &actual, 1000);
firmware_version = std::to_string(usb_buf[3]) + "." + std::to_string(usb_buf[4]) + "." + std::to_string(usb_buf[5]) + "." + std::to_string(usb_buf[6]);
}
void CorsairHydroController::SendColors
(
std::vector<RGBColor> & colors
)
{
unsigned char usb_buf[23];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Send Colors packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x56;
usb_buf[1] = colors.size();
/*---------------------------------------------------------*\
| Fill in colors from vector |
\*---------------------------------------------------------*/
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
usb_buf[(color_idx * 3) + 2] = RGBGetRValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 3] = RGBGetGValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 4] = RGBGetBValue(colors[color_idx]);
/*---------------------------------------------------------*\
| If the color vector only has one entry, duplicate it, as |
| the controller appears to require two colors in order to |
| update. |
\*---------------------------------------------------------*/
if((color_idx == 0) && colors.size() == 1)
{
usb_buf[1] = colors.size() + 1;
usb_buf[(color_idx * 3) + 5] = RGBGetRValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 6] = RGBGetGValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 7] = RGBGetBValue(colors[color_idx]);
}
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2 + (usb_buf[1] * 3), &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendInit()
{
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_control_transfer( dev, 0x40, 0x00, 0xffff, 0x0000, NULL, 0, 0 );
libusb_control_transfer( dev, 0x40, 0x02, 0x0002, 0x0000, NULL, 0, 0 );
}
void CorsairHydroController::SendSpeed
(
unsigned char speed
)
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Send Speed packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x53;
usb_buf[1] = speed;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
@@ -0,0 +1,86 @@
/*---------------------------------------------------------*\
| Definitions for Corsair Hydro Series |
| |
| Adam Honse ([email protected]), 8/17/2020 |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#pragma once
enum
{
CORSAIR_HYDRO_CMD_READ_PUMP_SPEED = 0x31,
CORSAIR_HYDRO_CMD_WRITE_PUMP_MODE = 0x32,
CORSAIR_HYDRO_CMD_READ_PUMP_MODE = 0x33,
CORSAIR_HYDRO_CMD_READ_FAN_SPEED = 0x41,
CORSAIR_HYDRO_CMD_READ_AIO_TEMP = 0xA9,
CORSAIR_HYDRO_CMD_READ_FIRMWARE = 0xAA,
};
enum
{
CORSAIR_HYDRO_PUMP_MODE_QUIET = 0x00,
CORSAIR_HYDRO_PUMP_MODE_BALANCED = 0x01,
CORSAIR_HYDRO_PUMP_MODE_PERFORMANCE = 0x02,
};
class CorsairHydroController
{
public:
CorsairHydroController(libusb_device_handle* dev_handle);
~CorsairHydroController();
unsigned char GetFanPercent(unsigned char fan_channel);
unsigned short GetFanRPM(unsigned char fan_channel);
std::string GetFirmwareString();
void SetBlink
(
std::vector<RGBColor> & colors,
unsigned char speed
);
void SetFixed
(
std::vector<RGBColor> & colors
);
void SetPulse
(
std::vector<RGBColor> & colors,
unsigned char speed
);
void SetShift
(
std::vector<RGBColor> & colors,
unsigned char speed
);
private:
libusb_device_handle* dev;
std::string firmware_version;
void SendApplyBlink();
void SendApplyPulse();
void SendApplyShift();
void SendColors
(
std::vector<RGBColor> & colors
);
void SendFirmwareRequest();
void SendInit();
void SendSpeed
(
unsigned char speed
);
};
@@ -0,0 +1,74 @@
#include "Detector.h"
#include "CorsairHydroController.h"
#include "RGBController.h"
#include "RGBController_CorsairHydro.h"
#include <vector>
#include <libusb-1.0/libusb.h>
/*-----------------------------------------------------*\
| Corsair vendor ID |
\*-----------------------------------------------------*/
#define CORSAIR_VID 0x1B1C
/*-----------------------------------------------------*\
| Keyboard Hydro Series product IDs |
\*-----------------------------------------------------*/
#define CORSAIR_H115I_PRO_RGB_PID 0x0C13
#define CORSAIR_H100I_PRO_RGB_PID 0x0C15
#define CORSAIR_H150I_PRO_RGB_PID 0x0C12
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned char usb_interface;
const char * name;
} corsair_hydro_device;
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const corsair_hydro_device device_list[] =
{
/*-----------------------------------------------------------------------------------------------------*\
| Coolers |
\*-----------------------------------------------------------------------------------------------------*/
{ CORSAIR_VID, CORSAIR_H100I_PRO_RGB_PID, 0, "Corsair H100i PRO RGB" },
{ CORSAIR_VID, CORSAIR_H115I_PRO_RGB_PID, 0, "Corsair H115i PRO RGB" },
{ CORSAIR_VID, CORSAIR_H150I_PRO_RGB_PID, 0, "Corsair H150i PRO RGB" },
};
/******************************************************************************************\
* *
* DetectCorsairHydroControllers *
* *
* Tests the USB address to see if a Corsair RGB Cooler controller exists there. *
* *
\******************************************************************************************/
void DetectCorsairHydroControllers(std::vector<RGBController*>& rgb_controllers)
{
libusb_context * ctx;
libusb_init(&ctx);
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
{
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
//Look for Corsair RGB Peripheral
if(dev)
{
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
CorsairHydroController* controller = new CorsairHydroController(dev);//, device_list[device_idx].usb_endpoint);
RGBController_CorsairHydro* rgb_controller = new RGBController_CorsairHydro(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectCorsairHydroControllers() */
REGISTER_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairLightingNodeController.h"
#include "RGBController.h"
#include "RGBController_CorsairLightingNode.h"
@@ -77,3 +78,5 @@ void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_contr
}
}
} /* DetectCorsairLightingNodeControllers() */
REGISTER_DETECTOR("Corsair Lighting Node", DetectCorsairLightingNodeControllers);
@@ -22,6 +22,30 @@ static unsigned int keys[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x
116, 117, 120, 121, 122, 123, 124, 126, 127, 128, 129, 132, 133, 134, 135,
136, 137, 139, 140, 141};
static unsigned int keys_k95_plat[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12,
0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x24, 0x25, 0x26,
0x27, 0x28, 0x2A, 0x2B, 0x2C, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x42, 0x43, 0x44, 0x45, 0x48, 73, 74, 75, 76, 78,
79, 80, 81, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 115,
116, 117, 120, 121, 122, 123, 124, 126, 127, 128, 129, 132, 133, 134, 135,
136, 137, 139, 140, 141,
0x10, 114, 0x0a, 0x16, 0x22, 0x2e, 0x3a, 0x46,
144, 145, 146, 158, 160, 147, 148, 149, 150, 151, 152, 153,
154, 155, 159, 162, 161, 156, 157};
static unsigned int keys_k95[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12,
0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x24, 0x25, 0x26,
0x27, 0x28, 0x2A, 0x2B, 0x2C, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x42, 0x43, 0x44, 0x45, 0x48, 73, 74, 75, 76, 78,
79, 80, 81, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 115,
116, 117, 120, 121, 122, 123, 124, 126, 127, 128, 129, 132, 133, 134, 135,
136, 137, 139, 140, 141,
0x10, 114, 0x0a, 0x16, 0x22, 0x2e, 0x3a, 0x46, 0x52, 0x5e, 0x6a, 0x76, 0x3b, 0x47, 0x53,
0x5f, 0x6b, 0x77, 0x83, 0x8f, 0x0b, 0x17, 0x23, 0x2f};
static unsigned int st100[] = { 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x04 };
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle)
@@ -43,6 +67,16 @@ device_type CorsairPeripheralController::GetDeviceType()
return type;
}
int CorsairPeripheralController::GetPhysicalLayout()
{
return physical_layout;
}
int CorsairPeripheralController::GetLogicalLayout()
{
return logical_layout;
}
std::string CorsairPeripheralController::GetFirmwareString()
{
return firmware_version;
@@ -88,9 +122,9 @@ void CorsairPeripheralController::SetLEDs(std::vector<RGBColor>colors)
void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colors)
{
unsigned char red_val[144];
unsigned char grn_val[144];
unsigned char blu_val[144];
unsigned char red_val[168];
unsigned char grn_val[168];
unsigned char blu_val[168];
/*-----------------------------------------------------*\
| Zero out buffers |
@@ -105,9 +139,24 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
RGBColor color = colors[color_idx];
red_val[keys[color_idx]] = RGBGetRValue(color);
grn_val[keys[color_idx]] = RGBGetGValue(color);
blu_val[keys[color_idx]] = RGBGetBValue(color);
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
red_val[keys_k95_plat[color_idx]] = RGBGetRValue(color);
grn_val[keys_k95_plat[color_idx]] = RGBGetGValue(color);
blu_val[keys_k95_plat[color_idx]] = RGBGetBValue(color);
}
else if (logical_layout == CORSAIR_TYPE_K95)
{
red_val[keys_k95[color_idx]] = RGBGetRValue(color);
grn_val[keys_k95[color_idx]] = RGBGetGValue(color);
blu_val[keys_k95[color_idx]] = RGBGetBValue(color);
}
else
{
red_val[keys[color_idx]] = RGBGetRValue(color);
grn_val[keys[color_idx]] = RGBGetGValue(color);
blu_val[keys[color_idx]] = RGBGetBValue(color);
}
}
/*-----------------------------------------------------*\
@@ -115,7 +164,7 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
\*-----------------------------------------------------*/
StreamPacket(1, 60, &red_val[0]);
StreamPacket(2, 60, &red_val[60]);
StreamPacket(3, 24, &red_val[120]);
StreamPacket(3, 48, &red_val[120]);
SubmitKeyboardFullColors(1, 3, 1);
/*-----------------------------------------------------*\
@@ -123,7 +172,7 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
\*-----------------------------------------------------*/
StreamPacket(1, 60, &grn_val[0]);
StreamPacket(2, 60, &grn_val[60]);
StreamPacket(3, 24, &grn_val[120]);
StreamPacket(3, 48, &grn_val[120]);
SubmitKeyboardFullColors(2, 3, 1);
/*-----------------------------------------------------*\
@@ -131,7 +180,7 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
\*-----------------------------------------------------*/
StreamPacket(1, 60, &blu_val[0]);
StreamPacket(2, 60, &blu_val[60]);
StreamPacket(3, 24, &blu_val[120]);
StreamPacket(3, 48, &blu_val[120]);
SubmitKeyboardFullColors(3, 3, 2);
}
@@ -286,6 +335,7 @@ void CorsairPeripheralController::SpecialFunctionControl()
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::ReadFirmwareInfo()
{
int actual;
@@ -340,6 +390,23 @@ void CorsairPeripheralController::ReadFirmwareInfo()
switch((unsigned char)usb_buf[0x14 + offset])
{
case 0xC0:
{
unsigned short pid = (unsigned short)(usb_buf[0x0F] << 8) + (unsigned char)(usb_buf[0x0E]);
switch(pid)
{
case 0x2D1B:
logical_layout = CORSAIR_TYPE_K95_PLAT;
break;
case 0x1B11:
logical_layout = CORSAIR_TYPE_K95;
break;
default:
logical_layout = CORSAIR_TYPE_NORMAL;
}
}
type = DEVICE_TYPE_KEYBOARD;
break;
@@ -379,6 +446,21 @@ void CorsairPeripheralController::ReadFirmwareInfo()
{
firmware_version = std::to_string(usb_buf[0x09 + offset]) + "." + std::to_string(usb_buf[0x08 + offset]);
}
/*-----------------------------------------------------*\
| Get the correct Keyboard Layout |
\*-----------------------------------------------------*/
switch((unsigned char)usb_buf[0x17 + offset])
{
case CORSAIR_LAYOUT_ANSI:
physical_layout = CORSAIR_LAYOUT_ANSI;
break;
case CORSAIR_LAYOUT_ISO:
physical_layout = CORSAIR_LAYOUT_ISO;
break;
default:
physical_layout = CORSAIR_LAYOUT_ANSI;
}
}
void CorsairPeripheralController::StreamPacket
@@ -47,12 +47,30 @@ enum
CORSAIR_COLOR_CHANNEL_BLUE = 0x03
};
enum
{
CORSAIR_LAYOUT_ANSI = 0x00,
CORSAIR_LAYOUT_ISO = 0x01,
CORSAIR_LAYOUT_ABNT = 0x02,
CORSAIR_LAYOUT_JIS = 0x03,
CORSAIR_LAYOUT_DUBEOLSIK = 0x04
};
enum
{
CORSAIR_TYPE_NORMAL = 0,
CORSAIR_TYPE_K95_PLAT = 1,
CORSAIR_TYPE_K95 = 2
};
class CorsairPeripheralController
{
public:
CorsairPeripheralController(hid_device* dev_handle);
~CorsairPeripheralController();
int GetLogicalLayout();
int GetPhysicalLayout();
device_type GetDeviceType();
std::string GetFirmwareString();
@@ -67,6 +85,8 @@ private:
std::string firmware_version;
device_type type;
int physical_layout; //ANSI, ISO, etc.
int logical_layout; //Normal, K95 or K95 Platinum
void LightingControl();
void SpecialFunctionControl();
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairPeripheralController.h"
#include "RGBController.h"
#include "RGBController_CorsairPeripheral.h"
@@ -44,6 +45,8 @@
#define CORSAIR_HARPOON_RGB_PRO_PID 0x1B75
#define CORSAIR_M65_PRO_PID 0x1B2E
#define CORSAIR_M65_RGB_ELITE_PID 0x1B5A
#define CORSAIR_SCIMITAR_PRO_RGB_PID 0x1B3E
#define CORSAIR_SABRE_RGB_PID 0x1B2F
/*-----------------------------------------------------*\
| Mousepad product IDs |
@@ -95,6 +98,8 @@ static const corsair_node_device device_list[] =
{ CORSAIR_VID, CORSAIR_HARPOON_RGB_PRO_PID, 1, "Corsair Harpoon RGB PRO" },
{ CORSAIR_VID, CORSAIR_M65_PRO_PID, 1, "Corsair M65 PRO" },
{ CORSAIR_VID, CORSAIR_M65_RGB_ELITE_PID, 1, "Corsair M65 RGB Elite" },
{ CORSAIR_VID, CORSAIR_SCIMITAR_PRO_RGB_PID, 1, "Corsair Scimitar PRO RGB" },
{ CORSAIR_VID, CORSAIR_SABRE_RGB_PID, 1, "Corsair Sabre RGB" },
/*-----------------------------------------------------------------------------------------------------*\
| Mousemats |
\*-----------------------------------------------------------------------------------------------------*/
@@ -157,4 +162,6 @@ void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_control
info = info->next;
}
}
}
} /* DetectCorsairPeripheralControllers() */
REGISTER_DETECTOR("Corsair Peripheral", DetectCorsairPeripheralControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairVengeanceController.h"
#include "RGBController.h"
#include "RGBController_CorsairVengeance.h"
@@ -122,4 +123,6 @@ void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses
}
}
} /* DetectCorsairVengeanceControllers() */
} /* DetectCorsairVengeanceControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance", DetectCorsairVengeanceControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairVengeanceProController.h"
#include "RGBController.h"
#include "RGBController_CorsairVengeancePro.h"
@@ -130,4 +131,6 @@ void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &bus
}
}
} /* DetectCorsairVengeanceProControllers() */
} /* DetectCorsairVengeanceProControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance Pro", DetectCorsairVengeanceProControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CrucialController.h"
#include "RGBController.h"
#include "RGBController_Crucial.h"
@@ -86,3 +87,5 @@ void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
}
} /* DetectCrucialControllers() */
REGISTER_I2C_DETECTOR("Crucial", DetectCrucialControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "DuckyKeyboardController.h"
#include "RGBController.h"
#include "RGBController_DuckyKeyboard.h"
@@ -78,4 +79,6 @@ void DetectDuckyKeyboardControllers(std::vector<RGBController*>& rgb_controllers
info = info->next;
}
}
}
} /* DetectDuckyKeyboardControllers() */
REGISTER_DETECTOR("Ducky Keyboard", DetectDuckyKeyboardControllers);
+47 -9
View File
@@ -9,31 +9,69 @@
#include "EKController.h"
static unsigned char colour_mode_data[][16] =
{
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x01, 0x00, 0xFF, 0x64}, // Static
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x02, 0x00, 0xFF, 0x64}, // Breathing
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x03, 0xFF, 0xFF, 0x64}, // Fading
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x04, 0x00, 0xFF, 0x64}, // Marquee
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x05, 0x00, 0xFF, 0x64}, // Covering Marquee
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x06, 0x00, 0xFF, 0x64}, // Pulse
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x07, 0x00, 0xFF, 0x64}, // Wave
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x08, 0x00, 0xFF, 0x64}, // Alternating
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x09, 0x00, 0xFF, 0x64}, // Candle
};
static unsigned char speed_mode_data[][9] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Static
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Breathing
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Fading
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Marquee
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Covering Marquee
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Pulse
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Wave
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Alternating
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 } // Candle
};
EKController::EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path)
{
int tmp_size = wcslen(_vendor);
std::size_t tmp_size = wcslen(_vendor);
dev = dev_handle;
for(int i=0; (i < tmp_size) && (i < EK_DEVICE_NAME_SIZE); i++)
for(std::size_t i = 0; (i < tmp_size) && (i < EK_DEVICE_NAME_SIZE); i++)
{
device_name[i] = (char)_vendor[i];
}
for(int j=0; (j < wcslen(_vendor)) && ((tmp_size + j) < EK_DEVICE_NAME_SIZE); j++)
for(std::size_t j = 0; (j < wcslen(_vendor)) && ((tmp_size + j) < EK_DEVICE_NAME_SIZE); j++)
{
device_name[tmp_size+j] = (char)_device_name[j];
device_name[tmp_size + j] = (char)_device_name[j];
}
location = _path;
current_mode = EK_MODE_STATIC;
current_mode = EK_MODE_STATIC;
current_speed = EK_SPEED_NORMAL;
}
EKController::~EKController()
{
hid_close(dev);
if(dev)
{
hid_close(dev);
}
}
char* EKController::GetDeviceName()
@@ -73,15 +111,15 @@ void EKController::SendUpdate()
unsigned char buffer[EK_PACKET_LENGTH] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
for(int i = 0; i < EK_COLOUR_MODE_DATA_SIZE; i++)
for(std::size_t i = 0; i < EK_COLOUR_MODE_DATA_SIZE; i++)
{
buffer[i] = colour_mode_data[current_mode][i];
}
//Set the relevant colour info
buffer[EK_RED_BYTE] = current_red;
buffer[EK_RED_BYTE] = current_red;
buffer[EK_GREEN_BYTE] = current_green;
buffer[EK_BLUE_BYTE] = current_blue;
buffer[EK_BLUE_BYTE] = current_blue;
buffer[EK_SPEED_BYTE] = speed_mode_data[current_mode][current_speed];
buffer[10] = 0x10;
-35
View File
@@ -39,41 +39,6 @@ enum
EK_MODE_CANDLE = 0x08 //Candle Mode
};
static unsigned char colour_mode_data[][16] =
{
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x01, 0x00, 0xFF, 0x64}, // Static
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x02, 0x00, 0xFF, 0x64}, // Breathing
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x03, 0xFF, 0xFF, 0x64}, // Fading
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x04, 0x00, 0xFF, 0x64}, // Marquee
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x05, 0x00, 0xFF, 0x64}, // Covering Marquee
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x06, 0x00, 0xFF, 0x64}, // Pulse
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x07, 0x00, 0xFF, 0x64}, // Wave
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x08, 0x00, 0xFF, 0x64}, // Alternating
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
0x00, 0x10, 0x20, 0x01, 0x09, 0x00, 0xFF, 0x64}, // Candle
};
static unsigned char speed_mode_data[][9] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Static
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Breathing
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Fading
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Marquee
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Covering Marquee
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Pulse
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Wave
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Alternating
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 } // Candle
};
enum
{
EK_SPEED_SLOWEST = 0x00, // Slowest speed
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "EKController.h"
#include "RGBController.h"
#include "RGBController_EKController.h"
@@ -30,18 +31,18 @@ static const unsigned int ek_pids[][2] =
void DetectEKControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device_info* info = NULL;
//Look for the passed in cm_pids
hid_init();
info = hid_enumerate(0x0, 0x0);
info = hid_enumerate(EK_VID, 0x0);
while(info)
{
hid_device* dev = NULL;
if(info->vendor_id == EK_VID)
{
for(int ek_pid_idx = 0; ek_pid_idx < EK_NUM_DEVICES; ek_pid_idx++)
for(unsigned int ek_pid_idx = 0; ek_pid_idx < EK_NUM_DEVICES; ek_pid_idx++)
{
if((info->product_id == ek_pids[ek_pid_idx][EK_PID])
&&(info->interface_number == ek_pids[ek_pid_idx][EK_INTERFACE]))
@@ -61,4 +62,6 @@ void DetectEKControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
hid_free_enumeration(info);
}
} /* DetectEKControllers() */
REGISTER_DETECTOR("EK", DetectEKControllers);
@@ -0,0 +1,106 @@
/*-----------------------------------------*\
| GalaxGPUController.cpp |
| |
| Driver for Galax / KFA2 RGB on GPUs |
| |
| Niels Westphal (crashniels) 12.07.2020 |
\*-----------------------------------------*/
#include "GalaxGPUController.h"
#include <cstring>
GalaxGPUController::GalaxGPUController(i2c_smbus_interface* bus, galax_gpu_dev_id dev)
{
this->bus = bus;
this->dev = dev;
strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder.
}
GalaxGPUController::~GalaxGPUController()
{
}
std::string GalaxGPUController::GetDeviceName()
{
return(device_name);
}
std::string GalaxGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
}
unsigned char GalaxGPUController::GetLEDRed()
{
return(GalaxGPURegisterRead(GALAX_RED_REGISTER));
}
unsigned char GalaxGPUController::GetLEDGreen()
{
return(GalaxGPURegisterRead(GALAX_GREEN_REGISTER));
}
unsigned char GalaxGPUController::GetLEDBlue()
{
return(GalaxGPURegisterRead(GALAX_BLUE_REGISTER));
}
void GalaxGPUController::SetLEDColorsDirect(unsigned char red, unsigned char green, unsigned char blue) // Direct Mode is just Static Mode without applying color changes
{
GalaxGPURegisterWrite(GALAX_RED_REGISTER, red);
GalaxGPURegisterWrite(GALAX_GREEN_REGISTER, green);
GalaxGPURegisterWrite(GALAX_BLUE_REGISTER, blue);
}
void GalaxGPUController::SetLEDColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
{
GalaxGPURegisterWrite(GALAX_RED_REGISTER, red);
GalaxGPURegisterWrite(GALAX_GREEN_REGISTER, green);
GalaxGPURegisterWrite(GALAX_BLUE_REGISTER, blue);
}
void GalaxGPUController::SetMode(unsigned char mode)
{
switch(mode)
{
case 1:
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_STATIC_VALUE_1);
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_STATIC_VALUE_2);
break;
case 2:
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_BREATHING_VALUE_1);
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_BREATHING_VALUE_2);
break;
case 3:
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_RAINBOW_VALUE_1);
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_RAINBOW_VALUE_2);
break;
case 4:
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_CYCLE_BREATHING_VALUE_1);
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_CYCLE_BREATHING_VALUE_2);
break;
default:
break;
}
}
unsigned char GalaxGPUController::GalaxGPURegisterRead(unsigned char reg)
{
return(bus->i2c_smbus_read_byte_data(dev, reg));
}
void GalaxGPUController::GalaxGPURegisterWrite(unsigned char reg, unsigned char val)
{
bus->i2c_smbus_write_byte_data(dev, reg, val);
}
@@ -0,0 +1,67 @@
/*-----------------------------------------*\
| GalaxGPUController.h |
| |
| Driver for Galax / KFA2 RGB on GPUs |
| |
| Niels Westphal (crashniels) 12.07.2020 |
\*-----------------------------------------*/
#include <string>
#include "i2c_smbus.h"
#pragma once
typedef unsigned char galax_gpu_dev_id;
enum
{
/* RGB Registers */
GALAX_RED_REGISTER = 0x02, /* Red Register */
GALAX_GREEN_REGISTER = 0x03, /* Green Register */
GALAX_BLUE_REGISTER = 0x04, /* Blue Register */
/* MODE Registers */
GALAX_MODE_REGISTER_1 = 0x05, /* Mode Register 1 */
GALAX_MODE_REGISTER_2 = 0x06, /* Mode Register 2 */
};
enum
{
/* Static Mode Values */
GALAX_MODE_STATIC_VALUE_1 = 0x00,
GALAX_MODE_STATIC_VALUE_2 = 0x01,
/* Breathing Mode Values */
GALAX_MODE_BREATHING_VALUE_1 = 0x04,
GALAX_MODE_BREATHING_VALUE_2 = 0x00,
/* Rainbow Mode Values */
GALAX_MODE_RAINBOW_VALUE_1 = 0x84,
GALAX_MODE_RAINBOW_VALUE_2 = 0x02,
/* Cycle Breathing Mode Values */
GALAX_MODE_CYCLE_BREATHING_VALUE_1 = 0x84,
GALAX_MODE_CYCLE_BREATHING_VALUE_2 = 0x40,
};
class GalaxGPUController
{
public:
GalaxGPUController(i2c_smbus_interface* bus, galax_gpu_dev_id);
~GalaxGPUController();
std::string GetDeviceName();
std::string GetDeviceLocation();
unsigned char GetLEDRed();
unsigned char GetLEDGreen();
unsigned char GetLEDBlue();
void SetLEDColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColorsEffect(unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode);
unsigned char GalaxGPURegisterRead(unsigned char reg);
void GalaxGPURegisterWrite(unsigned char reg, unsigned char val);
bool direct = false; // Temporary solution to check if we are in "Direct" mode
private:
char device_name[16];
i2c_smbus_interface * bus;
galax_gpu_dev_id dev;
};
@@ -0,0 +1,71 @@
/*-----------------------------------------*\
| GalaxGPUControllerDetect.cpp |
| |
| Driver for Galax / KFA2 RGB on GPUs |
| |
| Niels Westphal (crashniels) 12.07.2020 |
\*-----------------------------------------*/
#include "Detector.h"
#include "GalaxGPUController.h"
#include "RGBController.h"
#include "RGBController_GalaxGPU.h"
#include "i2c_smbus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std::chrono_literals;
/******************************************************************************************\
* *
* TestForGalaxGPUController *
* *
* Tests the given address to see if a Galax GPU controller exists there. *
* *
\******************************************************************************************/
bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
unsigned char res = bus->i2c_smbus_read_byte_data(address, 0x00);
unsigned char res2 = bus->i2c_smbus_read_byte_data(address, 0x01);
if(res == 0x27 && res2 == 0x10)
{
pass = true;
}
return(pass);
} /* TestForGalaxGPUController() */
/******************************************************************************************\
* *
* DetectGalaxGPUControllers *
* *
* Detect Galax GPU controllers on the enumerated I2C busses. *
* *
\******************************************************************************************/
void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
{
GalaxGPUController* new_GalaxGPU;
RGBController_GalaxGPU* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Check for GALAX controller at 0x23
if (TestForGalaxGPUController(busses[bus], 0x23))
{
new_GalaxGPU = new GalaxGPUController(busses[bus], 0x23);
new_controller = new RGBController_GalaxGPU(new_GalaxGPU);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectGalaxGPUControllers() */
REGISTER_I2C_DETECTOR("Galax GPU", DetectGalaxGPUControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "GloriousModelOController.h"
#include "RGBController.h"
#include "RGBController_GloriousModelO.h"
@@ -21,9 +22,6 @@ void DetectGloriousModelOControllers(std::vector<RGBController*>& rgb_controller
hid_device* dev = NULL;
hid_init();
dev = NULL;
info = hid_enumerate(Glorious_Model_O_VID, Glorious_Model_O_PID);
//Look for Glorious Model O
@@ -57,4 +55,6 @@ void DetectGloriousModelOControllers(std::vector<RGBController*>& rgb_controller
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectGloriousModelOControllers() */
REGISTER_DETECTOR("Glorious Model O", DetectGloriousModelOControllers);
@@ -0,0 +1,87 @@
/*-----------------------------------------------*\
| HoltekA070Controller.cpp |
| |
| Driver for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*-----------------------------------------------*/
#include "HoltekA070Controller.h"
#include <cstring>
HoltekA070Controller::HoltekA070Controller(hid_device* dev_handle)
{
dev = dev_handle;
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void HoltekA070Controller::SendCustomColor
(
unsigned char red,
unsigned char green,
unsigned char blue
)
{
char usb_buf[8];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up RGB Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x07; // PACKET SIZE?
usb_buf[0x01] = 0x0a; // SET RGB
usb_buf[0x02] = 0x00; // SAVE (does not work with SET RGB)
usb_buf[0x03] = red; // RED
usb_buf[0x04] = green; // GREEN
usb_buf[0x05] = blue; // BLUE
usb_buf[0x06] = 0x00; // PADDING?
usb_buf[0x07] = 0x00; // PADDING?
// So far no saving function has been discovered for the "SET RGB" command.
// Such functionality might not even exist for the A070 series.
// The chosen RGB color will therefore reset after a power cycle.
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, (unsigned char *)usb_buf, sizeof(usb_buf));
}
void HoltekA070Controller::SendMode
(
unsigned char mode
)
{
char usb_buf[8];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up lighting mode control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x07; // PACKET SIZE?
usb_buf[0x01] = 0x0b; // SET LIGHTING MODE
usb_buf[0x02] = 0x01; // SAVE
usb_buf[0x03] = mode; // MODE 01-04
usb_buf[0x04] = 0x00; // PADDING?
usb_buf[0x05] = 0x00; // PADDING?
usb_buf[0x06] = 0x00; // PADDING?
usb_buf[0x07] = 0x00; // PADDING?
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, (unsigned char *)usb_buf, sizeof(usb_buf));
}
@@ -0,0 +1,44 @@
/*---------------------------------------------------------------*\
| HoltekA070Controller.h |
| |
| Definitions and types for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*---------------------------------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
HOLTEK_A070_MODE_STATIC = 0x01,
HOLTEK_A070_MODE_BREATHING_SLOW = 0x02,
HOLTEK_A070_MODE_BREATHING_MEDIUM = 0x03,
HOLTEK_A070_MODE_BREATHING_FAST = 0x04
};
class HoltekA070Controller
{
public:
HoltekA070Controller(hid_device* dev_handle);
~HoltekA070Controller();
void SendCustomColor
(
unsigned char red,
unsigned char green,
unsigned char blue
);
void SendMode
(
unsigned char mode
);
private:
hid_device* dev;
};
@@ -0,0 +1,89 @@
#include "Detector.h"
#include "HoltekA070Controller.h"
#include "RGBController.h"
#include "RGBController_HoltekA070.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Holtek Semiconductor Inc. vendor ID |
\*-----------------------------------------------------*/
#define HOLTEK_VID 0x04D9
/*-----------------------------------------------------*\
| Mouse product IDs |
\*-----------------------------------------------------*/
#define HOLTEK_A070_PID 0xA070
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned char usb_interface;
device_type type;
const char * name;
} holtek_device;
#define HOLTEK_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const holtek_device device_list[] =
{
/*-------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------*/
{ HOLTEK_VID, HOLTEK_A070_PID, 1, DEVICE_TYPE_MOUSE, "Holtek USB Gaming Mouse" },
};
void DetectHoltekControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_init();
for(unsigned int device_idx = 0; device_idx < HOLTEK_NUM_DEVICES; device_idx++)
{
switch(device_list[device_idx].type)
{
case DEVICE_TYPE_MOUSE:
{
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
while(info)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid)
#ifdef USE_HID_USAGE
&&(info->interface_number == device_list[device_idx].usb_interface)
&&(info->usage_page == 0xFF00)
&&(info->usage == 2))
#else
&&(info->interface_number == device_list[device_idx].usb_interface))
#endif
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
switch(device_list[device_idx].usb_pid)
{
case HOLTEK_A070_PID:
{
HoltekA070Controller* controller = new HoltekA070Controller(dev);
RGBController_HoltekA070* rgb_controller = new RGBController_HoltekA070(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
}
}
}
info = info->next;
}
hid_free_enumeration(info);
}
break;
}
}
} /* DetectHoltekControllers() */
REGISTER_DETECTOR("Holtek", DetectHoltekControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "HuePlusController.h"
#include "RGBController.h"
#include "RGBController_HuePlus.h"
@@ -17,16 +18,23 @@
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
{
size_t i;
HuePlusController* new_hueplus;
RGBController_HuePlus* new_controller;
std::string portname = find_usb_serial_port(NZXT_HUE_PLUS_VID, NZXT_HUE_PLUS_PID);
if( portname != "" )
{
new_hueplus = new HuePlusController();
new_hueplus->Initialize((char *)portname.c_str());
std::vector<std::string *> ports = find_usb_serial_port(NZXT_HUE_PLUS_VID, NZXT_HUE_PLUS_PID);
new_controller = new RGBController_HuePlus(new_hueplus);
rgb_controllers.push_back(new_controller);
for (i = 0; i < ports.size(); i++)
{
if( *ports[i] != "" )
{
new_hueplus = new HuePlusController();
new_hueplus->Initialize((char *)ports[i]->c_str());
new_controller = new RGBController_HuePlus(new_hueplus);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectHuePlusControllers() */
REGISTER_DETECTOR("NZXT Hue+", DetectHuePlusControllers);
@@ -188,8 +188,8 @@ enum
static const unsigned char slot_base[4] =
{
HYPERX_REG_SLOT0_LED0_RED, /* SPD 0x50 maps to slot 0 */
HYPERX_REG_SLOT1_LED0_RED, /* SPD 0x51 maps to slot 1 */
HYPERX_REG_SLOT2_LED0_RED, /* SPD 0x52 maps to slot 2 */
HYPERX_REG_SLOT2_LED0_RED, /* SPD 0x51 maps to slot 2 */
HYPERX_REG_SLOT1_LED0_RED, /* SPD 0x52 maps to slot 1 */
HYPERX_REG_SLOT3_LED0_RED /* SPD 0x53 maps to slot 3 */
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "HyperXDRAMController.h"
#include "RGBController.h"
#include "RGBController_HyperXDRAM.h"
@@ -93,3 +94,5 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses, std:
}
} /* DetectHyperXDRAMControllers() */
REGISTER_I2C_DETECTOR("HyperX DRAM", DetectHyperXDRAMControllers);
@@ -116,7 +116,7 @@ void HyperXAlloyOriginsController::SendDirectColorPacket
/*-----------------------------------------------------*\
| Copy in color data |
\*-----------------------------------------------------*/
for(int color_idx = 0; color_idx < color_count; color_idx++)
for(unsigned int color_idx = 0; color_idx < color_count; color_idx++)
{
buf[(color_idx * 4) + 1] = 0x81;
buf[(color_idx * 4) + 2] = RGBGetRValue(color_data[color_idx]);
@@ -128,4 +128,4 @@ void HyperXAlloyOriginsController::SendDirectColorPacket
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 65);
}
}
@@ -401,7 +401,7 @@ void HyperXKeyboardController::SendExtendedColor
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0x08; i <= 0x93; i++)
for(int i = 0x08; i < 0x94; i++)
{
buf[i] = color_data[i];
}
@@ -470,7 +470,7 @@ void HyperXKeyboardController::SendDirectExtended
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0x08; i <= 0x93; i++)
for(int i = 0x08; i < 0x94; i++)
{
buf[i] = color_data[i];
}
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "HyperXAlloyOriginsController.h"
#include "HyperXKeyboardController.h"
#include "RGBController.h"
@@ -9,10 +10,11 @@
/*-----------------------------------------------------*\
| HyperX keyboard vendor IDs |
\*-----------------------------------------------------*/
#define HYPERX_KEYBOARD_VID 0x0951
#define HYPERX_ALLOY_ELITE_PID 0x16BE
#define HYPERX_ALLOY_FPS_RGB_PID 0x16DC
#define HYPERX_ALLOY_ORIGINS_PID 0x16E5
#define HYPERX_KEYBOARD_VID 0x0951
#define HYPERX_ALLOY_ELITE_PID 0x16BE
#define HYPERX_ALLOY_FPS_RGB_PID 0x16DC
#define HYPERX_ALLOY_ORIGINS_PID 0x16E5
#define HYPERX_ALLOY_ORIGINS_CORE_PID 0x16E6
typedef struct
{
@@ -29,9 +31,10 @@ static const hyperx_device device_list[] =
/*-----------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-----------------------------------------------------------------------------------------------------*/
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID, 2, "HyperX Alloy Elite RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_FPS_RGB_PID, 2, "HyperX Alloy FPS RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 3, "HyperX Alloy Origins" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID, 2, "HyperX Alloy Elite RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_FPS_RGB_PID, 2, "HyperX Alloy FPS RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 3, "HyperX Alloy Origins" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_CORE_PID, 3, "HyperX Alloy Origins Core" },
};
/******************************************************************************************\
@@ -104,4 +107,6 @@ void DetectHyperXKeyboardControllers(std::vector<RGBController*>& rgb_controller
info = info->next;
}
}
}
} /* DetectHyperXKeyboardControllers() */
REGISTER_DETECTOR("HyperX Keyboard", DetectHyperXKeyboardControllers);
@@ -0,0 +1,84 @@
#include "Detector.h"
#include "HyperXPulsefireSurgeController.h"
#include "RGBController.h"
#include "RGBController_HyperXPulsefireSurge.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| HyperX keyboard vendor IDs |
\*-----------------------------------------------------*/
#define HYPERX_VID 0x0951
#define HYPERX_PULSEFIRE_SURGE_PID 0x16D3
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned char usb_interface;
const char * name;
} hyperx_device;
#define HYPERX_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const hyperx_device device_list[] =
{
/*-----------------------------------------------------------------------------------------------------*\
| Mice |
\*-----------------------------------------------------------------------------------------------------*/
{ HYPERX_VID, HYPERX_PULSEFIRE_SURGE_PID, 1, "HyperX Pulsefire Surge" },
};
/******************************************************************************************\
* *
* DetectHyperXMouseControllers *
* *
* Tests the USB address to see if a HyperX Mouse controller exists there. *
* *
\******************************************************************************************/
void DetectHyperXMouseControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device* dev = NULL;
hid_init();
for(std::size_t device_idx = 0; device_idx < HYPERX_NUM_DEVICES; device_idx++)
{
dev = NULL;
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
//Look for HyperX RGB Peripheral
while(info)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid)
#ifdef USE_HID_USAGE
&&(info->interface_number == device_list[device_idx].usb_interface)
&&(info->usage_page == 0xFF01))
#else
&&(info->interface_number == device_list[device_idx].usb_interface))
#endif
{
dev = hid_open_path(info->path);
if( dev )
{
HyperXPulsefireSurgeController* controller = new HyperXPulsefireSurgeController(dev);
RGBController_HyperXPulsefireSurge* rgb_controller = new RGBController_HyperXPulsefireSurge(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
}
}
} /* DetectHyperXMouseControllers() */
REGISTER_DETECTOR("HyperX Mouse", DetectHyperXMouseControllers);
@@ -0,0 +1,125 @@
/*-----------------------------------------*\
| HyperXPulsefireSurgeController.cpp |
| |
| Driver for HyperX Pulsefire Surge |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 7/25/2020 |
\*-----------------------------------------*/
#include "HyperXPulsefireSurgeController.h"
#include <cstring>
HyperXPulsefireSurgeController::HyperXPulsefireSurgeController(hid_device* dev_handle)
{
dev = dev_handle;
}
HyperXPulsefireSurgeController::~HyperXPulsefireSurgeController()
{
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void HyperXPulsefireSurgeController::SelectProfile
(
unsigned char profile
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_SELECT_PROFILE;
buf[0x02] = profile;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXPulsefireSurgeController::SetProfileBrightness
(
unsigned char profile,
unsigned char brightness
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_BRIGHTNESS;
buf[0x02] = profile;
buf[0x03] = 0x01;
buf[0x04] = 0x01;
buf[0x05] = 0x01;
buf[0x06] = brightness;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXPulsefireSurgeController::SendDirect
(
RGBColor* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_DIRECT;
buf[0x03] = 0xA0;
for(int red_idx = 0; red_idx < 32; red_idx++)
{
buf[0x08 + red_idx] = RGBGetRValue(color_data[red_idx]);
}
for(int grn_idx = 0; grn_idx < 32; grn_idx++)
{
buf[0x28 + grn_idx] = RGBGetGValue(color_data[grn_idx]);
}
for(int blu_idx = 0; blu_idx < 32; blu_idx++)
{
buf[0x48 + blu_idx] = RGBGetBValue(color_data[blu_idx]);
}
buf[0x6C] = RGBGetRValue(color_data[32]);
buf[0x6D] = RGBGetGValue(color_data[32]);
buf[0x6E] = RGBGetBValue(color_data[32]);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
@@ -0,0 +1,58 @@
/*-----------------------------------------*\
| HyperXPulsefireSurgeController.h |
| |
| Definitions and types for HyperX |
| Pulsefire Surge lighting controller |
| |
| Adam Honse (CalcProgrammer1) 7/25/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_CONFIGURATION = 0x01, /* Set profile configuration packet */
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_BRIGHTNESS = 0x03, /* Set profile settings and brightness */
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SELECT_PROFILE = 0x07, /* Select profile */
HYPERX_PULSEFIRE_SURGE_PACKET_ID_DIRECT = 0x14, /* Direct control packet */
};
enum
{
HYPERX_PULSEFIRE_SURGE_MODE_SOLID = 0x00, /* Solid color mode */
HYPERX_PULSEFIRE_SURGE_MODE_CYCLE = 0x01, /* Spectrum cycle mode */
HYPERX_PULSEFIRE_SURGE_MODE_BREATHING = 0x02, /* Breathing mode */
HYPERX_PULSEFIRE_SURGE_MODE_WAVE = 0x03, /* Wave mode */
HYPERX_PULSEFIRE_SURGE_MODE_TRIGGER = 0x04, /* Trigger mode */
};
class HyperXPulsefireSurgeController
{
public:
HyperXPulsefireSurgeController(hid_device* dev_handle);
~HyperXPulsefireSurgeController();
void SelectProfile
(
unsigned char profile
);
void SetProfileBrightness
(
unsigned char profile,
unsigned char brightness
);
void SendDirect
(
RGBColor* color_data
);
private:
hid_device* dev;
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "LEDStripController.h"
#include "RGBController.h"
#include "RGBController_LEDStrip.h"
@@ -21,7 +22,7 @@
* DetectLEDStripControllers *
* *
* Detect devices supported by the LEDStrip driver *
* * *
* *
\******************************************************************************************/
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
@@ -29,24 +30,11 @@ void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
LEDStripController* new_ledstrip;
RGBController_LEDStrip* new_controller;
//Get file path in executable directory
std::ifstream infile;
char filename[2048];
char arg1[64];
#ifdef WIN32
GetModuleFileName(NULL, filename, 2048);
strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
strcat(filename, "\\ledstrip.txt");
#else
snprintf(arg1, 64, "/proc/%d/exe", getpid());
readlink(arg1, filename, 1024);
strcpy(filename, std::string(filename).substr(0, std::string(filename).find_last_of("\\/")).c_str());
strcat(filename, "/ledstrip.txt");
#endif
//Open settings file
infile.open(filename);
infile.open("ledstrip.txt");
if (infile.good())
{
@@ -84,5 +72,6 @@ void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
}
}
} /* DetectLEDStripControllers() */
} /* DetectLEDStripControllers() */
REGISTER_DETECTOR("LED Strip", DetectLEDStripControllers);
@@ -1,29 +1,45 @@
#include "Detector.h"
#include "LogitechG203Controller.h"
#include "LogitechG203LController.h"
#include "LogitechG403Controller.h"
#include "LogitechG502PSController.h"
#include "LogitechG810Controller.h"
#include "LogitechGProWirelessController.h"
#include "LogitechGPowerPlayController.h"
#include "RGBController.h"
#include "RGBController_LogitechG203.h"
#include "RGBController_LogitechG203L.h"
#include "RGBController_LogitechG403.h"
#include "RGBController_LogitechG502PS.h"
#include "RGBController_LogitechG810.h"
#include "RGBController_LogitechGProWireless.h"
#include "RGBController_LogitechGPowerPlay.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Logitech vendor ID |
\*-----------------------------------------------------*/
#define LOGITECH_VID 0x046D
#define LOGITECH_VID 0x046D
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G810_1_PID 0xC337
#define LOGITECH_G810_2_PID 0xC331
#define LOGITECH_G512_PID 0xC342
#define LOGITECH_G810_1_PID 0xC337
#define LOGITECH_G810_2_PID 0xC331
#define LOGITECH_G512_PID 0xC342
#define LOGITECH_G512_RGB_PID 0xC33C
/*-----------------------------------------------------*\
| Mouse product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G203_PID 0xC084
#define LOGITECH_G403_PID 0xC083
#define LOGITECH_G403H_PID 0xC08F
#define LOGITECH_G203_PID 0xC084
#define LOGITECH_G203L_PID 0xC092
#define LOGITECH_G403_PID 0xC083
#define LOGITECH_G403H_PID 0xC08F
#define LOGITECH_G502_PS_PID 0xC332
#define LOGITECH_G502H_PID 0xC08B
#define LOGITECH_G_LIGHTSPEED_WIRELESS_PID 0xC539
#define LOGITECH_GPRO_WIRELESS_PID 0xC088
#define LOGITECH_G_LIGHTSPEED_POWERPLAY_PID 0xC53A
typedef struct
{
@@ -38,21 +54,28 @@ typedef struct
static const logitech_device device_list[] =
{
/*-------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G810_1_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G810_2_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G512_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G512" },
/*-------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G203_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G203 Prodigy" },
{ LOGITECH_VID, LOGITECH_G403_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Prodigy" },
{ LOGITECH_VID, LOGITECH_G403H_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Hero" },
/*-------------------------------------------------------------------------------------------------------------*\
| Mousemats |
\*-------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G810_1_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G810_2_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G512_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G512" },
{ LOGITECH_VID, LOGITECH_G512_RGB_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G512 RGB" },
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G203_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G203 Prodigy" },
{ LOGITECH_VID, LOGITECH_G203L_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G203 Lightsync" },
{ LOGITECH_VID, LOGITECH_G403_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Prodigy" },
{ LOGITECH_VID, LOGITECH_G403H_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Hero" },
{ LOGITECH_VID, LOGITECH_G502_PS_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G502 Proteus Spectrum" },
{ LOGITECH_VID, LOGITECH_G502H_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G502 Hero" },
{ LOGITECH_VID, LOGITECH_G_LIGHTSPEED_WIRELESS_PID, 2, DEVICE_TYPE_MOUSE, "Logitech G Lightspeed Wireless Gaming Mouse" },
{ LOGITECH_VID, LOGITECH_GPRO_WIRELESS_PID, 2, DEVICE_TYPE_MOUSE, "Logitech G Pro Wireless Gaming Mouse (Wired)" },
{ LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, DEVICE_TYPE_MOUSE, "Logitech G Powerplay Mousepad with Lightspeed" },
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mousemats |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
};
/******************************************************************************************\
@@ -67,7 +90,7 @@ void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_init();
for(int device_idx = 0; device_idx < LOGITECH_NUM_DEVICES; device_idx++)
for(unsigned int device_idx = 0; device_idx < LOGITECH_NUM_DEVICES; device_idx++)
{
switch(device_list[device_idx].type)
{
@@ -172,6 +195,17 @@ void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
}
break;
case LOGITECH_G203L_PID:
{
LogitechG203LController* controller = new LogitechG203LController(dev);
RGBController_LogitechG203L* rgb_controller = new RGBController_LogitechG203L(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
case LOGITECH_G403_PID:
case LOGITECH_G403H_PID:
{
@@ -182,6 +216,50 @@ void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
case LOGITECH_G502_PS_PID:
case LOGITECH_G502H_PID:
{
LogitechG502PSController* controller = new LogitechG502PSController(dev);
RGBController_LogitechG502PS* rgb_controller = new RGBController_LogitechG502PS(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
case LOGITECH_GPRO_WIRELESS_PID:
case LOGITECH_G_LIGHTSPEED_WIRELESS_PID:
{
LogitechGProWirelessController* controller = new LogitechGProWirelessController(dev);
RGBController_LogitechGProWireless* rgb_controller = new RGBController_LogitechGProWireless(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
case LOGITECH_G_LIGHTSPEED_POWERPLAY_PID:
{
//Add mouse
LogitechGProWirelessController* mouse_controller = new LogitechGProWirelessController(dev);
RGBController_LogitechGProWireless* mouse_rgb_controller = new RGBController_LogitechGProWireless(mouse_controller);
mouse_rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(mouse_rgb_controller);
//Add Powerplay mousemat
LogitechGPowerPlayController* mousemat_controller = new LogitechGPowerPlayController(dev);
RGBController_LogitechGPowerPlay* mousemat_rgb_controller = new RGBController_LogitechGPowerPlay(mousemat_controller);
mousemat_rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(mousemat_rgb_controller);
}
break;
}
}
}
@@ -193,4 +271,6 @@ void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
} /* DetectLogitechControllers() */
REGISTER_DETECTOR("Logitech", DetectLogitechControllers);
@@ -51,7 +51,7 @@ void LogitechG203Controller::SendMouseMode
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 1000 + 4750 * (LOGITECH_G203_SPEED_FASTEST - speed);
speed = 100 * speed;
if(mode == LOGITECH_G203_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
@@ -22,13 +22,15 @@ enum
LOGITECH_G203_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are mutipled by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G203_SPEED_SLOWEST = 0x00, /* Slowest speed */
LOGITECH_G203_SPEED_SLOW = 0x01, /* Slow speed */
LOGITECH_G203_SPEED_NORMAL = 0x02, /* Normal speed */
LOGITECH_G203_SPEED_FAST = 0x03, /* Fast speed */
LOGITECH_G203_SPEED_FASTEST = 0x04, /* Fastest speed */
LOGITECH_G203_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G203_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G203_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG203Controller
@@ -0,0 +1,140 @@
#include "LogitechG203LController.h"
#include <cstring>
LogitechG203LController::LogitechG203LController(hid_device* dev_handle)
{
dev = dev_handle;
}
void LogitechG203LController::SendApply()
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x12;
usb_buf[0x03] = 0x7A;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
void LogitechG203LController::SetSingleLED(int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x12;
usb_buf[0x03] = 0x19;
usb_buf[0x04] = (unsigned char)led;
usb_buf[0x05] = red;
usb_buf[0x06] = green;
usb_buf[0x07] = blue;
usb_buf[0x08] = 0xFF;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
SendApply();
}
void LogitechG203LController::SetMode(
int mode,
int speed,
unsigned char bright,
unsigned char dir,
unsigned char red,
unsigned char green,
unsigned char blue)
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
//Header
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x0E;
usb_buf[0x03] = 0x1A;
//Common Data
usb_buf[0x04] = 0x00;
usb_buf[0x05] = (unsigned char)mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
//mode specific Data and position
if(mode == LOGITECH_G203L_MODE_STATIC) usb_buf[0x09] = 0x02;
if(mode == LOGITECH_G203L_MODE_CYCLE)
{
usb_buf[0x0B] = (unsigned char)((speed>>8) & 0x000000FF);
usb_buf[0x0C] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0D] = bright;
}
if(mode == LOGITECH_G203L_MODE_BREATHING)
{
usb_buf[0x09] = (unsigned char)((speed>>8) & 0x000000FF);
usb_buf[0x0A] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0C] = bright;
}
if(mode == LOGITECH_G203L_MODE_WAVE)
{
usb_buf[0x0C] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0D] = dir ? 0x01 : 0x06; //0x01: Left->Right 0x06: Right->Left
usb_buf[0x0E] = bright;
usb_buf[0x0F] = (unsigned char)((speed>>8) & 0x000000FF);
}
if(mode == LOGITECH_G203L_MODE_COLORMIXING)
{
usb_buf[0x0C] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0D] = (unsigned char)((speed>>8) & 0x000000FF);
usb_buf[0x0E] = bright;
}
//END BYTE
usb_buf[0x10] = 0x01;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
void LogitechG203LController::SetDevice(std::vector<RGBColor> colors)
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x12;
usb_buf[0x03] = 0x1A;
usb_buf[0x04] = 0x01;
usb_buf[0x05] = RGBGetRValue(colors[0]);
usb_buf[0x06] = RGBGetGValue(colors[0]);
usb_buf[0x07] = RGBGetBValue(colors[0]);
usb_buf[0x08] = 0x02;
usb_buf[0x09] = RGBGetRValue(colors[1]);
usb_buf[0x0A] = RGBGetGValue(colors[1]);
usb_buf[0x0B] = RGBGetBValue(colors[1]);
usb_buf[0x0C] = 0x03;
usb_buf[0x0D] = RGBGetRValue(colors[2]);
usb_buf[0x0E] = RGBGetGValue(colors[2]);
usb_buf[0x0F] = RGBGetBValue(colors[2]);
usb_buf[0x10] = 0xFF;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
SendApply();
}
@@ -0,0 +1,32 @@
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G203L_MODE_DIRECT = 0x07,
LOGITECH_G203L_MODE_OFF = 0x00,
LOGITECH_G203L_MODE_STATIC = 0x01,
LOGITECH_G203L_MODE_CYCLE = 0x02,
LOGITECH_G203L_MODE_WAVE = 0x03,
LOGITECH_G203L_MODE_BREATHING = 0x04,
LOGITECH_G203L_MODE_COLORMIXING = 0x06,
};
class LogitechG203LController
{
public:
LogitechG203LController(hid_device* dev_handle);
~LogitechG203LController();
void SetSingleLED(int led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(int mode, int speed, unsigned char brightness, unsigned char dir, unsigned char red, unsigned char green, unsigned char blue);
void SetDevice(std::vector<RGBColor> colors);
private:
hid_device* dev;
void SendApply();
};
@@ -53,7 +53,7 @@ void LogitechG403Controller::SendMouseMode
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 1000 + 4750 * (LOGITECH_G403_SPEED_FASTEST - speed);
speed = 100 * speed;
if(mode == LOGITECH_G403_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
@@ -22,13 +22,15 @@ enum
LOGITECH_G403_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are mutipled by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G403_SPEED_SLOWEST = 0x00, /* Slowest speed */
LOGITECH_G403_SPEED_SLOW = 0x01, /* Slow speed */
LOGITECH_G403_SPEED_NORMAL = 0x02, /* Normal speed */
LOGITECH_G403_SPEED_FAST = 0x03, /* Fast speed */
LOGITECH_G403_SPEED_FASTEST = 0x04, /* Fastest speed */
LOGITECH_G403_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G403_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G403_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG403Controller
@@ -0,0 +1,77 @@
/*-----------------------------------------*\
| Logitech502PSController.cpp |
| |
| Driver for Logitech G502 Proteus |
| Spectrum mouse lighting controller |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "LogitechG502PSController.h"
#include <cstring>
LogitechG502PSController::LogitechG502PSController(hid_device* dev_handle)
{
dev = dev_handle;
}
LogitechG502PSController::~LogitechG502PSController()
{
hid_close(dev);
}
void LogitechG502PSController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x02;
usb_buf[0x03] = 0x3A;
usb_buf[0x04] = channel;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G502_PS_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G502_PS_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}else if(mode == LOGITECH_G502_PS_MODE_STATIC){
usb_buf[0x09] = 0x02;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -0,0 +1,55 @@
/*-----------------------------------------*\
| Logitech502PSController.h |
| |
| Definitions and types for Logitech |
| G502 Proteus Spectrum mouse lighting |
| controller |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G502_PS_MODE_OFF = 0x00,
LOGITECH_G502_PS_MODE_STATIC = 0x01,
LOGITECH_G502_PS_MODE_CYCLE = 0x03,
LOGITECH_G502_PS_MODE_BREATHING = 0x02
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are mutipled by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G502_PS_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G502_PS_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G502_PS_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG502PSController
{
public:
LogitechG502PSController(hid_device* dev_handle);
~LogitechG502PSController();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
};
@@ -0,0 +1,82 @@
/*-----------------------------------------*\
| LogitechGPowerPlayController.cpp |
| |
| Driver for Logitech G PowerPlay Wireless |
| Charging System |
| |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "LogitechGPowerPlayController.h"
#include <cstring>
LogitechGPowerPlayController::LogitechGPowerPlayController(hid_device* dev_handle)
{
dev = dev_handle;
}
LogitechGPowerPlayController::~LogitechGPowerPlayController()
{
hid_close(dev);
}
void LogitechGPowerPlayController::SendMouseMatMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0x07;
usb_buf[0x02] = 0x0B;
usb_buf[0x03] = 0x3E;
usb_buf[0x04] = zone;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G_POWERPLAY_MODE_STATIC)
{
usb_buf[0x09] = 0x02;
}
if(mode == LOGITECH_G_POWERPLAY_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
//usb_buf[0x0D] = brightness;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G_POWERPLAY_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
//usb_buf[0x0C] = brightness;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -0,0 +1,55 @@
/*-----------------------------------------*\
| LogitechGPowerPlayController.h |
| |
| Definitions and types for Logitech G |
| PowerPlay Wireless lighting controller |
| |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G_POWERPLAY_MODE_OFF = 0x00,
LOGITECH_G_POWERPLAY_MODE_STATIC = 0x01,
LOGITECH_G_POWERPLAY_MODE_CYCLE = 0x02,
LOGITECH_G_POWERPLAY_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are mutipled by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G_POWERPLAY_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G_POWERPLAY_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G_POWERPLAY_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechGPowerPlayController
{
public:
LogitechGPowerPlayController(hid_device* dev_handle);
~LogitechGPowerPlayController();
void SendMouseMatMode
(
unsigned char mode,
unsigned short speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
);
private:
hid_device* dev;
};
@@ -0,0 +1,82 @@
/*-----------------------------------------*\
| LogitechGProWirelessController.cpp |
| |
| Driver for Logitech G Pro Wireless Gaming|
| Mouse lighting controller |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "LogitechGProWirelessController.h"
#include <cstring>
LogitechGProWirelessController::LogitechGProWirelessController(hid_device* dev_handle)
{
dev = dev_handle;
}
LogitechGProWirelessController::~LogitechGProWirelessController()
{
hid_close(dev);
}
void LogitechGProWirelessController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0x01;
usb_buf[0x02] = 0x07;
usb_buf[0x03] = 0x3C;
usb_buf[0x04] = zone;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_STATIC)
{
usb_buf[0x09] = 0x02;
}
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
//usb_buf[0x0D] = brightness;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G_PRO_WIRELESS_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
//usb_buf[0x0C] = brightness;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -0,0 +1,55 @@
/*-----------------------------------------*\
| LogitechGProWirelessController.h |
| |
| Definitions and types for Logitech G Pro |
| Wireless Gaming Mouse lighting controller|
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G_PRO_WIRELESS_MODE_OFF = 0x00,
LOGITECH_G_PRO_WIRELESS_MODE_STATIC = 0x01,
LOGITECH_G_PRO_WIRELESS_MODE_CYCLE = 0x02,
LOGITECH_G_PRO_WIRELESS_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are mutipled by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechGProWirelessController
{
public:
LogitechGProWirelessController(hid_device* dev_handle);
~LogitechGProWirelessController();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
);
private:
hid_device* dev;
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "MSI3ZoneController.h"
#include "RGBController.h"
#include "RGBController_MSI3Zone.h"
@@ -33,4 +34,6 @@ void DetectMSI3ZoneControllers(std::vector<RGBController*>& rgb_controllers)
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectMSI3ZoneControllers() */
REGISTER_DETECTOR("MSI 3-Zone Laptop", DetectMSI3ZoneControllers);
@@ -12,8 +12,6 @@ MSIGPUController::MSIGPUController(i2c_smbus_interface* bus)
{
this->bus = bus;
this->dev = 0x68;
strcpy(device_name, "MSI RTX GPU");
}
MSIGPUController::~MSIGPUController()
@@ -21,11 +19,6 @@ MSIGPUController::~MSIGPUController()
}
std::string MSIGPUController::GetDeviceName()
{
return(device_name);
}
std::string MSIGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
@@ -60,7 +60,6 @@ public:
MSIGPUController(i2c_smbus_interface* bus);
~MSIGPUController();
std::string GetDeviceName();
std::string GetDeviceLocation();
void SetRGB1(unsigned char red, unsigned char green, unsigned char blue);
@@ -73,7 +72,6 @@ public:
void MSIGPURegisterWrite(unsigned char reg, unsigned char val);
private:
char device_name[16];
i2c_smbus_interface * bus;
msi_gpu_dev_id dev;
};
@@ -5,6 +5,7 @@
| |
\*-----------------------------------------*/
#include "Detector.h"
#include "MSIGPUController.h"
#include "RGBController.h"
#include "RGBController_MSIGPU.h"
@@ -13,61 +14,72 @@
#include <stdio.h>
#include <stdlib.h>
/******************************************************************************************\
* *
* IsMSIGPUController *
* *
* Compare PCI IDs *
* *
\******************************************************************************************/
/*-----------------------------------------------------*\
| NVidia vendor ID |
\*-----------------------------------------------------*/
#define NVIDIA_VEN 0x10DE
bool IsMSIGPUController(i2c_smbus_interface* bus)
/*-----------------------------------------------------*\
| NVidia device IDs |
\*-----------------------------------------------------*/
#define NVIDIA_GTX1070_DEV 0x1B81
#define NVIDIA_RTX2060_DEV 0x1F08
#define NVIDIA_RTX2060S_DEV 0x1F06
#define NVIDIA_RTX2070_DEV 0x1F02
#define NVIDIA_RTX2070S_DEV 0x1E84
#define NVIDIA_RTX2080_DEV 0x1E87
#define NVIDIA_RTX2080S_DEV 0x1E81
#define NVIDIA_RTX2080TI_DEV 0x1E07
/*-----------------------------------------------------*\
| MSI sub-vendor ID |
\*-----------------------------------------------------*/
#define MSI_SUB_VEN 0x1462
/*-----------------------------------------------------*\
| MSI sub-device IDs |
\*-----------------------------------------------------*/
#define MSI_GTX1070_GAMING_X_SUB_DEV 0x3306
#define MSI_RTX2060S_GAMING_X_SUB_DEV 0xC752
#define MSI_RTX2070S_GAMING_X_SUB_DEV 0x373e
#define MSI_RTX2070S_GAMING_X_TRIO_SUB_DEV 0xC726
#define MSI_RTX2080_GAMING_X_TRIO_SUB_DEV 0x3726
#define MSI_RTX2080S_GAMING_X_TRIO_SUB_DEV 0xC724
#define MSI_RTX2080TI_GAMING_X_TRIO_SUB_DEV 0x3715
#define MSI_RTX2060_GAMING_Z_6G_SUB_DEV 0x3754
#define MSI_RTX2060_GAMING_Z_6G_SUB_DEV_2 0x3752
#define MSI_RTX2070_ARMOR_SUB_DEV 0x3734
#define MSI_RTX2060S_ARMOR_OC_SUB_DEV 0xC754
#define MSI_RTX2080_SEA_HAWK_EK_X_SUB_DEV 0x3728
#define MSI_RTX2080TI_SEA_HAWK_EK_X_SUB_DEV 0x3717
typedef struct
{
bool pass = false;
int pci_vendor;
int pci_device;
int pci_subsystem_vendor;
int pci_subsystem_device;
const char * name;
} msi_gpu_pci_device;
if (bus->port_id != 1)
{
return(pass);
}
#define MSI_GPU_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
// MSI RTX 2080S Gaming X Trio
if (bus->pci_device == 0x1e81 &&
bus->pci_vendor == 0x10de &&
bus->pci_subsystem_device == 0xc724 &&
bus->pci_subsystem_vendor == 0x1462)
{
pass = true;
}
// MSI RTX 2070S Gaming X Trio
if (bus->pci_device == 0x1e84 &&
bus->pci_vendor == 0x10de &&
bus->pci_subsystem_device == 0xc726 &&
bus->pci_subsystem_vendor == 0x1462)
{
pass = true;
}
// MSI RTX 2080 Ti Sea Hawk EK X
if (bus->pci_device == 0x1e07 &&
bus->pci_vendor == 0x10de &&
bus->pci_subsystem_device == 0x3717 &&
bus->pci_subsystem_vendor == 0x1462)
{
pass = true;
}
// MSI RTX 2070 ARMOR
if (bus->pci_device == 0x1f02 &&
bus->pci_vendor == 0x10de &&
bus->pci_subsystem_device == 0x3734 &&
bus->pci_subsystem_vendor == 0x1462)
{
pass = true;
}
return(pass);
} /* IsMSIGPUController() */
static const msi_gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, MSI_SUB_VEN, MSI_GTX1070_GAMING_X_SUB_DEV, "MSI GeForce GTX 1070 Gaming X" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, MSI_SUB_VEN, MSI_RTX2060S_GAMING_X_SUB_DEV, "MSI GeForce RTX 2060 Super Gaming X" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, MSI_SUB_VEN, MSI_RTX2080_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080 Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2080S_DEV, MSI_SUB_VEN, MSI_RTX2080S_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080 Super Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, MSI_SUB_VEN, MSI_RTX2080TI_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080Ti Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2060_DEV, MSI_SUB_VEN, MSI_RTX2060_GAMING_Z_6G_SUB_DEV, "MSI GeForce RTX 2060 Gaming Z 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060_DEV, MSI_SUB_VEN, MSI_RTX2060_GAMING_Z_6G_SUB_DEV_2, "MSI GeForce RTX 2060 Gaming Z 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, MSI_SUB_VEN, MSI_RTX2060S_ARMOR_OC_SUB_DEV, "MSI GeForce RTX 2060 Super ARMOR OC" },
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, MSI_SUB_VEN, MSI_RTX2070_ARMOR_SUB_DEV, "MSI GeForce RTX 2070 ARMOR" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, MSI_SUB_VEN, MSI_RTX2080_SEA_HAWK_EK_X_SUB_DEV, "MSI GeForce RTX 2080 Sea Hawk EK X" },
{ NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, MSI_SUB_VEN, MSI_RTX2080TI_SEA_HAWK_EK_X_SUB_DEV, "MSI GeForce RTX 2080Ti Sea Hawk EK X" },
};
/******************************************************************************************\
@@ -85,11 +97,25 @@ void DetectMSIGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vec
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
if (IsMSIGPUController(busses[bus]))
for(unsigned int dev_idx = 0; dev_idx < MSI_GPU_NUM_DEVICES; dev_idx++)
{
new_msi_gpu = new MSIGPUController(busses[bus]);
new_controller = new RGBController_MSIGPU(new_msi_gpu);
rgb_controllers.push_back(new_controller);
if (busses[bus]->port_id != 1)
{
break;
}
if(busses[bus]->pci_vendor == device_list[dev_idx].pci_vendor &&
busses[bus]->pci_device == device_list[dev_idx].pci_device &&
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
{
new_msi_gpu = new MSIGPUController(busses[bus]);
new_controller = new RGBController_MSIGPU(new_msi_gpu);
new_controller->name = device_list[dev_idx].name;
rgb_controllers.push_back(new_controller);
}
}
}
} /* DetectMSIGPUControllers() */
REGISTER_I2C_DETECTOR("MSI GPU", DetectMSIGPUControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "MSIMysticLightController.h"
#include "RGBController_MSIMysticLight.h"
@@ -98,4 +99,8 @@ void DetectMSIMysticLightControllers(std::vector<RGBController*> &rgb_controller
rgb_controllers.push_back(rgb_controller);
}
}
}
} /* DetectMSIMysticLightControllers() */
// The MSI Mystic Light controller is disabled due to bricking risk
// Uncomment this line to enable. Do so at your own risk.
//REGISTER_DETECTOR("MSI Mystic Light", DetectMSIMysticLightControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "MSIRGBController.h"
#include "RGBController.h"
#include "RGBController_MSIRGB.h"
@@ -38,3 +39,5 @@ void DetectMSIRGBControllers(std::vector<RGBController*> &rgb_controllers)
}
}
} /* DetectMSIRGBControllers() */
REGISTER_DETECTOR("MSI-RGB", DetectMSIRGBControllers);
@@ -65,7 +65,7 @@ std::string NZXTHue2Controller::GetFirmwareVersion()
void NZXTHue2Controller::SendFan
(
unsigned char port,
unsigned char mode,
unsigned char /*mode*/,
unsigned char speed
)
{
@@ -120,7 +120,7 @@ void NZXTHue2Controller::UpdateDeviceList()
ret_val = hid_read(dev, usb_buf, sizeof(usb_buf));
} while( (ret_val != 64) || (usb_buf[0] != 0x21) || (usb_buf[1] != 0x03) );
for(int chan = 0; chan < num_rgb_channels; chan++)
for(unsigned int chan = 0; chan < num_rgb_channels; chan++)
{
unsigned int start = 0x0F + (6 * chan);
unsigned int num_leds_on_channel = 0;
@@ -179,7 +179,7 @@ void NZXTHue2Controller::UpdateStatus()
/*-----------------------------------------------------*\
| Extract fan information |
\*-----------------------------------------------------*/
for(int fan_idx = 0; fan_idx < num_fan_channels; fan_idx++)
for(unsigned int fan_idx = 0; fan_idx < num_fan_channels; fan_idx++)
{
unsigned char cmd;
unsigned short rpm;
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "NZXTHue2Controller.h"
#include "RGBController.h"
#include "RGBController_NZXTHue2.h"
@@ -76,3 +77,5 @@ void DetectNZXTHue2Controllers(std::vector<RGBController*> &rgb_controllers)
}
}
} /* DetectNZXTHue2Controllers() */
REGISTER_DETECTOR("NZXT Hue 2", DetectNZXTHue2Controllers);
@@ -1,18 +1,38 @@
#include "Detector.h"
#include "NZXTKrakenController.h"
#include "RGBController.h"
#include "RGBController_NZXTKraken.h"
#include <vector>
#include <hidapi/hidapi.h>
#define NZXT_KRAKEN_VID 0x1E71
#define NZXT_KRAKEN_PID 0x170E
#define NZXT_KRAKEN_VID 0x1E71
#define NZXT_KRAKEN_X2_PID 0x170E
#define NZXT_KRAKEN_M2_PID 0x1715
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
const char * name;
} nzxt_kraken_device;
#define NZXT_KRAKEN_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const nzxt_kraken_device device_list[] =
{
/*-----------------------------------------------------------------------------------------------------*\
| NZXT Hue 2 devices |
\*-----------------------------------------------------------------------------------------------------*/
{ NZXT_KRAKEN_VID, NZXT_KRAKEN_X2_PID, "NZXT Kraken X2" },
{ NZXT_KRAKEN_VID, NZXT_KRAKEN_M2_PID, "NZXT Kraken M2" },
};
/******************************************************************************************\
* *
* DetectNZXTKrakenControllers *
* *
* Detect devices supported by the NZXTKraken driver *
* * *
* *
\******************************************************************************************/
void DetectNZXTKrakenControllers(std::vector<RGBController*> &rgb_controllers)
@@ -22,17 +42,17 @@ void DetectNZXTKrakenControllers(std::vector<RGBController*> &rgb_controllers)
hid_init();
for(std::size_t device_idx = 0; device_idx < 1; device_idx++)
for(std::size_t device_idx = 0; device_idx < NZXT_KRAKEN_NUM_DEVICES; device_idx++)
{
dev = NULL;
info = hid_enumerate(NZXT_KRAKEN_VID, NZXT_KRAKEN_PID);
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
//Look for NZXT Kraken devices
while(info)
{
if((info->vendor_id == NZXT_KRAKEN_VID)
&&(info->product_id == NZXT_KRAKEN_PID))
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid))
{
dev = hid_open_path(info->path);
@@ -42,10 +62,14 @@ void DetectNZXTKrakenControllers(std::vector<RGBController*> &rgb_controllers)
RGBController_NZXTKraken* rgb_controller = new RGBController_NZXTKraken(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
}
}
}
} /* DetectNZXTKrakenControllers() */
REGISTER_DETECTOR("NZXT Kraken", DetectNZXTKrakenControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "PatriotViperController.h"
#include "RGBController.h"
#include "RGBController_PatriotViper.h"
@@ -70,3 +71,5 @@ void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, st
}
} /* DetectPatriotViperControllers() */
REGISTER_I2C_DETECTOR("Patriot Viper", DetectPatriotViperControllers);
@@ -10,14 +10,15 @@
#include "PolychromeController.h"
#include <cstring>
using namespace std::chrono_literals;
PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_dev_id dev)
{
this->bus = bus;
this->dev = dev;
unsigned short fw_version = GetFirmwareVersion();
unsigned short fw_version = ReadFirmwareVersion();
unsigned char major_version = fw_version >> 8;
unsigned char minor_version = fw_version & 0xFF;
/*-----------------------------------------------------*\
| Determine whether the device uses ASR LED or |
@@ -25,23 +26,30 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
| Versions 1.xx and 2.xx use ASR LED, 3.xx uses |
| Polychrome |
\*-----------------------------------------------------*/
if((major_version < 0x03) && (major_version > 0x00))
switch(major_version)
{
snprintf(device_name, 32, "ASRock ASR LED FW %d.%02d", major_version, minor_version);
led_count = 1;
asr_led = true;
case ASROCK_TYPE_ASRLED:
device_name = "ASRock ASR LED";
asrock_type = ASROCK_TYPE_ASRLED;
memset(zone_led_count, 0, sizeof(zone_led_count));
break;
case ASROCK_TYPE_POLYCHROME_V1:
device_name = "ASRock Polychrome V1";
asrock_type = ASROCK_TYPE_POLYCHROME_V1;
ReadLEDConfiguration();
break;
case ASROCK_TYPE_POLYCHROME_V2:
device_name = "ASRock Polychrome V2";
asrock_type = ASROCK_TYPE_POLYCHROME_V2;
ReadLEDConfiguration();
break;
default:
asrock_type = ASROCK_TYPE_UNKNOWN;
break;
}
else if(major_version == 0x03)
{
snprintf(device_name, 32, "ASRock Polychrome FW %d.%02d", major_version, minor_version);
led_count = 1;
asr_led = false;
}
else
{
led_count = 0;
}
}
PolychromeController::~PolychromeController()
@@ -49,18 +57,44 @@ PolychromeController::~PolychromeController()
}
char* PolychromeController::GetDeviceName()
unsigned int PolychromeController::GetASRockType()
{
return(asrock_type);
}
std::string PolychromeController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
}
std::string PolychromeController::GetDeviceName()
{
return(device_name);
}
unsigned short PolychromeController::GetFirmwareVersion()
std::string PolychromeController::GetFirmwareVersion()
{
unsigned short fw_version = ReadFirmwareVersion();
unsigned char major_version = fw_version >> 8;
unsigned char minor_version = fw_version & 0xFF;
return(std::to_string(major_version) + "." + std::to_string(minor_version));
}
unsigned short PolychromeController::ReadFirmwareVersion()
{
// The firmware register holds two bytes, so the first read should return 2
// If not, report invalid firmware revision FFFF
if (bus->i2c_smbus_read_byte_data(dev, POLYCHROME_REG_FIRMWARE_VER) == 0x02)
if (bus->i2c_smbus_read_byte_data(dev, ASROCK_REG_FIRMWARE_VER) == 0x02)
{
std::this_thread::sleep_for(1ms);
unsigned char major = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
unsigned char minor = bus->i2c_smbus_read_byte(dev);
return((major << 8) | minor);
@@ -71,9 +105,31 @@ unsigned short PolychromeController::GetFirmwareVersion()
}
}
unsigned int PolychromeController::GetLEDCount()
void PolychromeController::ReadLEDConfiguration()
{
return(led_count);
/*---------------------------------------------------------------------------------*\
| The LED configuration register holds 6 bytes, so the first read should return 6 |
| If not, set all zone sizes to zero |
\*---------------------------------------------------------------------------------*/
if (bus->i2c_smbus_read_byte_data(dev, POLYCHROME_REG_LED_CONFIG) == 0x06)
{
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_1] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_2] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_3] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_4] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_5] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_ADDRESSABLE] = bus->i2c_smbus_read_byte(dev);
}
else
{
memset(zone_led_count, 0, sizeof(zone_led_count));
}
}
unsigned int PolychromeController::GetMode()
@@ -81,89 +137,203 @@ unsigned int PolychromeController::GetMode()
return(active_mode);
}
bool PolychromeController::IsAsrLed()
void PolychromeController::SetColorsAndSpeed(unsigned char led, unsigned char red, unsigned char green, unsigned char blue)
{
return(asr_led);
}
void PolychromeController::SetColorsAndSpeed(unsigned char red, unsigned char green, unsigned char blue, unsigned char speed)
{
unsigned char color_speed_pkt[4] = { red, green, blue, speed };
if (asr_led)
unsigned char color_speed_pkt[4] = { red, green, blue, active_speed };
unsigned char select_led_pkt[1] = { led };
switch(asrock_type)
{
switch(active_mode)
{
case ASROCK_TYPE_ASRLED:
/*-----------------------------------------------------*\
| These modes take 4 bytes in R/G/B/S order |
| Select LED |
\*-----------------------------------------------------*/
case ASRLED_MODE_BREATHING:
case ASRLED_MODE_FLASHING:
case ASRLED_MODE_SPECTRUM_CYCLE:
bus->i2c_smbus_write_block_data(dev, active_mode, 4, color_speed_pkt);
break;
if(active_mode != ASRLED_MODE_OFF)
{
bus->i2c_smbus_write_block_data(dev, ASROCK_REG_LED_SELECT, 1, select_led_pkt);
std::this_thread::sleep_for(1ms);
}
switch(active_mode)
{
/*-----------------------------------------------------*\
| These modes take 4 bytes in R/G/B/S order |
\*-----------------------------------------------------*/
case ASRLED_MODE_BREATHING:
case ASRLED_MODE_STROBE:
case ASRLED_MODE_SPECTRUM_CYCLE:
bus->i2c_smbus_write_block_data(dev, active_mode, 4, color_speed_pkt);
break;
/*-----------------------------------------------------*\
| These modes take 3 bytes in R/G/B order |
\*-----------------------------------------------------*/
default:
case ASRLED_MODE_STATIC:
case ASRLED_MODE_MUSIC:
bus->i2c_smbus_write_block_data(dev, active_mode, 3, color_speed_pkt);
break;
/*-----------------------------------------------------*\
| These modes take 1 byte - speed |
\*-----------------------------------------------------*/
case ASRLED_MODE_RANDOM:
case ASRLED_MODE_WAVE:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &active_speed);
break;
/*-----------------------------------------------------*\
| These modes take no bytes |
\*-----------------------------------------------------*/
case ASRLED_MODE_OFF:
break;
}
std::this_thread::sleep_for(1ms);
break;
case ASROCK_TYPE_POLYCHROME_V1:
/*-----------------------------------------------------*\
| These modes take 3 bytes in R/G/B order |
| Select LED |
\*-----------------------------------------------------*/
default:
case ASRLED_MODE_STATIC:
case ASRLED_MODE_MUSIC:
bus->i2c_smbus_write_block_data(dev, active_mode, 3, color_speed_pkt);
break;
if(active_mode != ASRLED_MODE_OFF)
{
bus->i2c_smbus_write_block_data(dev, ASROCK_REG_LED_SELECT, 1, select_led_pkt);
std::this_thread::sleep_for(1ms);
}
switch(active_mode)
{
/*-----------------------------------------------------*\
| These modes take 4 bytes in R/G/B/S order |
\*-----------------------------------------------------*/
case POLYCHROME_V1_MODE_BREATHING:
case POLYCHROME_V1_MODE_STROBE:
case POLYCHROME_V1_MODE_SPECTRUM_CYCLE:
case POLYCHROME_V1_MODE_SPRING:
case POLYCHROME_V1_MODE_METEOR:
case POLYCHROME_V1_MODE_STACK:
case POLYCHROME_V1_MODE_CRAM:
case POLYCHROME_V1_MODE_SCAN:
case POLYCHROME_V1_MODE_NEON:
case POLYCHROME_V1_MODE_WATER:
bus->i2c_smbus_write_block_data(dev, active_mode, 4, color_speed_pkt);
break;
/*-----------------------------------------------------*\
| These modes take 3 bytes in R/G/B order |
\*-----------------------------------------------------*/
default:
case POLYCHROME_V1_MODE_STATIC:
case POLYCHROME_V1_MODE_MUSIC:
bus->i2c_smbus_write_block_data(dev, active_mode, 3, color_speed_pkt);
break;
/*-----------------------------------------------------*\
| These modes take 1 byte - speed |
\*-----------------------------------------------------*/
case POLYCHROME_V1_MODE_RANDOM:
case POLYCHROME_V1_MODE_WAVE:
case POLYCHROME_V1_MODE_RAINBOW:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &active_speed);
break;
/*-----------------------------------------------------*\
| These modes take no bytes |
\*-----------------------------------------------------*/
case POLYCHROME_V1_MODE_OFF:
break;
}
std::this_thread::sleep_for(1ms);
break;
case ASROCK_TYPE_POLYCHROME_V2:
/*-----------------------------------------------------*\
| These modes take 1 byte - speed |
| Select LED |
\*-----------------------------------------------------*/
case ASRLED_MODE_RANDOM:
case ASRLED_MODE_WAVE:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &speed);
break;
switch(active_mode)
{
case POLYCHROME_V2_MODE_OFF:
case POLYCHROME_V2_MODE_RAINBOW:
case POLYCHROME_V2_MODE_SPECTRUM_CYCLE:
break;
/*-----------------------------------------------------*\
| These modes take no bytes |
\*-----------------------------------------------------*/
case ASRLED_MODE_OFF:
break;
}
}
else
{
/*-----------------------------------------------------*\
| Polychrome firmware always writes color to fixed reg |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_COLOR, 3, color_speed_pkt);
switch(active_mode)
{
/*-----------------------------------------------------*\
| These modes don't take a speed |
\*-----------------------------------------------------*/
POLYCHROME_MODE_OFF:
POLYCHROME_MODE_STATIC:
break;
/*-----------------------------------------------------*\
| All other modes, write speed to active mode register |
\*-----------------------------------------------------*/
default:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &speed);
break;
}
default:
bus->i2c_smbus_write_block_data(dev, ASROCK_REG_LED_SELECT, 1, select_led_pkt);
std::this_thread::sleep_for(1ms);
/*-----------------------------------------------------*\
| Polychrome firmware always writes color to fixed reg |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, POLYCHROME_V2_REG_COLOR, 3, color_speed_pkt);
std::this_thread::sleep_for(1ms);
break;
}
break;
}
}
void PolychromeController::SetMode(unsigned char mode)
void PolychromeController::SetMode(unsigned char zone,unsigned char mode, unsigned char speed)
{
active_mode = mode;
unsigned char led_count_pkt[1] = { 0x00 };
active_zone = zone;
active_mode = mode;
active_speed = speed;
if (asr_led)
switch(asrock_type)
{
bus->i2c_smbus_write_block_data(dev, ASRLED_REG_MODE, 1, &active_mode);
}
else
{
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_MODE, 1, &active_mode);
case ASROCK_TYPE_ASRLED:
bus->i2c_smbus_write_block_data(dev, ASROCK_REG_MODE, 1, &active_mode);
std::this_thread::sleep_for(1ms);
break;
case ASROCK_TYPE_POLYCHROME_V1:
/*-----------------------------------------------------*\
| Make sure set all register is set to 0 |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, POLYCHROME_V1_REG_SET_ALL, 1, led_count_pkt);
std::this_thread::sleep_for(1ms);
/*-----------------------------------------------------*\
| Set the zone we are working on |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, ASROCK_REG_LED_SELECT, 1, &active_zone);
std::this_thread::sleep_for(1ms);
/*-----------------------------------------------------*\
| Write the mode |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, ASROCK_REG_MODE, 1, &active_mode);
std::this_thread::sleep_for(1ms);
break;
case ASROCK_TYPE_POLYCHROME_V2:
bus->i2c_smbus_write_block_data(dev, ASROCK_REG_MODE, 1, &active_mode);
std::this_thread::sleep_for(1ms);
/*-----------------------------------------------------*\
| Select a single LED |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, POLYCHROME_V2_REG_LED_COUNT, 0, led_count_pkt);
std::this_thread::sleep_for(1ms);
switch(active_mode)
{
/*-----------------------------------------------------*\
| These modes don't take a speed |
\*-----------------------------------------------------*/
case POLYCHROME_V2_MODE_OFF:
case POLYCHROME_V2_MODE_STATIC:
break;
/*-----------------------------------------------------*\
| All other modes, write speed to active mode register |
\*-----------------------------------------------------*/
default:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &speed);
std::this_thread::sleep_for(1ms);
break;
}
break;
}
}
}
@@ -9,6 +9,7 @@
\*-----------------------------------------*/
#include "i2c_smbus.h"
#include <string>
#pragma once
@@ -16,63 +17,178 @@ typedef unsigned char polychrome_dev_id;
enum
{
ASRLED_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
ASRLED_REG_MODE = 0x30, /* Mode selection register */
};
#define ASRLED_NUM_MODES 8 /* Number of ASR LED modes */
enum
{
ASRLED_MODE_OFF = 0x10, /* OFF mode */
ASRLED_MODE_STATIC = 0x11, /* Static color mode */
ASRLED_MODE_BREATHING = 0x12, /* Breathing effect mode */
ASRLED_MODE_FLASHING = 0x13, /* Flashing effect mode */
ASRLED_MODE_SPECTRUM_CYCLE = 0x14, /* Spectrum Cycle effect mode */
ASRLED_MODE_RANDOM = 0x15, /* Random effect mode */
ASRLED_MODE_MUSIC = 0x17, /* Music effect mode */
ASRLED_MODE_WAVE = 0x18, /* Wave effect mode */
ASROCK_TYPE_UNKNOWN = 0x00, /* Unknown Type or Not ASRock Device */
ASROCK_TYPE_ASRLED = 0x01, /* ASRock Firmware 1.x - ASR LED */
ASROCK_TYPE_POLYCHROME_V1 = 0x02, /* ASRock Firmware 2.x - Polychrome V1 */
ASROCK_TYPE_POLYCHROME_V2 = 0x03, /* ASRock Firmware 3.x - Polychrome V2 */
};
enum
{
ASRLED_SPEED_MIN = 0x05, /* Slowest speed */
ASRLED_SPEED_DEFAULT = 0x03, /* Default speed */
ASRLED_SPEED_MAX = 0x00, /* Fastest speed */
/*------------------------------------------------------------------------------------------*\
| ASRock Common Registers |
\*------------------------------------------------------------------------------------------*/
ASROCK_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
ASROCK_REG_MODE = 0x30, /* Mode selection register */
ASROCK_REG_LED_SELECT = 0x31, /* LED selection register */
/*------------------------------------------------------------------------------------------*\
| ASRock Polychrome V1/V2 Common Registers |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_REG_LED_CONFIG = 0x33, /* LED configuration register */
/*------------------------------------------------------------------------------------------*\
| ASRock Polychrome V1 (Firmware 2.x) Registers |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_REG_SET_ALL = 0x32, /* Set All register 0x1 = set all */
POLYCHROME_V1_REG_ARGB_GRB = 0x35, /* ARGB bistream reversing register */
/*------------------------------------------------------------------------------------------*\
| ASRock Polychrome V2 (Firmware 3.x) Registers |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V2_REG_LED_COUNT = 0x32, /* Additional LED count register */
POLYCHROME_V2_REG_COLOR = 0x34, /* Color register: Red, Green, Blue */
POLYCHROME_V2_REG_ARGB_GRB = 0x35, /* ARGB bistream reversing register */
};
enum
{
POLYCHROME_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
POLYCHROME_REG_MODE = 0x30, /* Mode selection register */
POLYCHROME_REG_COLOR = 0x34, /* Color register: Red, Green, Blue */
POLYCHROME_ZONE_1 = 0x00, /* RGB LED 1 Header */
POLYCHROME_ZONE_2 = 0x01, /* RGB LED 2 Header */
POLYCHROME_ZONE_3 = 0x02, /* Audio/PCH Zone LEDs */
POLYCHROME_ZONE_4 = 0x03, /* Audio/PCH Zone LEDs */
POLYCHROME_ZONE_5 = 0x04, /* IO Cover Zone LEDs */
POLYCHROME_ZONE_ADDRESSABLE = 0x05, /* Addressable LED header */
POLYCHROME_ZONE_COUNT = 0x06, /* Total number of zones */
POLYCHROME_ZONE_ADDRESSABLE_MAX = 0x64, /* Maxinum number of ARGB LEDs */
};
#define POLYCHROME_NUM_MODES 14 /* Number of Polychrome modes */
/*----------------------------------------------------------------------------------------------*\
| Definitions for ASR LED |
\*----------------------------------------------------------------------------------------------*/
#define ASRLED_NUM_MODES 8 /* Number of ASR LED modes */
enum
{
POLYCHROME_MODE_OFF = 0x10, /* OFF mode */
POLYCHROME_MODE_STATIC = 0x11, /* Static color mode */
POLYCHROME_MODE_BREATHING = 0x12, /* Breating effect mode */
POLYCHROME_MODE_FLASHING = 0x13, /* Flashing effect mode */
POLYCHROME_MODE_SPECTRUM_CYCLE = 0x14, /* Spectrum Cycle effect mode */
POLYCHROME_MODE_RANDOM = 0x15, /* Random effect mode */
POLYCHROME_MODE_WAVE = 0x17, /* Wave effect mode */
POLYCHROME_MODE_SPRING = 0x18, /* Spring effect mode */
POLYCHROME_MODE_STACK = 0x19, /* Stack effect mode */
POLYCHROME_MODE_CRAM = 0x1A, /* Cram effect mode */
POLYCHROME_MODE_SCAN = 0x1B, /* Scan effect mode */
POLYCHROME_MODE_NEON = 0x1C, /* Neon effect mode */
POLYCHROME_MODE_WATER = 0x1D, /* Water effect mode */
POLYCHROME_MODE_RAINBOW = 0x1E, /* Rainbow effect mode */
ASRLED_MODE_OFF = 0x10, /* OFF mode */
ASRLED_MODE_STATIC = 0x11, /* Static color mode */
ASRLED_MODE_BREATHING = 0x12, /* Breathing effect mode */
ASRLED_MODE_STROBE = 0x13, /* Strobe effect mode */
ASRLED_MODE_SPECTRUM_CYCLE = 0x14, /* Spectrum Cycle effect mode */
ASRLED_MODE_RANDOM = 0x15, /* Random effect mode */
ASRLED_MODE_MUSIC = 0x17, /* Music effect mode */
ASRLED_MODE_WAVE = 0x18, /* Wave effect mode */
};
enum
{
POLYCHROME_SPEED_MIN = 0x05, /* Slowest speed */
POLYCHROME_SPEED_DEFAULT = 0x03, /* Default speed */
POLYCHROME_SPEED_MAX = 0x00, /* Fastest speed */
ASRLED_SPEED_MIN = 0x05, /* Slowest speed */
ASRLED_SPEED_DEFAULT = 0x03, /* Default speed */
ASRLED_SPEED_MAX = 0x00, /* Fastest speed */
};
/*----------------------------------------------------------------------------------------------*\
| Definitions for Polychrome V1 |
\*----------------------------------------------------------------------------------------------*/
#define POLYCHROME_V1_NUM_MODES 16 /* Number of Polychrome V1 modes */
enum
{
POLYCHROME_V1_MODE_OFF = 0x10, /* OFF mode */
POLYCHROME_V1_MODE_STATIC = 0x11, /* Static color mode */
POLYCHROME_V1_MODE_BREATHING = 0x12, /* Breating effect mode */
POLYCHROME_V1_MODE_STROBE = 0x13, /* Strobe effect mode */
POLYCHROME_V1_MODE_SPECTRUM_CYCLE = 0x14, /* Spectrum Cycle effect mode */
POLYCHROME_V1_MODE_RANDOM = 0x15, /* Random effect mode */
POLYCHROME_V1_MODE_MUSIC = 0x17, /* Music effect mode */
POLYCHROME_V1_MODE_WAVE = 0x18, /* Wave effect mode */
/*------------------------------------------------------------------------------------------*\
| Modes only available on ARGB headers |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_MODE_SPRING = 0x19, /* Spring effect mode */
POLYCHROME_V1_MODE_METEOR = 0x1A, /* Meteor effect mode */
POLYCHROME_V1_MODE_STACK = 0x1B, /* Stack effect mode */
POLYCHROME_V1_MODE_CRAM = 0x1C, /* Cram effect mode */
POLYCHROME_V1_MODE_SCAN = 0x1D, /* Scan effect mode */
POLYCHROME_V1_MODE_NEON = 0x1E, /* Neon effect mode */
POLYCHROME_V1_MODE_WATER = 0x1F, /* Water effect mode */
POLYCHROME_V1_MODE_RAINBOW = 0x20, /* Rainbow chase effect mode */
};
enum
{
/*------------------------------------------------------------------------------------------*\
| POLYCHROME_V1_MODE_BREATHING |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_SPEED_MIN_BREATHING = 0x0A, /* Slowest speed */
POLYCHROME_V1_SPEED_DEFAULT_BREATHING = 0x02, /* Default speed */
POLYCHROME_V1_SPEED_MAX_BREATHING = 0x02, /* Fastest speed */
/*------------------------------------------------------------------------------------------*\
| POLYCHROME_V1_MODE_STROBE |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_SPEED_MIN_STROBE = 0xA0, /* Slowest speed */
POLYCHROME_V1_SPEED_DEFAULT_STROBE = 0x14, /* Default speed */
POLYCHROME_V1_SPEED_MAX_STROBE = 0x05, /* Fastest speed */
/*------------------------------------------------------------------------------------------*\
| POLYCHROME_V1_MODE_SPECTRUM_CYCLE |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_SPEED_MIN_CYCLE = 0xA0, /* Slowest speed */
POLYCHROME_V1_SPEED_DEFAULT_CYCLE = 0x14, /* Default speed */
POLYCHROME_V1_SPEED_MAX_CYCLE = 0x0A, /* Fastest speed */
/*------------------------------------------------------------------------------------------*\
| POLYCHROME_V1_MODE_RANDOM |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_SPEED_MIN_RANDOM = 0xA0, /* Slowest speed */
POLYCHROME_V1_SPEED_DEFAULT_RANDOM = 0x28, /* Default speed */
POLYCHROME_V1_SPEED_MAX_RANDOM = 0x05, /* Fastest speed */
/*------------------------------------------------------------------------------------------*\
| POLYCHROME_V1_MODE_WAVE |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_SPEED_MIN_WAVE = 0x06, /* Slowest speed */
POLYCHROME_V1_SPEED_DEFAULT_WAVE = 0x02, /* Default speed */
POLYCHROME_V1_SPEED_MAX_WAVE = 0x01, /* Fastest speed */
POLYCHROME_V1_SPEED_DEFAULT_SPRING = 0x04, /* Default speed */
POLYCHROME_V1_SPEED_DEFAULT_METEOR = 0x0A, /* Default speed */
POLYCHROME_V1_SPEED_DEFAULT_STACK = 0x04, /* Default speed */
POLYCHROME_V1_SPEED_DEFAULT_CRAM = 0x04, /* Default speed */
POLYCHROME_V1_SPEED_DEFAULT_SCAN = 0x0A, /* Default speed */
POLYCHROME_V1_SPEED_DEFAULT_NEON = 0x20, /* Default speed */
POLYCHROME_V1_SPEED_DEFAULT_WATER = 0x0A, /* Default speed */
/*------------------------------------------------------------------------------------------*\
| POLYCHROME_V1_MODE_RAINBOW |
\*------------------------------------------------------------------------------------------*/
POLYCHROME_V1_SPEED_MIN_RAINBOW = 0x12, /* Slowest speed */
POLYCHROME_V1_SPEED_DEFAULT_RAINBOW = 0x0A, /* Default speed */
POLYCHROME_V1_SPEED_MAX_RAINBOW = 0x01, /* Fastest speed */
POLYCHROME_V1_SPEED_MIN_ARGB = 0x20, /* Slowest speed */
POLYCHROME_V1_SPEED_MAX_ARGB = 0x02, /* Fastest speed */
};
/*----------------------------------------------------------------------------------------------*\
| Definitions for Polychrome V2 |
\*----------------------------------------------------------------------------------------------*/
#define POLYCHROME_V2_NUM_MODES 14 /* Number of Polychrome V2 modes */
enum
{
POLYCHROME_V2_MODE_OFF = 0x10, /* OFF mode */
POLYCHROME_V2_MODE_STATIC = 0x11, /* Static color mode */
POLYCHROME_V2_MODE_BREATHING = 0x12, /* Breating effect mode */
POLYCHROME_V2_MODE_STROBE = 0x13, /* Strobe effect mode */
POLYCHROME_V2_MODE_SPECTRUM_CYCLE = 0x14, /* Spectrum Cycle effect mode */
POLYCHROME_V2_MODE_RANDOM = 0x15, /* Random effect mode */
POLYCHROME_V2_MODE_WAVE = 0x17, /* Wave effect mode */
POLYCHROME_V2_MODE_SPRING = 0x18, /* Spring effect mode */
POLYCHROME_V2_MODE_STACK = 0x19, /* Stack effect mode */
POLYCHROME_V2_MODE_CRAM = 0x1A, /* Cram effect mode */
POLYCHROME_V2_MODE_SCAN = 0x1B, /* Scan effect mode */
POLYCHROME_V2_MODE_NEON = 0x1C, /* Neon effect mode */
POLYCHROME_V2_MODE_WATER = 0x1D, /* Water effect mode */
POLYCHROME_V2_MODE_RAINBOW = 0x1E, /* Rainbow effect mode */
};
enum
{
POLYCHROME_V2_SPEED_MIN = 0x05, /* Slowest speed */
POLYCHROME_V2_SPEED_DEFAULT = 0x03, /* Default speed */
POLYCHROME_V2_SPEED_MAX = 0x00, /* Fastest speed */
};
class PolychromeController
@@ -81,20 +197,25 @@ public:
PolychromeController(i2c_smbus_interface* bus, polychrome_dev_id dev);
~PolychromeController();
char* GetDeviceName();
unsigned int GetLEDCount();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetFirmwareVersion();
unsigned int GetMode();
bool IsAsrLed();
void SetColorsAndSpeed(unsigned char red, unsigned char green, unsigned char blue, unsigned char speed);
void SetMode(unsigned char mode);
unsigned short GetFirmwareVersion();
unsigned int GetASRockType();
void SetColorsAndSpeed(unsigned char led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char zone, unsigned char mode, unsigned char speed);
unsigned char zone_led_count[6];
private:
bool asr_led;
char device_name[32];
unsigned int led_count;
unsigned int asrock_type;
std::string device_name;
unsigned char active_zone;
unsigned char active_mode;
unsigned char active_speed;
i2c_smbus_interface* bus;
polychrome_dev_id dev;
unsigned short ReadFirmwareVersion();
void ReadLEDConfiguration();
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "PolychromeController.h"
#include "RGBController.h"
#include "RGBController_Polychrome.h"
@@ -54,7 +55,7 @@ void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std:
{
new_polychrome = new PolychromeController(busses[bus], 0x6A);
if(new_polychrome->GetLEDCount() != 0)
if(new_polychrome->GetASRockType() != ASROCK_TYPE_UNKNOWN)
{
new_controller = new RGBController_Polychrome(new_polychrome);
rgb_controllers.push_back(new_controller);
@@ -62,8 +63,10 @@ void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std:
else
{
delete new_polychrome;
}
}
}
}
} /* DetectPolychromeControllers() */
REGISTER_I2C_DETECTOR("ASRock Polychrome", DetectPolychromeControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "PoseidonZRGBController.h"
#include "RGBController.h"
#include "RGBController_PoseidonZRGB.h"
@@ -50,5 +51,6 @@ void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
} /* DetectPoseidonZRGBControllers() */
}
REGISTER_DETECTOR("Thermaltake Poseidon Z RGB", DetectPoseidonZRGBControllers);
@@ -61,9 +61,9 @@ void RGBFusion2DRAMController::Apply()
void RGBFusion2DRAMController::SetLEDEffect
(
unsigned int led,
unsigned int /*led*/,
int mode,
unsigned int speed,
unsigned int /*speed*/,
unsigned char red,
unsigned char green,
unsigned char blue
@@ -75,4 +75,4 @@ void RGBFusion2DRAMController::SetLEDEffect
led_data[RGB_FUSION_2_DRAM_IDX_BLUE] = blue;
bus->i2c_smbus_write_block_data(dev, RGB_FUSION_2_DRAM_LED_START_ADDR, 32, led_data);
}
}
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusion2DRAMController.h"
#include "RGBController.h"
#include "RGBController_RGBFusion2DRAM.h"
@@ -65,3 +66,6 @@ void DetectRGBFusion2DRAMControllers(std::vector<i2c_smbus_interface*>& busses,
}
} /* DetectRGBFusion2DRAMControllers() */
// This detector is disabled as proper detection isn't implemented
//REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion 2 DRAM", DetectRGBFusion2DRAMControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusion2SMBusController.h"
#include "RGBController.h"
#include "RGBController_RGBFusion2SMBus.h"
@@ -6,6 +7,29 @@
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "dependencies/dmiinfo.h"
typedef struct
{
const std::string manufacturer;
const std::string motherboard;
} motherboard_info;
#define RGB_FUSION_2_SMBUS_NUM_DEVICES (sizeof(rgb_fusion_2_smbus_motherboards) / sizeof(rgb_fusion_2_smbus_motherboards[ 0 ]))
const motherboard_info rgb_fusion_2_smbus_motherboards[] =
{
{ "Gigabyte Technology Co., Ltd.", "B450 AORUS ELITE" },
{ "Gigabyte Technology Co., Ltd.", "X470 AORUS ULTRA GAMING-CF" },
{ "Gigabyte Technology Co., Ltd.", "X470 AORUS ULTRA GAMING" },
{ "Gigabyte Technology Co., Ltd.", "X470 AORUS GAMING 5 WIFI" },
{ "Gigabyte Technology Co., Ltd.", "B450 AORUS M" },
{ "Gigabyte Technology Co., Ltd.", "X399 AORUS XTREME-CF" },
{ "Gigabyte Technology Co., Ltd.", "X399 DESIGNARE EX-CF" },
{ "Gigabyte Technology Co., Ltd.", "B450 I AORUS PRO WIFI-CF" },
{ "Gigabyte Technology Co., Ltd.", "B450 AORUS PRO-CF4" },
{ "Gigabyte Technology Co., Ltd.", "X470 AORUS GAMING 7 WIFI-CF" },
};
/******************************************************************************************\
* *
@@ -21,18 +45,12 @@ bool TestForRGBFusion2SMBusController(i2c_smbus_interface* bus, unsigned char ad
bool pass = false;
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
// res = bus->i2c_smbus_read_byte_data(address, 0xF2);
// if (res != 0xC4)
// {
// pass = false;
// }
}
return(pass);
} /* TestForRGBFusion2SMBusController() */
@@ -53,21 +71,38 @@ void DetectRGBFusion2SMBusControllers(std::vector<i2c_smbus_interface*>& busses,
RGBFusion2SMBusController* new_rgb_fusion;
RGBController_RGBFusion2SMBus* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
DMIInfo dmi;
bool found = false;
for(unsigned int mb_idx = 0; mb_idx < RGB_FUSION_2_SMBUS_NUM_DEVICES; mb_idx++)
{
// TODO - Is this necessary? Or an artifact of my own system?
// Skip dmcd devices
std::string device_name = std::string(busses[bus]->device_name);
if (device_name.find("dmdc") == std::string::npos)
if( ( dmi.getManufacturer() == rgb_fusion_2_smbus_motherboards[mb_idx].manufacturer )
&& ( dmi.getMainboard() == rgb_fusion_2_smbus_motherboards[mb_idx].motherboard ) )
{
// Check for RGB Fusion 2 controller at 0x68
if (TestForRGBFusion2SMBusController(busses[bus], 0x68))
found = true;
}
}
if(found)
{
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// TODO - Is this necessary? Or an artifact of my own system?
// Skip dmcd devices
std::string device_name = std::string(busses[bus]->device_name);
if (device_name.find("dmdc") == std::string::npos)
{
new_rgb_fusion = new RGBFusion2SMBusController(busses[bus], 0x68);
new_controller = new RGBController_RGBFusion2SMBus(new_rgb_fusion);
rgb_controllers.push_back(new_controller);
// Check for RGB Fusion 2 controller at 0x68
if (TestForRGBFusion2SMBusController(busses[bus], 0x68))
{
new_rgb_fusion = new RGBFusion2SMBusController(busses[bus], 0x68);
new_controller = new RGBController_RGBFusion2SMBus(new_rgb_fusion);
rgb_controllers.push_back(new_controller);
}
}
}
}
} /* DetectRGBFusion2SMBusControllers() */
REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion 2 SMBus", DetectRGBFusion2SMBusControllers);
@@ -29,14 +29,15 @@ static LEDCount LedCountToEnum(unsigned int c)
RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name) : dev(handle)
{
int res = 0;
char text[64] {};
unsigned char buffer[64] {};
if( dev ) {
int res = 0;
char text[64] = { 0x00 };
unsigned char buffer[64] = { 0x00 };
if( dev )
{
SetCalibration();
name = mb_name;
// hid report read needs 0x60 packet or it gives IO error
SendPacket(0x60, 0x00);
@@ -46,9 +47,8 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
{
report = *reinterpret_cast<IT8297Report*>(buffer);
name = mb_name;
description = std::string(report.str_product, 32);
description.erase(std::find(name.begin(), name.end(), '\0'), name.end());
//description.erase(std::find(description.begin(), description.end(), '\0'), name.end());
snprintf(text, 11, "0x%08X", report.fw_ver);
version = text;
@@ -56,7 +56,6 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
snprintf(text, 11, "0x%08X", report.chip_id);
chip_id = text;
}
loc = path;
EnableBeat(false);
@@ -1,9 +1,11 @@
#include "Detector.h"
#include "RGBFusion2USBController.h"
#include "RGBController_RGBFusion2USB.h"
#include "dependencies/dmiinfo.h"
#define IT8297_VID 0x048D
#define IT8297_IFC 0
#define IT8297_U 0xCC
#define IT8297_UPG 0xFF89
#define COUNT_RGBFUSION2_PIDS (sizeof(RGBFusion2_pids) / sizeof(RGBFusion2_pids[ 0 ]))
@@ -33,7 +35,7 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
return;
}
for(int dev_idx = 0; dev_idx < COUNT_RGBFUSION2_PIDS; dev_idx++)
for(unsigned int dev_idx = 0; dev_idx < COUNT_RGBFUSION2_PIDS; dev_idx++)
{
dev = NULL;
@@ -43,15 +45,17 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
while(info)
{
if((info->vendor_id == IT8297_VID)
&& (info->interface_number == IT8297_IFC)
#ifdef USE_HID_USAGE
&&(info->product_id == tmpPID)
&&(info->usage == IT8297_U) //Usage and usage page required to get the correct interface
&&(info->usage_page == IT8297_UPG))
#else
&&(info->interface_number == IT8297_IFC) //Interface is only valid on Windows where there is > 1 interface
&&(info->product_id == tmpPID))
#endif
{
hid_device * dev = hid_open_path(info->path);
dev = hid_open_path(info->path);
if (dev)
{
RGBFusion2USBController * controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard());
@@ -64,4 +68,6 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
}
hid_free_enumeration(info);
}
} /* DetectRGBFusion2USBControllers() */
REGISTER_DETECTOR("Gigabyte RGB Fusion 2 USB", DetectRGBFusion2USBControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusionController.h"
#include "RGBController.h"
#include "RGBController_RGBFusion.h"
@@ -64,4 +65,6 @@ void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::
}
}
} /* DetectRGBFusionControllers() */
} /* DetectRGBFusionControllers() */
REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion", DetectRGBFusionControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusionGPUController.h"
#include "RGBController.h"
#include "RGBController_RGBFusionGPU.h"
@@ -81,3 +82,5 @@ void DetectRGBFusionGPUControllers(std::vector<i2c_smbus_interface*>& busses, st
}
} /* DetectRGBFusionGPUControllers() */
REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion GPU", DetectRGBFusionGPUControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RedragonK556Controller.h"
#include "RedragonM711Controller.h"
#include "RGBController.h"
@@ -72,7 +73,7 @@ void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers)
hid_init();
for(int device_idx = 0; device_idx < REDRAGON_NUM_DEVICES; device_idx++)
for(unsigned int device_idx = 0; device_idx < REDRAGON_NUM_DEVICES; device_idx++)
{
dev = NULL;
@@ -123,4 +124,6 @@ void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
}
}
} /* DetectRedragonControllers() */
REGISTER_DETECTOR("Redragon Peripheral", DetectRedragonControllers);
@@ -52,7 +52,7 @@ void SapphireGPUController::SetColor(unsigned char red, unsigned char green, uns
bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_BLUE, blue);
}
void SapphireGPUController::SetMode(unsigned char mode, unsigned char speed)
void SapphireGPUController::SetMode(unsigned char mode, unsigned char /*speed*/)
{
bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_MODE, mode);
}
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "SapphireGPUController.h"
#include "RGBController.h"
#include "RGBController_SapphireGPU.h"
@@ -17,12 +18,12 @@
bool TestForSapphireGPUController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res;
//bool pass = false;
//int res;
if(bus->i2c_smbus_read_byte_data(address, 0x06) == 0xCC)
{
pass = true;
//pass = true;
}
return(false); //TODO - better detection, leaving disabled for now
@@ -57,3 +58,6 @@ void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std
}
} /* DetectSapphireGPUControllers() */
// This detector is disabled as it does not properly detect
//REGISTER_I2C_DETECTOR("Sapphire GPU", DetectSapphireGPUControllers);
@@ -21,11 +21,20 @@ static unsigned int keys[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xf0 };
0xf0, 0x31 };
SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle)
static unsigned int keys_tkl[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
0x64, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xf0, 0x31 };
SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle, steelseries_type type)
{
dev = dev_handle;
proto_type = type;
}
SteelSeriesApexController::~SteelSeriesApexController()
@@ -36,7 +45,7 @@ SteelSeriesApexController::~SteelSeriesApexController()
void SteelSeriesApexController::SetMode
(
unsigned char mode,
std::vector<RGBColor> colors
std::vector<RGBColor> /*colors*/
)
{
unsigned char mode_colors[9];
@@ -49,8 +58,17 @@ void SteelSeriesApexController::SetMode
void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
{
unsigned char buf[642];
int num_keys = sizeof(keys)/sizeof(*keys);
unsigned char buf[643];
int num_keys = 0;
if(proto_type == APEX)
{
num_keys = sizeof(keys) / sizeof(*keys);
}
else
{
num_keys = sizeof(keys_tkl) / sizeof(*keys_tkl);
}
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -60,24 +78,32 @@ void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
buf[0x00] = APEX7_PACKET_ID_DIRECT;
buf[0x01] = num_keys;
buf[0x00] = 0;
buf[0x01] = APEX_PACKET_ID_DIRECT;
buf[0x02] = num_keys;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0; i < num_keys; i++)
{
buf[(i*4)+2] = keys[i];
buf[(i*4)+3] = RGBGetRValue(colors[i]);
buf[(i*4)+4] = RGBGetGValue(colors[i]);
buf[(i*4)+5] = RGBGetBValue(colors[i]);
if(proto_type == APEX)
{
buf[(i*4)+3] = keys[i];
}
else
{
buf[(i*4)+3] = keys_tkl[i];
}
buf[(i*4)+4] = RGBGetRValue(colors[i]);
buf[(i*4)+5] = RGBGetGValue(colors[i]);
buf[(i*4)+6] = RGBGetBValue(colors[i]);
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 642);
hid_send_feature_report(dev, buf, 643);
}
/*-------------------------------------------------------------------------------------------------*\
@@ -89,28 +115,15 @@ void SteelSeriesApexController::SelectProfile
unsigned char profile
)
{
unsigned char buf[64];
unsigned char buf[65];
/*-----------------------------------------------------*\
| Zero out buffer, set up first packet and send |
| Zero out buffer, set up packet and send |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
buf[0x00] = 0x69;
hid_send_feature_report(dev, buf, 64);
buf[0x00] = 0;
buf[0x01] = 0x89;
buf[0x02] = profile;
hid_send_feature_report(dev, buf, 65);
/*-----------------------------------------------------*\
| Zero out buffer, set up second packet and send |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
buf[0x00] = 0x89;
buf[0x01] = profile;
hid_send_feature_report(dev, buf, 64);
/*-----------------------------------------------------*\
| Zero out buffer, set up third packet and send |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
buf[0x00] = 0x41;
hid_send_feature_report(dev, buf, 64);
}
@@ -8,6 +8,7 @@
\*-----------------------------------------*/
#include "RGBController.h"
#include "SteelSeriesGeneric.h"
#include <string>
#include <hidapi/hidapi.h>
@@ -16,15 +17,17 @@
enum
{
APEX7_PACKET_ID_DIRECT = 0x3a, /* Direct mode */
APEX_PACKET_ID_DIRECT = 0x3a, /* Direct mode */
};
class SteelSeriesApexController
{
public:
SteelSeriesApexController(hid_device* dev_handle);
SteelSeriesApexController(hid_device* dev_handle, steelseries_type type);
~SteelSeriesApexController();
steelseries_type proto_type;
void SetMode
(
unsigned char mode,
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "SteelSeriesRivalController.h"
#include "SteelSeriesSiberiaController.h"
#include "SteelSeriesApexController.h"
@@ -35,7 +36,10 @@
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define STEELSERIES_APEX_5_PID 0x161C
#define STEELSERIES_APEX_7_PID 0x1612
#define STEELSERIES_APEX_7_TKL_PID 0x1618
#define STEELSERIES_APEX_PRO_PID 0x1610
typedef struct
{
@@ -73,7 +77,10 @@ static const steelseries_device device_list[] =
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-----------------------------------------------------------------------------------------------------------------------------------------------------------------*/
{ STEELSERIES_VID, STEELSERIES_APEX_7_PID, 1, DEVICE_TYPE_KEYBOARD, APEX_7, "SteelSeries Apex 7" },
{ STEELSERIES_VID, STEELSERIES_APEX_5_PID, 1, DEVICE_TYPE_KEYBOARD, APEX, "SteelSeries Apex 5" },
{ STEELSERIES_VID, STEELSERIES_APEX_7_PID, 1, DEVICE_TYPE_KEYBOARD, APEX, "SteelSeries Apex 7" },
{ STEELSERIES_VID, STEELSERIES_APEX_7_TKL_PID, 1, DEVICE_TYPE_KEYBOARD, APEX_TKL, "SteelSeries Apex 7 TKL" },
{ STEELSERIES_VID, STEELSERIES_APEX_PRO_PID, 1, DEVICE_TYPE_KEYBOARD, APEX, "SteelSeries Apex Pro" },
};
/******************************************************************************************\
@@ -91,7 +98,7 @@ void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers)
hid_init();
for(int device_idx = 0; device_idx < STEELSERIES_NUM_DEVICES; device_idx++)
for(unsigned int device_idx = 0; device_idx < STEELSERIES_NUM_DEVICES; device_idx++)
{
dev = NULL;
@@ -119,7 +126,7 @@ void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers)
{
case DEVICE_TYPE_KEYBOARD:
{
SteelSeriesApexController* controller = new SteelSeriesApexController(dev);
SteelSeriesApexController* controller = new SteelSeriesApexController(dev, device_list[device_idx].proto_type);
RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller);
rgb_controller->name = device_list[device_idx].name;
@@ -153,4 +160,6 @@ void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
}
} /* DetectSteelSeriesControllers() */
REGISTER_DETECTOR("SteelSeries", DetectSteelSeriesControllers);
@@ -20,6 +20,7 @@ typedef enum
RIVAL_100 = 0x00,
RIVAL_300 = 0x01,
SIBERIA_350 = 0x03,
APEX_7 = 0x04,
APEX = 0x04,
APEX_TKL = 0x05,
} steelseries_type;
@@ -70,15 +70,20 @@ void SteelSeriesRivalController::SetLightEffect
{
char usb_buf[9];
memset(usb_buf, 0x00, sizeof(usb_buf));
switch (proto) {
switch (proto)
{
case RIVAL_100:
usb_buf[0x00] = 0x07;
usb_buf[0x01] = 0x00;
break;
case RIVAL_300:
usb_buf[0x00] = 0x07;
usb_buf[0x01] = zone_id + 1;
break;
default:
break;
}
usb_buf[0x02] = effect;
send_usb_msg(dev, usb_buf, 9);
@@ -100,8 +105,10 @@ void SteelSeriesRivalController::SetLightEffectAll
SetLightEffect(0, effect);
SetLightEffect(1, effect);
break;
default:
break;
}
}
@@ -126,7 +133,11 @@ void SteelSeriesRivalController::SetColor
usb_buf[0x00] = 0x08;
usb_buf[0x01] = zone_id + 1;
break;
default:
break;
}
usb_buf[0x02] = red;
usb_buf[0x03] = green;
usb_buf[0x04] = blue;
@@ -151,6 +162,9 @@ void SteelSeriesRivalController::SetColorAll
SetColor(0, red, green, blue);
SetColor(1, red, green, blue);
break;
default:
break;
}
}
@@ -13,7 +13,7 @@
static void send_usb_msg(hid_device* dev, char * data_pkt, unsigned int size)
{
char* usb_pkt = new char[16];
unsigned char usb_pkt[16];
memset(usb_pkt, 0x00, sizeof(usb_pkt));
// Report number
@@ -30,9 +30,7 @@ static void send_usb_msg(hid_device* dev, char * data_pkt, unsigned int size)
usb_pkt[4 + i] = data_pkt[1 + i];
}
hid_write(dev, (unsigned char *)usb_pkt, 16);
delete[] usb_pkt;
hid_write(dev, usb_pkt, 16);
}
SteelSeriesSiberiaController::SteelSeriesSiberiaController
@@ -0,0 +1,108 @@
/*-------------------------------------------------------------------*\
| TecknetController.cpp |
| |
| Driver for Technet Devices |
| |
| Chris M (Dr_No) 29th Jul 2020 |
| |
\*-------------------------------------------------------------------*/
#include "TecknetController.h"
static unsigned char tecknet_colour_mode_data[][16] =
{
{ 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Static
{ 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Breathing
};
static unsigned char tecknet_speed_mode_data[][9] =
{
{ 0x00, 0x00, 0x00, 0x00 }, // Static
{ 0x00, 0x06, 0x03, 0x01 }, // Breathing
};
TecknetController::TecknetController(hid_device* dev_handle, char *_path)
{
const int szTemp = 256;
wchar_t tmpName[szTemp];
dev = dev_handle;
hid_get_manufacturer_string(dev, tmpName, szTemp);
std::wstring wName = std::wstring(tmpName);
device_name = std::string(wName.begin(), wName.end());
hid_get_product_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
device_name.append(" ").append(std::string(wName.begin(), wName.end()));
hid_get_serial_number_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
serial = std::string(wName.begin(), wName.end());
location = _path;
current_mode = TECKNET_MODE_STATIC;
current_speed = TECKNET_SPEED_NORMAL;
current_brightness = TECKNET_BRIGHTNESS_HIGH;
}
TecknetController::~TecknetController()
{
hid_close(dev);
}
std::string TecknetController::GetDeviceName()
{
return device_name;
}
std::string TecknetController::GetSerial()
{
return serial;
}
std::string TecknetController::GetLocation()
{
return location;
}
void TecknetController::SetMode(unsigned char mode, unsigned char speed, unsigned char brightness)
{
current_mode = mode;
current_speed = speed;
current_brightness = brightness;
SendUpdate();
}
void TecknetController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
//The Tecknet mouse expects inverted colours in sent packets
current_red = 255 - red;
current_green = 255 - green;
current_blue = 255 - blue;
SendUpdate();
}
void TecknetController::SendUpdate()
{
unsigned char buffer[TECKNET_PACKET_LENGTH] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
for(std::size_t i = 0; i < TECKNET_COLOUR_MODE_DATA_SIZE; i++)
{
buffer[i] = tecknet_colour_mode_data[current_mode][i];
}
//Set the relevant colour info
buffer[TECKNET_RED_BYTE] = current_red;
buffer[TECKNET_GREEN_BYTE] = current_green;
buffer[TECKNET_BLUE_BYTE] = current_blue;
buffer[TECKNET_BRIGHTNESS_BYTE] = current_brightness;
buffer[TECKNET_SPEED_BYTE] = tecknet_speed_mode_data[current_mode][current_speed];
hid_send_feature_report(dev, buffer, buffer_size);
}
@@ -0,0 +1,82 @@
/*-------------------------------------------------------------------*\
| TecknetController.h |
| |
| Driver for Tecknet Devices |
| |
| Chris M (Dr_No) 29th Jul 2020 |
| |
\*-------------------------------------------------------------------*/
#ifndef TECKNETCONTROLLER_H
#define TECKNETCONTROLLER_H
#include <string>
#include <hidapi/hidapi.h>
#define TECKNET_COLOUR_MODE_DATA_SIZE (sizeof(tecknet_colour_mode_data[0]) / sizeof(tecknet_colour_mode_data[0][0]))
#define TECKNET_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define TECKNET_PACKET_LENGTH 0x10 //16 bytes
enum
{
TECKNET_RED_BYTE = 2,
TECKNET_GREEN_BYTE = 3,
TECKNET_BLUE_BYTE = 4,
TECKNET_BRIGHTNESS_BYTE = 5,
TECKNET_SPEED_BYTE = 6
};
enum
{
TECKNET_MODE_OFF = 0xFF, //LEDs Off
TECKNET_MODE_STATIC = 0x00, //Static Mode
TECKNET_MODE_BREATHING = 0x01, //Breathing Mode
};
enum
{
TECKNET_BRIGHTNESS_OFF = 0x00,
TECKNET_BRIGHTNESS_LOW = 0x01,
TECKNET_BRIGHTNESS_MED = 0x02,
TECKNET_BRIGHTNESS_HIGH = 0x03
};
enum
{
TECKNET_SPEED_OFF = 0x00, // Breathe Off
TECKNET_SPEED_SLOW = 0x01, // Breathe Slow speed
TECKNET_SPEED_NORMAL = 0x02, // Breathe Normal speed
TECKNET_SPEED_FAST = 0x03, // Breathe Fast speed
};
class TecknetController
{
public:
TecknetController(hid_device *dev_handle, char *_path);
~TecknetController();
std::string GetDeviceName();
std::string GetSerial();
std::string GetLocation();
void SetMode(unsigned char mode, unsigned char speed, unsigned char brightness);
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
private:
std::string device_name;
std::string serial;
std::string location;
hid_device* dev;
unsigned char current_mode;
unsigned char current_speed;
unsigned char current_brightness;
unsigned char current_red;
unsigned char current_green;
unsigned char current_blue;
void SendUpdate();
};
#endif // TECKNETCONTROLLER_H
@@ -0,0 +1,87 @@
/*-------------------------------------------------------------------*\
| TecknetControllerDetect.cpp |
| |
| Driver for Tecknet Devices |
| |
| Chris M (Dr_No) 29th Jul 2020 |
| |
\*-------------------------------------------------------------------*/
#include "Detector.h"
#include "TecknetController.h"
#include "RGBController.h"
#include "RGBController_Tecknet.h"
#include <hidapi/hidapi.h>
#define TECKNET_VID 0x04D9
#define TECKNET_M0008_PID 0xFC05
#define TECKNET_M0008_U 0x01 //Usage 01
#define TECKNET_M0008_UPG 0xFFA0 //Vendor Defined Usage Page
#define TECKNET_NUM_DEVICES (sizeof(tecknet_pids) / sizeof(tecknet_pids[ 0 ]))
enum
{
TECKNET_PID = 0,
TECKNET_INTERFACE = 1,
TECKNET_USAGE = 2,
TECKNET_USAGE_PAGE = 3
};
static const int tecknet_pids[][4] =
{ // PID, Interface, Usage, Usage_Page
{ TECKNET_M0008_PID, 0, TECKNET_M0008_U, TECKNET_M0008_UPG } //Tecknet M008 Mouse
};
/******************************************************************************************\
* *
* DetectTecknetControllers *
* *
* Tests the USB address to see if any Tecknet Controllers. *
* *
\******************************************************************************************/
void DetectTecknetControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
//Look for the passed in tecknet_pids
hid_init();
info = hid_enumerate(TECKNET_VID, 0x0);
while(info)
{
hid_device* dev = NULL;
if(info->vendor_id == TECKNET_VID)
{
for(unsigned int pid_idx = 0; pid_idx < TECKNET_NUM_DEVICES; pid_idx++)
{
if((info->vendor_id == TECKNET_VID)
#ifdef USE_HID_USAGE
&&(info->usage == tecknet_pids[pid_idx][TECKNET_USAGE])
&&(info->usage_page == tecknet_pids[pid_idx][TECKNET_USAGE_PAGE])
&&(info->product_id == tecknet_pids[pid_idx][TECKNET_PID]))
#else
&&(info->interface_number == tecknet_pids[pid_idx][TECKNET_INTERFACE]) //Interface is only valid on Windows where there is > 1 interface
&&(info->product_id == tecknet_pids[pid_idx][TECKNET_PID]))
#endif
{
dev = hid_open_path(info->path);
break;
}
}
}
if(dev)
{
TecknetController* controller = new TecknetController(dev, info->path);
RGBController_Tecknet* rgb_controller = new RGBController_Tecknet(controller);
rgb_controllers.push_back(rgb_controller);
}
info = info->next;
}
hid_free_enumeration(info);
} /* DetectTecknetControllers) */
REGISTER_DETECTOR("Tecknet", DetectTecknetControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "ThermaltakeRiingController.h"
#include "RGBController.h"
#include "RGBController_ThermaltakeRiing.h"
@@ -53,4 +54,6 @@ void DetectThermaltakeRiingControllers(std::vector<RGBController*>& rgb_controll
rgb_controllers.push_back(rgb_controller);
}
}
}
} /* DetectThermaltakeRiingControllers() */
REGISTER_DETECTOR("Thermaltake Riing", DetectThermaltakeRiingControllers);
+7
View File
@@ -0,0 +1,7 @@
#pragma once
#include "DeviceDetector.h"
#define REGISTER_DETECTOR(name, func) static DeviceDetector device_detector_obj(name, func)
#define REGISTER_I2C_DETECTOR(name, func) static I2CDeviceDetector device_detector_obj(name, func)
#define REGISTER_I2C_BUS_DETECTOR(func) static I2CBusDetector device_detector_obj(func)
+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <functional>
#include <string>
#include <vector>
#include "ResourceManager.h"
class DeviceDetector
{
public:
DeviceDetector(std::string name, DeviceDetectorFunction detector)
{
ResourceManager::get()->RegisterDeviceDetector(name, detector);
}
};
class I2CDeviceDetector
{
public:
I2CDeviceDetector(std::string name, I2CDeviceDetectorFunction detector)
{
ResourceManager::get()->RegisterI2CDeviceDetector(name, detector);
}
};
class I2CBusDetector
{
public:
I2CBusDetector(I2CBusDetectorFunction detector)
{
ResourceManager::get()->RegisterI2CBusDetector(detector);
}
};
+17 -7
View File
@@ -31,6 +31,7 @@ NetworkClient::NetworkClient(std::vector<RGBController *>& control) : controller
{
strcpy(port_ip, "127.0.0.1");
port_num = OPENRGB_SDK_PORT;
client_sock = -1;
server_connected = false;
server_controller_count = 0;
@@ -38,6 +39,11 @@ NetworkClient::NetworkClient(std::vector<RGBController *>& control) : controller
ConnectionThread = NULL;
}
NetworkClient::~NetworkClient()
{
delete ConnectionThread;
}
void NetworkClient::ClientInfoChanged()
{
ClientInfoChangeMutex.lock();
@@ -129,8 +135,12 @@ void NetworkClient::StopClient()
server_connected = false;
client_active = false;
shutdown(client_sock, SD_RECEIVE);
closesocket(client_sock);
if (server_connected)
{
shutdown(client_sock, SD_RECEIVE);
closesocket(client_sock);
}
if(ListenThread)
ListenThread->join();
ConnectionThread->join();
@@ -363,7 +373,7 @@ void NetworkClient::ListenThreadFunction()
{
int tmp_bytes_read = 0;
tmp_bytes_read = recv_select(client_sock, &data[bytes_read], header.pkt_size - bytes_read, 0);
tmp_bytes_read = recv_select(client_sock, &data[(unsigned int)bytes_read], header.pkt_size - bytes_read, 0);
if(tmp_bytes_read <= 0)
{
@@ -371,7 +381,7 @@ void NetworkClient::ListenThreadFunction()
}
bytes_read += tmp_bytes_read;
} while (bytes_read < header.pkt_size);
} while ((unsigned int)bytes_read < header.pkt_size);
}
//Entire request received, select functionality based on request ID
@@ -394,9 +404,9 @@ listen_done:
server_initialized = false;
server_connected = false;
for(int server_controller_idx = 0; server_controller_idx < server_controllers.size(); server_controller_idx++)
for(size_t server_controller_idx = 0; server_controller_idx < server_controllers.size(); server_controller_idx++)
{
for(int controller_idx = 0; controller_idx < controllers.size(); controller_idx++)
for(size_t controller_idx = 0; controller_idx < controllers.size(); controller_idx++)
{
if(controllers[controller_idx] == server_controllers[server_controller_idx])
{
@@ -438,7 +448,7 @@ void NetworkClient::ProcessReply_ControllerCount(unsigned int data_size, char *
}
}
void NetworkClient::ProcessReply_ControllerData(unsigned int data_size, char * data, unsigned int dev_idx)
void NetworkClient::ProcessReply_ControllerData(unsigned int /*data_size*/, char * data, unsigned int dev_idx)
{
RGBController_Network * new_controller = new RGBController_Network(this, dev_idx);
+1
View File
@@ -21,6 +21,7 @@ class NetworkClient
{
public:
NetworkClient(std::vector<RGBController *>& control);
~NetworkClient();
void ClientInfoChanged();
+1 -1
View File
@@ -20,7 +20,7 @@ typedef struct NetPacketHeader
unsigned int pkt_dev_idx; /* Device index */
unsigned int pkt_id; /* Packet ID */
unsigned int pkt_size; /* Packet size */
};
} NetPacketHeader;
enum
{

Some files were not shown because too many files have changed in this diff Show More