Compare commits

...
Author SHA1 Message Date
Adam Honse 100678f85b Rework device enabling - fill in detectors list with detector names, default to true. Setting them to false disables the detectors 2020-11-10 17:57:56 -06:00
Adam Honse b29b987504 Add functions to set and save settings 2020-11-10 15:53:58 -06:00
Adam Honse a24909471f Fix Profile list loading 2020-11-10 15:49:56 -06:00
Adam Honse 49365b3d98 Fall back to HOME if XDG_CONFIG_HOME doesn't exist 2020-11-10 15:49:56 -06:00
Adam Honse c8e547343b Fix issues with empty json and unknown path 2020-11-10 15:49:56 -06:00
Adam Honse 8131b94a5d Create configuration directory if it doesn't exist 2020-11-10 15:49:56 -06:00
Adam Honse f7d187f5b2 Use XDG-compliant configuration directory (APPDATA on Windows) 2020-11-10 15:49:56 -06:00
Adam Honse 7b54787dd7 Rework Linux LED detection to use Settings Manager 2020-11-10 15:49:56 -06:00
Adam Honse 64b592c9bd Rework Disabled Devices list to use Settings Manager 2020-11-10 15:49:56 -06:00
Adam Honse 8998f0a731 Rework Debug Device detection to use Settings Manager 2020-11-10 15:49:55 -06:00
Adam Honse 12ed987333 Rework Espurna detection to use Settings Manager 2020-11-10 15:49:55 -06:00
Adam Honse 73efb1735f Rework LED Strip detection to use Settings Manager 2020-11-10 15:49:55 -06:00
Adam Honse 8eab2b6244 Rework Philips Wiz detection to use Settings Manager 2020-11-10 15:49:55 -06:00
Adam Honse b8835ad44f Clear the settings store if parsing the loaded JSON file fails 2020-11-10 15:49:55 -06:00
Adam Honse 5b68efd09f Initial prototype of settings manager loads JSON settings file and E1.31 detector uses JSON data to detect devices 2020-11-10 15:49:55 -06:00
Chris 5b15251d46 Adding Razer DeathAdder V2 to OpenRazerDevices.h to fix #604 2020-11-10 23:23:47 +11:00
Adam Honse 495c3cfe68 Fix padding in MSI Mystic Light controller and disable multiple-zone modes. Controller is still not enabled for general use. See Issue #389 2020-11-09 23:36:11 -06:00
Chris 945a32bdd4 Fixed resizing issue
* Comparing the passed in led to HDR_D_LED1 instead of the
HDR_D_LED1_RGB
* Removed hardcoded SendPacket()
2020-11-09 21:09:43 -06:00
Chris M d045a45a10 Hardcoding 1024 Leds for both D_LED channels 2020-11-09 21:09:01 -06:00
Chris 7b56ed4fd0 Convert Report.total_leds to enum 2020-11-09 21:08:19 -06:00
Chris M e751c3cf15 Correcting ln59 / 60 2020-11-09 21:07:52 -06:00
Chris M 1ca1ab2f00 Adding code to return current D_LED block count(s) from the controller
* Fixed logical error on ln119
2020-11-09 21:07:34 -06:00
Chris 76bad98bc7 Changes made to RGBFusion2USBController for issue 588
Other code cleanup removed by Adam Honse <[email protected]>
2020-11-09 21:04:45 -06:00
Chris M c3f45f79ca Adding "NZXT Hue 2 Motherboard" with 2 LED channels and 3 Fans 2020-11-09 20:25:55 -06:00
Chris M 3eec91575c Adding "B450 AORUS PRO-CF" motherboards as per request from discord user @troD4RKD3VIL
* Is the "B450 AORUS PRO-CF4" a typo??
2020-11-09 20:22:09 -06:00
Chris fa67bb285c Adding "X570 AORUS ELITE" to layouts 2020-11-09 20:21:44 -06:00
Chris f7d5f4cf38 Adding "B550I AORUS PRO AX" to layouts 2020-11-09 20:21:36 -06:00
TheRogueZeta 6cf334c296 Add support for MSI GeForce GTX 1660 Ti GAMING X 2020-11-10 02:16:22 +00:00
Erik Hanson cfefa73ca2 Add EVGA RTX 2070 SUPER XC ULTRA 2020-11-09 20:13:28 -06:00
TheRogueZeta 06a320d8d6 Add Galax RTX 2070 Super EX Gamer Black 2020-11-09 22:41:08 +00:00
Adam Honse 1d6aa0b17e Define controller address per GPU for Gigabyte RGB Fusion GPU as the GTX1080 G1 Gaming has the controller at 0x48 2020-11-09 16:39:11 -06:00
Adam Honse d2936a38ce Add Gigabyte GTX1080 G1 Gaming 2020-11-09 15:12:07 -06:00
Adam Honse ad2bad17e8 Bring the AppImage tools into the repo so we don't have to download them from unreliable external locations 2020-11-09 09:36:36 -06:00
Adam Honse 940a71931d Back to old AppImage version as link is working again 2020-11-09 09:32:17 -06:00
Adam Honse 7ffefed6c7 Verbose linuxdeploy 2020-11-09 09:08:55 -06:00
Adam Honse 52e802e226 Fix issue with debug keyboard not registering properly 2020-11-07 19:36:33 -06:00
Chris 6e16185e7f Direct Mode partially working
* Colours appear but seem to be one "apply colors" click behind
2020-11-07 19:19:53 -06:00
Chris cce3fcccaf RGB Output now functional
* GetStatus code disabled for now
* Passthru mode working currently testing other functionality
2020-11-07 19:19:41 -06:00
Chris 154f5afa44 Changed detector to allow for usage / usage page detection
* Small correction to packet bytes in CMARGBcontroller.h to allow packet
to send 0x00 at first byte
* Rearranged modes in RGBController_CMARGBController.cpp to have single
colour modes first
2020-11-07 19:18:51 -06:00
Chris 547a35307e CM ARGB Controller now functional
* All modes sans Passthru & Direct working
* All colour indexes now enumerating as expected
* Crashes when changing to Passthru from certain modes. Switch to "OFF"
first
2020-11-07 19:16:09 -06:00
Chris 90002d9eed CM ARGB Controller now working for some modes
* Code SegFaults after a few change packets are sent
2020-11-07 19:15:47 -06:00
Chris 743a27d0a2 Coolermastrer ARGB Controller detecting but not yet applying colour
* Compiling correctly
* Adding 5 controllers to GUI
* Changing Colour will cause segfault
2020-11-07 19:13:54 -06:00
Chris b709e5ddcc Initial add for Coolermaster ARGB controller
* Not yet functional

Commit amended for code style and cherry-pick cleanup by Adam Honse <[email protected]>
2020-11-07 19:12:37 -06:00
TheRogueZeta 06c09da4ea Add MSI RTX 2070 SUPER GAMING TRIO 2020-11-08 00:59:12 +00:00
TheRogueZeta 3a935249ef Add MSI 3090 GAMING X TRIO, fix Galax GPU ID
Commits squashed and amended by Adam Honse <[email protected]>
2020-11-07 18:58:02 -06:00
Adam Honse 89f22f99a0 Revert path for Linux Deploy as the temporary URL went down 2020-11-04 22:29:11 -06:00
Adam Honse 5f1889e101 Update Philips Wiz controller to use new Light device type 2020-11-04 09:24:44 -06:00
Adam Honse 19d554fede Update Espurna controller to use new Light device type 2020-11-04 09:23:46 -06:00
Adam Honse 1e4eacd337 Add a Light device type with a bulb icon 2020-11-04 09:23:17 -06:00
Adam Honse 87c99d31cf Update Wiz controller to use JSON library, receive firmware information from device 2020-11-04 00:45:20 -06:00
Adam Honse 5c5ed6f8bd Initial Philips Wiz controller 2020-11-03 20:06:14 -06:00
Adam Honse 88a96cd0c2 Expire CI builds after 30 days 2020-10-30 00:02:48 -05:00
Adam Honse ffb452f6f4 Use HID path for Location on Logitech mouse controllers 2020-10-29 23:55:30 -05:00
TheRogueZeta 7b93275443 Add issue templates (New Device, Feature Request, and Bug Report)
Templates edited by Adam Honse <[email protected]>
2020-10-29 23:27:29 -05:00
Tom Parker 09ad9b17fb [#582,#448] Fix profile loading RGBController metadata mismatch issue with the RGBFusion2USBController.
The controller description mismatched what was being saved in the
profile, with trailing '\0's filling the string to pad out the
initialized 32 character string.  Strangely enough the code to remove
these '\0's was there, with just a minor typo referencing 'name' instead
of 'description' to obtain the string's end index.

Tested on an X570 Aorus Ultra board revision 1.2.

Fixes issues #582 and #448.
2020-10-29 22:50:22 +00:00
TheRogueZeta 17e3898bcf Add MSI 1660 Super from Ant182 on discord 2020-10-29 10:16:44 -07:00
Adam Honse 56e90d60dd Add Zotac and PNY PCI IDs 2020-10-29 00:37:01 -05:00
Adam Honse efb5975fcf Add PCI ID filtering to Gigabyte RGB Fusion GPU detection 2020-10-29 00:28:25 -05:00
TheRogueZeta 8fa14542ad Add MSI RTX 2070 Super Gaming Z Trio and sort list 2020-10-29 03:40:59 +00:00
Adam Honse 2c93b46b23 Add support for 8-LED and 6-LED Hue 2 strips in the Hue 2 controller (thanks to Discord user peman for the patch!) 2020-10-28 19:06:20 -05:00
Adam Honse f9272872b9 Add ROG Gladius II Origin PID 2020-10-28 14:24:45 -05:00
Adam Honse 045dd98e51 Add support for ROG Gladius II mouse 2020-10-28 12:58:18 -05:00
Florian Heilmann 04b2e35f81 Add SteelSeries Apex M750 support
Commits squashed and some minor code style changes by Adam Honse <[email protected]>
2020-10-27 21:21:56 -05:00
Adam Honse 31a9399d19 Add I2C read check to Sapphire GPU controller, so it only creates a controller for the correct GPU bus 2020-10-27 00:46:53 -05:00
Adam Honse 7dfbdade39 Initial support for HyperX Fury Ultra mousemat (Direct mode only) 2020-10-26 12:51:59 -05:00
TheRogueZeta 41a0f2e7c3 Add TU104 MSI RTX 2060 Gaming X 2020-10-26 11:25:40 -05:00
crashniels da81052247 Use PCI ID based detection for Galax GPUs 2020-10-26 11:18:23 -05:00
Adam Honse a03e6a7800 Fix ROG Gladius II zone order and remove Off mode 2020-10-25 01:37:36 -05:00
Adam Honse 76b575e562 Fix ROG Gladius II Core 2020-10-25 01:30:31 -05:00
Adam Honse cda62b9e0e Fix Linux build 2020-10-25 01:15:42 -05:00
Adam Honse 62145c4548 Add ASUS ROG Gladius II Core 2020-10-25 01:05:20 -05:00
Adam Honse bd15eb022f Add the rest of the EVGA V2 bytes from the capture 2020-10-23 15:26:21 -05:00
Adam Honse f1e74018a3 Add write to 0x08 to EVGA V2 controller 2020-10-23 13:16:01 -05:00
Daniel Dreibrodt cf01a8dc46 Patriot Viper: Limit to one zone, as slots cannot be controlled separately 2020-10-22 15:46:45 -05:00
edbgon b7b2d0c1df Fix detection routine for Logitech G512 (Uses G810) 2020-10-22 15:44:10 -05:00
Adam Honse 0ceb4e1268 Add 0x18A5 Aura Addressable PID 2020-10-21 15:56:02 -05:00
edbgon f6083c8506 Logitech G213 Controller (Merge Request !171)
Commits merged and minor code style changes by Adam Honse <[email protected]>
2020-10-20 23:55:37 -05:00
Adam Honse 9fcc8dd573 Add I2C: label to location string for I2C devices 2020-10-20 23:42:20 -05:00
Adam Honse 5672f556e9 Add additional information from wiki homepage to README - Discord, Reddit, how-tos, donations, contributing history 2020-10-17 18:10:22 +00:00
Adam Honse 167d7ebdc5 Add OpenRGB-python-FX to list of SDK applications 2020-10-17 18:03:06 +00:00
Adam Honse 0b7f4c632a Rework OpenRazer mode inititialization on Windows 2020-10-16 19:59:25 -05:00
Adam Honse 8df9e979da Rework OpenRazer mode setting to get rid of duplicate code 2020-10-16 23:50:07 +00:00
Connor Byrnes da0ff218fa Add support for MSI RTX2070 Gaming X 2020-10-16 17:42:13 +00:00
Adam Honse 165c50689d Use HID path for Location on ASUS Aura USB controller 2020-10-15 17:00:54 -05:00
Bartosz Baranowski af403d5748 Update AuraUSBControllerDetect.cpp
Code modified for cleanup and code style by Adam Honse <[email protected]>
2020-10-15 15:36:47 -05:00
Carson Mathre bfb79e87b0 Update TecknetController.h 2020-10-15 10:03:42 -05:00
Carson Mathre cdb15861ab Update TecknetController.cpp 2020-10-15 10:03:37 -05:00
Carson Mathre a155697393 Update RGBController_Tecknet.cpp 2020-10-15 10:03:30 -05:00
alpemwarrior 54cccaa4a7 Now for real 2020-10-15 09:57:14 -05:00
alpemwarrior 912af1555a Fix initialisation of msi-rgb boards 2020-10-15 09:57:05 -05:00
Adam Honse e3b8ced8ba Update E1.31 controller information, add universe list for location string 2020-10-13 23:39:30 -05:00
Adam Honse 73a1779813 Use device name for E1.31 controller if the controller only contains the one device 2020-10-12 17:03:20 -05:00
Adam Honse e78ad56839 Split E1.31 devices into their own controllers unless they start at the same universe. Need to take universe size into account before feature is complete 2020-10-12 00:48:07 -05:00
Adam Honse b19dfdb010 Fix profile loading 2020-10-09 00:02:57 -05:00
Adam Honse c1c66c37d5 Disable buttons before enabling other buttons, so that window doesn't get resized 2020-10-08 23:20:16 -05:00
Neel Chotai e0f9017982 fix compilation on ppc 2020-10-08 23:08:23 -05:00
Pol Rius 791df64f81 Add support for Sony DualShock 4 (manual merge of !160)
Files pulled in manually and code style changes, Gamepad type addition by Adam Honse <[email protected]>
2020-10-08 17:15:18 -05:00
Adam Honse e52619dbab Move Profile Manager to Resource Manager and rework size loading so that sizes are updated upon redetection 2020-10-08 17:07:39 -05:00
Adam Honse e767b3db90 Split functionality for applying sizes and settings from a temporary controller list to a controller to its own function 2020-10-08 00:35:35 -05:00
Adam Honse da8c06756b Split functionality for loading temporary controllers from a saved profile into its own function 2020-10-08 00:16:37 -05:00
Adam Honse 24de16f77b Keep a separate list of controllers detected from hardware and dynamically add/remove them from the master list when redetecting so client controllers aren't deleted during redetection 2020-10-06 21:20:08 -05:00
Adam Honse 31b6533193 Update OpenRazer-win32 2020-10-05 17:18:29 -05:00
Adam Honse dd29bc9905 Use HID path for Location on SteelSeries Siberia controller 2020-10-05 00:28:59 -05:00
Adam Honse 0e7f2b9fc1 Use HID path for Location on SteelSeries Rival controller 2020-10-05 00:28:37 -05:00
Adam Honse 07dc0ce988 Use HID path for Location on SteelSeries Apex controller 2020-10-05 00:15:16 -05:00
Adam Honse 05c7d49a62 Use HID path for Location on Thermaltake Riing controller 2020-10-05 00:13:11 -05:00
Adam Honse fe8ed09e77 Use HID path for Location on Poseidon Z RGB controller 2020-10-05 00:11:03 -05:00
Adam Honse e4229aae47 Use HID path for Location on NZXT Kraken controller 2020-10-05 00:05:18 -05:00
Adam Honse e82b251bae Use HID path for Location on NZXT Hue 2 controller 2020-10-05 00:03:34 -05:00
TheRogueZeta e678c132bf Add MSI GTX 1660 courtesy of @ry0 2020-10-04 19:10:33 -05:00
Adam Honse acced4d036 Use HID path for Location on MSI 3 Zone controller 2020-10-04 18:38:56 -05:00
Adam Honse 43cea0a1b2 Use HID path for Location on HyperX Mouse controller 2020-10-04 18:14:54 -05:00
Adam Honse 7482363393 Use HID path for Location on Holtek controller 2020-10-04 17:47:41 -05:00
Adam Honse 96da5d5181 Use HID path for Location on Ducky Keyboard controller 2020-10-04 17:26:46 -05:00
Adam Honse 1618de46b9 Use HID path for Location on Corsair Peripheral controller 2020-10-03 17:12:27 -05:00
Adam Honse c8da008b93 Use HID path for Location on Aorus CPU Cooler controller 2020-10-02 21:02:32 -05:00
Adam Honse 4df557391a Use HID path for Location on AMD Wraith Prism controller 2020-10-02 20:56:49 -05:00
Adam Honse 406ebcc789 Use HID path for Location on Corsair Lighting Node controllers 2020-10-02 20:29:17 -05:00
Adam Honse b829bfe538 Use HID path for Location on Redragon controllers 2020-10-02 20:28:38 -05:00
Adam Honse fe74d9ea78 Add B450 AORUS PRO WIFI to RGB Fusion SMBus detection list 2020-10-02 12:55:44 -05:00
Adam Honse 2f08436e95 Use HID path for Location on HyperX Alloy Origins controller 2020-10-02 12:55:23 -05:00
Adam Honse d6350c8504 Use HID path for Location on HyperX Keyboard controller 2020-10-02 12:28:09 -05:00
Adam Honse 158aac5ee4 Remove only device information tabs, leaving other information tabs alone 2020-10-01 23:53:14 -05:00
Adam Honse 9c9dff41c3 Don't clear the entire tab bar, instead add new controller tabs only if missing and sort existing ones, then delete only those that no longer have an associated controller in the controllers list. Disabled software info and i2c tools pages for now 2020-10-01 22:33:54 +00:00
Shawn 86034a9ce5 Clear port_ID just like the remaining items that are updated each loop.
Re-add code to make NVIDIA cards work with the updated device manager.

Commit amended by Adam Honse <[email protected]>
2020-10-01 19:47:58 +00:00
Adam Honse 678e2fbc33 Rename Fn to Right Fn on Alloy Origins 2020-10-01 14:48:15 +00:00
Adam Honse 716b2aaac3 Protect controller list updates with mutex 2020-09-30 22:45:03 -05:00
Adam Honse fde002707a Clear the controller list before deleting the controller objects, same for i2c busses 2020-09-30 21:50:26 -05:00
flappy 0d938da87a Added MSI RTX 3080 10GB Gaming X Trio 2020-09-30 11:03:46 -05:00
Adam Honse 2d06a7fbe9 Update AMD PCI vendor ID on Sapphire GPU controller detection 2020-09-30 11:01:54 -05:00
Adam Honse f3ccaf1a2b Move RGBController files for device controllers into the Controllers directory 2020-09-29 20:54:04 +00:00
Adam Honse 278d6b0d00 Ensure controller still exists before trying to unregister callback 2020-09-28 23:45:41 -05:00
Adam Honse 8ead2f9c73 Call the callbacks when redetection starts, move matrix map deletion to individual controllers to avoid attempting to delete const pointers 2020-09-28 23:22:01 -05:00
Adam Honse 4f43e85139 Don't call the server's device list update function when updating detection progress 2020-09-29 01:38:20 +00:00
Adam Honse 7871b7d76a Implement detection progress callback and device rescan button 2020-09-29 01:16:46 +00:00
Adam Honse c30480af91 Add detection progress callback to avoid unnecessary device list updates 2020-09-28 19:11:47 -05:00
Adam Honse c3b4489fd3 Fix Windows build 2020-09-27 23:19:59 -05:00
Adam Honse 8347644b07 Client clears list and reinitializes controller when the device list updates 2020-09-28 01:29:35 +00:00
Adam Honse 60fd721586 Server sends a request to the client when the device list is updated 2020-09-27 22:12:34 +00:00
Erik Gilling 854bc099f7 Add Corsair Dominator Platinum RGB driver.
Code style changes by Adam Honse <[email protected]>
2020-09-27 03:23:51 +00:00
Adam Honse 19b1a400d9 Remove Qt warning for client disconnect slot 2020-09-26 19:18:28 +00:00
Adam Honse 533bd0c1a0 Linux LED sysfs entries controller 2020-09-26 00:48:11 +00:00
crashniels 88759aaac3 Update Glorious (Sinowealth) driver (Merge request !155)
Manually merged by Adam Honse <[email protected]>
2020-09-22 23:03:07 -05:00
Adam Honse 5fb3d83706 Update NZXT Hue 2 accessory list 2020-09-22 16:39:47 -05:00
Adam Honse 0fb2b08818 Print out NZXT Hue 2 device codes 2020-09-22 16:28:20 -05:00
Adam Honse b66e3347ea Add NZXT Kraken X3 to Hue 2 controller 2020-09-22 15:49:22 -05:00
Adam Honse 1354864038 Get master building on MacOS 2020-09-22 13:24:08 -07:00
Adam Honse 55bf28d4c3 Clean up some more reference passing related to server and clients and use the Resource Manager instead 2020-09-22 12:37:41 -05:00
Adam Honse 128bfc7792 Move network clients to Resource Manager 2020-09-22 12:17:54 -05:00
Adam Honse c1ac870035 Move network server to resource manager 2020-09-21 00:34:41 -05:00
TheRogueZeta 90e6ba88f1 Add EVGA RTX2070 XC OC from discord 2020-09-20 15:20:35 -05:00
Adam Honse b31a37e860 Make sure PCI ID variables are cleared before each bus initialization and don't break out of bus detection when PCI ID is zero 2020-09-14 20:12:31 -05:00
Adam Honse f2fd3c92ea Check for vendor == 0 for Nuvoton bus and add macro for motherboard SMBus checking 2020-09-14 19:55:58 -05:00
Adam Honse 9b2315234f Add Intel vendor ID to DRAM SMBus check 2020-09-14 19:29:28 -05:00
Adam Honse d41e817253 Add PCI IDs to AMD SMBus (PIIX4) detection on Windows 2020-09-14 00:21:27 -05:00
Adam Honse 29fea380aa Check PCI IDs for scanning SMBus devices to speed up detection 2020-09-13 23:59:41 -05:00
Adam Honse 2d53a2c7f1 Add EVGA v2 controller for RTX2080 XC GAMING, only supports Off and Direct mode for now 2020-09-13 20:12:50 -05:00
Adam Honse 62488cbc1e Rename EVGAGPU to EVGAGPUv1 before writing a controller for EVGA RGB V2 2020-09-13 19:43:07 -05:00
Adam Honse 651252b08c Add SteelSeries Apex Pro TKL ID 2020-09-13 15:27:48 -05:00
Adam Honse ed821cfac8 Update custom mode index for EVGA GPU controller 2020-09-13 14:26:09 -05:00
Adam Honse 3a32b4064f Don't try to call AMD ADL calls if DLL did not load 2020-09-13 13:39:44 -05:00
Adam Honse 12fbed760a Add PCI ID based detection for EVGA GPUs and add EVGA GTX1070 FTW to detection list 2020-09-13 13:34:39 -05:00
Adam Honse 973dce9d80 Fill in PCI information for all i2c interfaces on Linux 2020-09-12 03:06:00 -05:00
Adam Honse 1bd3c2ce49 Parse PCI information from AMD display library on Windows 2020-09-12 02:06:04 -05:00
Adam Honse cf6a4c5647 Update Sapphire GPU controller to use PCI IDs 2020-09-11 23:23:33 -05:00
Adam Honse f17cdea5b6 Initial controller code for EVGA GPUs. No detection implemented yet. 2020-09-11 23:04:52 -05:00
Stefan Frijters f1b7b8ba90 Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
2020-09-11 22:18:07 -05:00
Adam Honse 128cf7a533 Included in wrong file 2020-09-11 16:33:48 -05:00
Adam Honse 0c03632b7b Espurna fixes for Linux build 2020-09-11 16:22:48 -05:00
Adam Honse 312d068021 Add controller for Espurna HTTP API 2020-09-11 15:58:58 -05:00
Pol Rius db64cd66a1 Invert colors depending on the boards DMI (For MSI RGB boards)
Commits in pull request !147 squashed and minor code style changes by Adam Honse <[email protected]>
2020-09-10 12:16:46 -05:00
TheRogueZeta 6ff72d58c8 Update max number of leds per #579 2020-09-10 12:08:09 -05:00
Adam Honse e9231c8b4b Update README 2020-09-10 12:07:37 -05:00
Adam Honse 8b5fcf1db0 Increment version number post-release 2020-09-09 01:31:03 -05:00
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
422 changed files with 48416 additions and 6887 deletions
+22 -6
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: 30 days
#-----------------------------------------------------------------------#
# Linux (AppImage) 64-bit Build Target #
#-----------------------------------------------------------------------#
build_linux_64:
image: ubuntu:bionic
stage: build
script:
@@ -34,8 +50,8 @@ build_linux:
artifacts:
paths:
- OpenRGB-x86_64.AppImage
expire_in: 1337 years
expire_in: 30 days
#-----------------------------------------------------------------------#
# Windows (32-bit) Build Target #
#-----------------------------------------------------------------------#
@@ -106,7 +122,7 @@ build_windows_32:
artifacts:
paths:
- _build/*.7z
expire_in: 1337 years
expire_in: 30 days
#-----------------------------------------------------------------------#
# Windows (64-bit) Build Target #
@@ -178,4 +194,4 @@ build_windows_64:
artifacts:
paths:
- _build/*.7z
expire_in: 1337 years
expire_in: 30 days
+14
View File
@@ -0,0 +1,14 @@
<!--
Found a bug? Something isn't working as expected? To help us keep track of the requests please start the title with [Bug Report]
-->
### Description of Bug
<!--
Please describe the bug. Explain steps taken to reproduct the bug and what you expect the correct behavior to be.
-->
### Hardware Configuration
<!--
Please list the RGB hardware that you are using with OpenRGB. If your bug does not relate to any one particular device or device type, or if the bug is in a part of the code not directly interacting with hardware, this is optional.
-->
@@ -0,0 +1,9 @@
<!--
Have something you would like to see added to OpenRGB? Let us know here
To help us keep track of the requests please start the title with [Feature Request]
-->
### Feature Request
<!--
Please explain the new feature you would like to see added in detail. Explain how you think it should work and provide any mock-ups, code snippets, etc. that you think will help explain the feature.
-->
+46
View File
@@ -0,0 +1,46 @@
<!--
When naming the support request please title the request as
`[New Device] <Name of new device>`
Please open one issue per device you would lke to add
-->
### Name of device:
<!--
Please put the name of the product, including manufacturer, beneath this line
-->
### Link to manufacturer's product page:
<!--
Please link us to the manufacturer's product page beneath this line
-->
### Please select what type of device/interface the device uses:
- [ ] Motherboard (SMBus)
- [ ] Motherboard (USB)
- [ ] RAM (SMBus)
- [ ] GPU (I2C)
- [ ] External USB (Peripheral, lighting controller, etc)
- [ ] Internal USB (lighting controller, cooler, fan hub, etc)
- [ ] I don't know (we can help you determine this)
### ID information:
<!--
For PCI (GPU) devices we will need the Vendor ID, Device ID, Sub-Vendor ID and Sub-Device IDs
In Windows this can be found under the device manager and on Linux this can be found wit lspci -vv
For USB devices we will need the USB VID and PID
-->
### Please attach screenshots of the device's official control application here:
<!--
Screenshots of the official control software should show lists of supported modes, color selection, and zone/LED selection capabilities of the device's official software.
-->
### Please attach device captures here:
<!--
For information on how to capture device packets please see https://gitlab.com/Dr_No/OpenRGB/-/wikis/OpenRGB-doesn%27t-have-my-device
-->
+47
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 #
@@ -224,6 +261,16 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc39", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="8297", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="5702", TAG+="uaccess"
#---------------------------------------------------------------#
# Sinowealth USB #
# Glorious Model O / O- #
# Glorious Model D / D- #
# Everest GT-100 RGB #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="0036", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="0033", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="0029", TAG+="uaccess"
#---------------------------------------------------------------#
# SteelSeries Peripheral Devices #
# #
@@ -12,9 +12,10 @@
#include <stdio.h>
#include <stdlib.h>
AMDWraithPrismController::AMDWraithPrismController(hid_device* dev_handle)
AMDWraithPrismController::AMDWraithPrismController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
strcpy(device_name, "AMD Wraith Prism");
@@ -38,6 +39,11 @@ AMDWraithPrismController::~AMDWraithPrismController()
}
std::string AMDWraithPrismController::GetLocationString()
{
return(location);
}
char* AMDWraithPrismController::GetDeviceName()
{
return device_name;
@@ -109,13 +109,14 @@ enum
class AMDWraithPrismController
{
public:
AMDWraithPrismController(hid_device* dev_handle);
AMDWraithPrismController(hid_device* dev_handle, const char* path);
~AMDWraithPrismController();
char* GetDeviceName();
std::string GetEffectChannelString(unsigned char channel);
std::string GetFirmwareVersionString();
std::string GetLocationString();
void SetRingEffectChannel(unsigned char channel);
@@ -131,6 +132,7 @@ public:
private:
char device_name[32];
hid_device* dev;
std::string location;
unsigned char current_fan_mode;
unsigned char current_fan_speed;
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AMDWraithPrismController.h"
#include "RGBController.h"
#include "RGBController_AMDWraithPrism.h"
@@ -39,7 +40,7 @@ void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controller
if( dev )
{
AMDWraithPrismController* controller = new AMDWraithPrismController(dev);
AMDWraithPrismController* controller = new AMDWraithPrismController(dev, info->path);
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
@@ -49,3 +50,5 @@ void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controller
info = info->next;
}
}
REGISTER_DETECTOR("AMD Wraith Prism", DetectAMDWraithPrismControllers);
@@ -17,13 +17,14 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
type = DEVICE_TYPE_COOLER;
description = "AMD Wraith Prism Device";
version = wraith->GetFirmwareVersionString();
location = wraith->GetLocationString();
mode Static;
Static.name = "Static";
Static.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Direct;
Direct.name = "Direct";
Direct.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
@@ -0,0 +1,122 @@
/*-----------------------------------------*\
| ATC800Controller.cpp |
| |
| Driver for Aorus ATC800 CPU Cooler |
| |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "ATC800Controller.h"
#include <cstring>
ATC800Controller::ATC800Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
ATC800Controller::~ATC800Controller()
{
hid_close(dev);
}
std::string ATC800Controller::GetDeviceLocation()
{
return(location);
}
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,62 @@
/*-----------------------------------------*\
| 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, const char* path);
~ATC800Controller();
std::string GetDeviceLocation();
void SendCoolerMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
std::string location;
};
@@ -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, info->path);
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);
@@ -0,0 +1,143 @@
/*-----------------------------------------*\
| RGBController_AorusATC800.cpp |
| |
| Generic RGB Interface Aorus ATC800 CPU |
| Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "RGBController_AorusATC800.h"
RGBController_AorusATC800::RGBController_AorusATC800(ATC800Controller* cooler_ptr)
{
cooler = cooler_ptr;
name = "Aorus ATC800 CPU Cooler";
type = DEVICE_TYPE_COOLER;
description = "Aorus ATC800 CPU Cooler";
location = cooler->GetDeviceLocation();
mode Static;
Static.name = "Static";
Static.value = AORUS_ATC800_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = AORUS_ATC800_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AORUS_ATC800_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Flashing.color_mode = MODE_COLORS_PER_LED;
Flashing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
Flashing.speed_max = AORUS_ATC800_SPEED_FASTEST;
Flashing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(Flashing);
mode DoubleFlashing;
DoubleFlashing.name = "Double Flashing";
DoubleFlashing.value = AORUS_ATC800_MODE_DOUBLE_FLASH;
DoubleFlashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
DoubleFlashing.color_mode = MODE_COLORS_PER_LED;
DoubleFlashing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
DoubleFlashing.speed_max = AORUS_ATC800_SPEED_FASTEST;
DoubleFlashing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(DoubleFlashing);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = AORUS_ATC800_MODE_PULSE;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Pulsing.color_mode = MODE_COLORS_PER_LED;
Pulsing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
Pulsing.speed_max = AORUS_ATC800_SPEED_FASTEST;
Pulsing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(Pulsing);
SetupZones();
}
void RGBController_AorusATC800::SetupZones()
{
zone atc800_cpu_fans_zone;
atc800_cpu_fans_zone.name = "Fan";
atc800_cpu_fans_zone.type = ZONE_TYPE_SINGLE;
atc800_cpu_fans_zone.leds_min = 1;
atc800_cpu_fans_zone.leds_max = 1;
atc800_cpu_fans_zone.leds_count = 1;
atc800_cpu_fans_zone.matrix_map = NULL;
zones.push_back(atc800_cpu_fans_zone);
led atc800_fan_led;
atc800_fan_led.name = "Fan";
leds.push_back(atc800_fan_led);
zone atc800_top_zone;
atc800_top_zone.name = "Top";
atc800_top_zone.type = ZONE_TYPE_SINGLE;
atc800_top_zone.leds_min = 1;
atc800_top_zone.leds_max = 1;
atc800_top_zone.leds_count = 1;
atc800_top_zone.matrix_map = NULL;
zones.push_back(atc800_top_zone);
led atc800_top_led;
atc800_top_led.name = "Top";
leds.push_back(atc800_top_led);
SetupColors();
}
void RGBController_AorusATC800::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AorusATC800::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_AorusATC800::UpdateZoneLEDs(int zone)
{
unsigned char mode = modes[active_mode].value;
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
if (mode == AORUS_ATC800_MODE_OFF)
{
mode = 1;
red = 0;
grn = 0;
blu = 0;
}
cooler->SendCoolerMode(mode, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_AorusATC800::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_AorusATC800::SetCustomMode()
{
}
void RGBController_AorusATC800::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
@@ -0,0 +1,32 @@
/*-----------------------------------------*\
| RGBController_AorusATC800.h |
| |
| Generic RGB Interface for Aorus ATC 800 |
| CPU Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "ATC800Controller.h"
class RGBController_AorusATC800 : public RGBController
{
public:
RGBController_AorusATC800(ATC800Controller* logitech_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
ATC800Controller* cooler;
};
@@ -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);
@@ -51,7 +51,7 @@ void RGBController_AuraCore::SetupZones()
Keyboard.matrix_map = NULL;
zones.push_back(Keyboard);
for(int led_idx = 0; led_idx < Keyboard.leds_count; led_idx++)
for(unsigned int led_idx = 0; led_idx < Keyboard.leds_count; led_idx++)
{
led KeyLED;
KeyLED.name = "Keyboard LED ";
@@ -76,7 +76,7 @@ void RGBController_AuraCore::DeviceUpdateLEDs()
void RGBController_AuraCore::UpdateZoneLEDs(int /*zone*/)
{
for(int led_idx = 0; led_idx < leds.size(); led_idx++)
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
{
UpdateSingleLED(led_idx);
}
@@ -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
{
@@ -94,7 +116,7 @@ std::string AuraSMBusController::GetDeviceLocation()
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
return("I2C: " + return_string);
}
unsigned char AuraSMBusController::GetChannel(unsigned int led)
@@ -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,7 +1,9 @@
#include "Detector.h"
#include "AuraSMBusController.h"
#include "RGBController.h"
#include "RGBController_AuraSMBus.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
@@ -129,62 +131,70 @@ void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::
{
int address_list_idx = -1;
// Remap Aura-enabled RAM modules on 0x77
for (unsigned int slot = 0; slot < 8; slot++)
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
int res = busses[bus]->i2c_smbus_write_quick(0x77, I2C_SMBUS_WRITE);
if (res < 0)
// Remap Aura-enabled RAM modules on 0x77
for (unsigned int slot = 0; slot < 8; slot++)
{
break;
}
int res = busses[bus]->i2c_smbus_write_quick(0x77, I2C_SMBUS_WRITE);
do
{
address_list_idx++;
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
{
res = busses[bus]->i2c_smbus_write_quick(aura_ram_addresses[address_list_idx], I2C_SMBUS_WRITE);
}
else
if (res < 0)
{
break;
}
} while (res >= 0);
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
{
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_SLOT_INDEX, slot);
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_I2C_ADDRESS, (aura_ram_addresses[address_list_idx] << 1));
}
}
do
{
address_list_idx++;
// Add Aura-enabled controllers at their remapped addresses
for (unsigned int address_list_idx = 0; address_list_idx < AURA_RAM_ADDRESS_COUNT; address_list_idx++)
{
if (TestForAuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]))
{
new_aura = new AuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]);
new_controller = new RGBController_AuraSMBus(new_aura);
rgb_controllers.push_back(new_controller);
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
{
res = busses[bus]->i2c_smbus_write_quick(aura_ram_addresses[address_list_idx], I2C_SMBUS_WRITE);
}
else
{
break;
}
} while (res >= 0);
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
{
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_SLOT_INDEX, slot);
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_I2C_ADDRESS, (aura_ram_addresses[address_list_idx] << 1));
}
}
std::this_thread::sleep_for(1ms);
// Add Aura-enabled controllers at their remapped addresses
for (unsigned int address_list_idx = 0; address_list_idx < AURA_RAM_ADDRESS_COUNT; address_list_idx++)
{
if (TestForAuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]))
{
new_aura = new AuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]);
new_controller = new RGBController_AuraSMBus(new_aura);
rgb_controllers.push_back(new_controller);
}
std::this_thread::sleep_for(1ms);
}
}
// Add Aura-enabled motherboard controllers
for (unsigned int address_list_idx = 0; address_list_idx < AURA_MOBO_ADDRESS_COUNT; address_list_idx++)
IF_MOBO_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
if (TestForAuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]))
for (unsigned int address_list_idx = 0; address_list_idx < AURA_MOBO_ADDRESS_COUNT; address_list_idx++)
{
new_aura = new AuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]);
new_controller = new RGBController_AuraSMBus(new_aura);
rgb_controllers.push_back(new_controller);
}
if (TestForAuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]))
{
new_aura = new AuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]);
new_controller = new RGBController_AuraSMBus(new_aura);
rgb_controllers.push_back(new_controller);
}
std::this_thread::sleep_for(1ms);
std::this_thread::sleep_for(1ms);
}
}
}
} /* DetectAuraSMBusControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAuraSMBusControllers);
@@ -207,6 +207,11 @@ RGBController_AuraSMBus::RGBController_AuraSMBus(AuraSMBusController * aura_ptr)
active_mode = GetDeviceMode();
}
RGBController_AuraSMBus::~RGBController_AuraSMBus()
{
delete aura;
}
void RGBController_AuraSMBus::SetupZones()
{
std::vector<int> aura_led_map;
@@ -16,6 +16,7 @@ class RGBController_AuraSMBus : public RGBController
{
public:
RGBController_AuraSMBus(AuraSMBusController* aura_ptr);
~RGBController_AuraSMBus();
void SetupZones();
@@ -10,7 +10,7 @@
#include "AuraAddressableController.h"
#include <cstring>
AuraAddressableController::AuraAddressableController(hid_device* dev_handle) : AuraUSBController(dev_handle)
AuraAddressableController::AuraAddressableController(hid_device* dev_handle, const char* path) : AuraUSBController(dev_handle, path)
{
/*-----------------------------------------------------*\
| Add addressable devices |
@@ -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]);
@@ -23,7 +23,7 @@ enum
class AuraAddressableController : public AuraUSBController
{
public:
AuraAddressableController(hid_device* dev_handle);
AuraAddressableController(hid_device* dev_handle, const char* path);
~AuraAddressableController();
void SetChannelLEDs
@@ -10,7 +10,7 @@
#include "AuraMainboardController.h"
#include <cstring>
AuraMainboardController::AuraMainboardController(hid_device* dev_handle) : AuraUSBController(dev_handle), mode(AURA_MODE_DIRECT)
AuraMainboardController::AuraMainboardController(hid_device* dev_handle, const char* path) : AuraUSBController(dev_handle, path), mode(AURA_MODE_DIRECT)
{
/*-----------------------------------------------------*\
| Add mainboard device |
@@ -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]);
@@ -25,7 +25,7 @@ enum
class AuraMainboardController : public AuraUSBController
{
public:
AuraMainboardController(hid_device* dev_handle);
AuraMainboardController(hid_device* dev_handle, const char* path);
~AuraMainboardController();
void SetChannelLEDs
@@ -0,0 +1,64 @@
/*-----------------------------------------*\
| AuraMouseController.cpp |
| |
| Driver for ASUS Aura RGB USB |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 10/23/2020 |
\*-----------------------------------------*/
#include "AuraMouseController.h"
#include <cstring>
AuraMouseController::AuraMouseController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
AuraMouseController::~AuraMouseController()
{
}
std::string AuraMouseController::GetDeviceLocation()
{
return(location);
}
void AuraMouseController::SendUpdate
(
unsigned char zone,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
)
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x51;
usb_buf[0x02] = 0x28;
usb_buf[0x03] = zone;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = mode;
usb_buf[0x06] = 0x04;
usb_buf[0x07] = red;
usb_buf[0x08] = grn;
usb_buf[0x09] = blu;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
@@ -0,0 +1,54 @@
/*-----------------------------------------*\
| AuraMouseController.h |
| |
| Definitions and types for ASUS Aura |
| USB RGB lighting controller |
| |
| Adam Honse (CalcProgrammer1) 10/23/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <vector>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AURA_MOUSE_ZONE_LOGO = 0,
AURA_MOUSE_ZONE_SCROLL = 1,
AURA_MOUSE_ZONE_UNDERGLOW = 2,
AURA_MOUSE_ZONE_ALL = 3,
};
enum
{
AURA_MOUSE_MODE_STATIC = 0,
AURA_MOUSE_MODE_BREATHING = 1,
AURA_MOUSE_MODE_COLOR_CYCLE = 2,
AURA_MOUSE_MODE_REACTIVE = 3,
};
class AuraMouseController
{
public:
AuraMouseController(hid_device* dev_handle, const char* path);
virtual ~AuraMouseController();
std::string GetDeviceLocation();
void SendUpdate
(
unsigned char zone,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
);
private:
hid_device* dev;
std::string location;
};
@@ -11,9 +11,10 @@
#include <cstring>
#include <stdexcept>
AuraUSBController::AuraUSBController(hid_device* dev_handle)
AuraUSBController::AuraUSBController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
GetFirmwareVersion();
GetConfigTable();
@@ -29,6 +30,11 @@ unsigned int AuraUSBController::GetChannelCount()
return(device_info.size());
}
std::string AuraUSBController::GetDeviceLocation()
{
return(location);
}
std::string AuraUSBController::GetDeviceName()
{
return(device_name);
@@ -59,11 +59,12 @@ struct AuraDeviceInfo
class AuraUSBController
{
public:
AuraUSBController(hid_device* dev_handle);
AuraUSBController(hid_device* dev_handle, const char* path);
virtual ~AuraUSBController();
unsigned int GetChannelCount();
std::string GetDeviceLocation();
std::string GetDeviceName();
const std::vector<AuraDeviceInfo>& GetAuraDevices() const;
@@ -88,6 +89,7 @@ protected:
hid_device* dev;
unsigned char config_table[60];
std::vector<AuraDeviceInfo> device_info;
std::string location;
void SendDirect
(
@@ -1,77 +1,170 @@
#include "Detector.h"
#include "AuraAddressableController.h"
#include "AuraMainboardController.h"
#include "AuraMouseController.h"
#include "RGBController.h"
#include "RGBController_AuraUSB.h"
#include "RGBController_AuraMouse.h"
#include <vector>
#include <stdexcept>
#include <hidapi/hidapi.h>
#define AURA_USB_VID 0x0B05
#define AURA_USB_VID 0x0B05
#define AURA_TERMINAL_PID 0x1889
#define AURA_ADDRESSABLE_1_PID 0x1867
#define AURA_ADDRESSABLE_2_PID 0x1872
#define AURA_ADDRESSABLE_3_PID 0x18A3
#define AURA_ADDRESSABLE_4_PID 0x18A5
#define AURA_MOTHERBOARD_1_PID 0x18F3
#define AURA_MOTHERBOARD_2_PID 0x1939
#define AURA_ROG_GLADIUS_II_CORE_PID 0x18DD
#define AURA_ROG_GLADIUS_II_PID 0x1845
#define AURA_ROG_GLADIUS_II_ORIGIN_PID 0x1877
#define NUM_ADDRESSABLE_PIDS 4
static const unsigned short addressable_pid_table[] =
{
0x1867,
0x1872,
0x1889,
0x18A3
};
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned short usb_interface;
const char * name;
} aura_device;
#define NUM_MAINBOARD_PIDS 2
static const unsigned short mainboard_pid_table[] =
{
0x18f3,
0x1939
};
#define ADDRESSABLE_NUM_DEVICES (sizeof(addressable_device_list) / sizeof(addressable_device_list[ 0 ]))
/******************************************************************************************\
* *
* DetectAuraUSBControllers *
* *
* Tests the USB address to see if an Asus Aura USB RGB header controller *
* exists there. *
* *
\******************************************************************************************/
static const aura_device addressable_device_list[] =
{
/*---------------------------------------------------------------------------------*\
| ASUS AURA Addressable |
\*---------------------------------------------------------------------------------*/
{ AURA_USB_VID, AURA_TERMINAL_PID, 0, "ASUS ROG AURA Terminal" },
{ AURA_USB_VID, AURA_ADDRESSABLE_1_PID, 0, "ASUS Aura Addressable" },
{ AURA_USB_VID, AURA_ADDRESSABLE_2_PID, 0, "ASUS Aura Addressable" },
{ AURA_USB_VID, AURA_ADDRESSABLE_3_PID, 0, "ASUS Aura Addressable" },
{ AURA_USB_VID, AURA_ADDRESSABLE_4_PID, 0, "ASUS Aura Addressable" },
};
#define MOTHERBOARD_NUM_DEVICES (sizeof(motherboard_device_list) / sizeof(motherboard_device_list[ 0 ]))
static const aura_device motherboard_device_list[] =
{
/*---------------------------------------------------------------------------------*\
| ASUS AURA Motherboard |
\*---------------------------------------------------------------------------------*/
{ AURA_USB_VID, AURA_MOTHERBOARD_1_PID, 0, "ASUS Aura Motherboard" },
{ AURA_USB_VID, AURA_MOTHERBOARD_2_PID, 0, "ASUS Aura Motherboard" },
};
#define MOUSE_NUM_DEVICES (sizeof(mouse_device_list) / sizeof(mouse_device_list[ 0 ]))
static const aura_device mouse_device_list[] =
{
{ AURA_USB_VID, AURA_ROG_GLADIUS_II_CORE_PID, 0, "ASUS ROG Gladius II Core" },
{ AURA_USB_VID, AURA_ROG_GLADIUS_II_PID, 2, "ASUS ROG Gladius II" },
{ AURA_USB_VID, AURA_ROG_GLADIUS_II_ORIGIN_PID, 2, "ASUS ROG Gladius II Origin" },
};
void DetectAuraUSBControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device* dev;
hid_device_info* info = NULL;
//Look for Asus Aura addressable RGB header controller
hid_init();
for(int pid_idx = 0; pid_idx < NUM_ADDRESSABLE_PIDS; pid_idx++)
/*ASUS AURA Addressable*/
for(unsigned int pid_idx = 0; pid_idx < ADDRESSABLE_NUM_DEVICES; pid_idx++)
{
dev = hid_open(AURA_USB_VID, addressable_pid_table[pid_idx], 0);
info = hid_enumerate(addressable_device_list[pid_idx].usb_vid, addressable_device_list[pid_idx].usb_pid);
if( dev )
while(info)
{
AuraAddressableController* controller = new AuraAddressableController(dev);
hid_device* dev = NULL;
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
if((info->vendor_id == addressable_device_list[pid_idx].usb_vid)
&&(info->product_id == addressable_device_list[pid_idx].usb_pid))
{
dev = hid_open_path(info->path);
rgb_controllers.push_back(rgb_controller);
if(dev)
{
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
rgb_controller->name = addressable_device_list[pid_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
}
}
for(int pid_idx = 0; pid_idx < NUM_MAINBOARD_PIDS; pid_idx++)
info = NULL;
/*ASUS AURA Motherboard*/
for(unsigned int pid_idx = 0; pid_idx < MOTHERBOARD_NUM_DEVICES; pid_idx++)
{
dev = hid_open(AURA_USB_VID, mainboard_pid_table[pid_idx], 0);
info = hid_enumerate(motherboard_device_list[pid_idx].usb_vid, motherboard_device_list[pid_idx].usb_pid);
if( dev )
while(info)
{
try
{
AuraMainboardController* controller = new AuraMainboardController(dev);
hid_device* dev = NULL;
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
rgb_controllers.push_back(rgb_controller);
}
catch(std::runtime_error&)
if((info->vendor_id == motherboard_device_list[pid_idx].usb_vid)
&&(info->product_id == motherboard_device_list[pid_idx].usb_pid))
{
// reading the config table failed
dev = hid_open_path(info->path);
if(dev)
{
try
{
AuraMainboardController* controller = new AuraMainboardController(dev, info->path);
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
rgb_controller->name = motherboard_device_list[pid_idx].name;
rgb_controllers.push_back(rgb_controller);
}
catch(std::runtime_error&)
{
// reading the config table failed
}
}
}
info = info->next;
}
}
}
/*ASUS AURA Mouse*/
for(unsigned int pid_idx = 0; pid_idx < MOUSE_NUM_DEVICES; pid_idx++)
{
info = hid_enumerate(mouse_device_list[pid_idx].usb_vid, mouse_device_list[pid_idx].usb_pid);
while(info)
{
hid_device* dev = NULL;
if((info->vendor_id == mouse_device_list[pid_idx].usb_vid)
&&(info->product_id == mouse_device_list[pid_idx].usb_pid)
#ifdef USE_HID_USAGE
&&(info->interface_number == mouse_device_list[pid_idx].usb_interface )
&&(info->usage_page == 0xFF01))
#else
&&(info->interface_number == mouse_device_list[pid_idx].usb_interface ))
#endif
{
dev = hid_open_path(info->path);
if(dev)
{
AuraMouseController* controller = new AuraMouseController(dev, info->path);
RGBController_AuraMouse* rgb_controller = new RGBController_AuraMouse(controller);
rgb_controller->name = mouse_device_list[pid_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
}
}
} /* DetectAuraUSBControllers() */
REGISTER_DETECTOR("ASUS Aura USB", DetectAuraUSBControllers);
@@ -0,0 +1,202 @@
/*-----------------------------------------*\
| RGBController_AuraMouse.cpp |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Adam Honse (CalcProgrammer1) 10/25/2020 |
\*-----------------------------------------*/
#include "RGBController_AuraMouse.h"
RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* aura_ptr)
{
aura = aura_ptr;
name = "ASUS Aura Mouse";
type = DEVICE_TYPE_MOUSE;
description = "ASUS Aura Mouse Device";
location = aura->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = AURA_MOUSE_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_MOUSE_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = AURA_MOUSE_MODE_COLOR_CYCLE;
SpectrumCycle.flags = 0;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = AURA_MOUSE_MODE_REACTIVE;
Reactive.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Reactive.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Reactive);
SetupZones();
}
RGBController_AuraMouse::~RGBController_AuraMouse()
{
}
void RGBController_AuraMouse::SetupZones()
{
zone logo_zone;
logo_zone.name = "Logo";
logo_zone.type = ZONE_TYPE_SINGLE;
logo_zone.leds_min = 1;
logo_zone.leds_max = 1;
logo_zone.leds_count = 1;
logo_zone.matrix_map = NULL;
zones.push_back(logo_zone);
led logo_led;
logo_led.name = "Logo";
leds.push_back(logo_led);
zone scroll_zone;
scroll_zone.name = "Scroll Wheel";
scroll_zone.type = ZONE_TYPE_SINGLE;
scroll_zone.leds_min = 1;
scroll_zone.leds_max = 1;
scroll_zone.leds_count = 1;
scroll_zone.matrix_map = NULL;
zones.push_back(scroll_zone);
led scroll_led;
scroll_led.name = "Scroll Wheel";
leds.push_back(scroll_led);
zone underglow_zone;
underglow_zone.name = "Underglow";
underglow_zone.type = ZONE_TYPE_SINGLE;
underglow_zone.leds_min = 1;
underglow_zone.leds_max = 1;
underglow_zone.leds_count = 1;
underglow_zone.matrix_map = NULL;
zones.push_back(underglow_zone);
led underglow_led;
underglow_led.name = "Underglow";
leds.push_back(underglow_led);
SetupColors();
}
void RGBController_AuraMouse::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_AuraMouse::DeviceUpdateLEDs()
{
DeviceUpdateMode();
}
void RGBController_AuraMouse::UpdateZoneLEDs(int zone)
{
UpdateSingleLED(zone);
}
void RGBController_AuraMouse::UpdateSingleLED(int led)
{
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
{
if(led == 0)
{
red = RGBGetRValue(colors[led]);
grn = RGBGetGValue(colors[led]);
blu = RGBGetBValue(colors[led]);
aura->SendUpdate(AURA_MOUSE_ZONE_LOGO, modes[active_mode].value, red, grn, blu);
}
else if(led == 1)
{
red = RGBGetRValue(colors[led]);
grn = RGBGetGValue(colors[led]);
blu = RGBGetBValue(colors[led]);
aura->SendUpdate(AURA_MOUSE_ZONE_SCROLL, modes[active_mode].value, red, grn, blu);
}
else
{
red = RGBGetRValue(colors[led]);
grn = RGBGetGValue(colors[led]);
blu = RGBGetBValue(colors[led]);
aura->SendUpdate(AURA_MOUSE_ZONE_UNDERGLOW, modes[active_mode].value, red, grn, blu);
}
}
else
{
aura->SendUpdate(AURA_MOUSE_ZONE_ALL, modes[active_mode].value, red, grn, blu);
}
}
void RGBController_AuraMouse::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraMouse::DeviceUpdateMode()
{
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
{
red = RGBGetRValue(colors[0]);
grn = RGBGetGValue(colors[0]);
blu = RGBGetBValue(colors[0]);
aura->SendUpdate(AURA_MOUSE_ZONE_LOGO, modes[active_mode].value, red, grn, blu);
red = RGBGetRValue(colors[1]);
grn = RGBGetGValue(colors[1]);
blu = RGBGetBValue(colors[1]);
aura->SendUpdate(AURA_MOUSE_ZONE_SCROLL, modes[active_mode].value, red, grn, blu);
red = RGBGetRValue(colors[2]);
grn = RGBGetGValue(colors[2]);
blu = RGBGetBValue(colors[2]);
aura->SendUpdate(AURA_MOUSE_ZONE_UNDERGLOW, modes[active_mode].value, red, grn, blu);
}
else
{
aura->SendUpdate(AURA_MOUSE_ZONE_ALL, modes[active_mode].value, red, grn, blu);
}
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| RGBController_AuraMouse.h |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Adam Honse (CalcProgrammer1) 10/25/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AuraMouseController.h"
class RGBController_AuraMouse : public RGBController
{
public:
RGBController_AuraMouse(AuraMouseController* aura_ptr);
~RGBController_AuraMouse();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AuraMouseController* aura;
};
@@ -17,6 +17,7 @@ RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr)
version = aura->GetDeviceName();
type = DEVICE_TYPE_MOTHERBOARD;
description = "ASUS Aura USB Device";
location = aura->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
@@ -0,0 +1,283 @@
/*-------------------------------------------------------------------*\
| CMARGBController.cpp |
| |
| Driver for Coolermaster ARGB USB Controller |
| |
| Chris M (Dr_No) 10th Oct 2020 |
| |
\*-------------------------------------------------------------------*/
#include "CMARGBcontroller.h"
#include <cstring>
static unsigned char argb_colour_index_data[2][2][2] =
{ //B0 B1
{ { 0x00, 0x03 }, //G0 R0
{ 0x02, 0x06 }, }, //G1 R0
{ { 0x01, 0x05 }, //G0 R1
{ 0x04, 0x07 }, } //G1 R1
};
static unsigned char argb_mode_data[2][9] =
{
{ 0x05, 0x01, 0x02, 0x03, 0x04, 0x01, 0x01, 0x01, 0x01 }, //12v RGB Mode values
{ 0x0A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08, 0x09 } //5v ARGB Mode values
};
CMARGBController::CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx)
{
const int szTemp = 256;
wchar_t tmpName[szTemp];
dev = dev_handle;
location = _path;
zone_index = _zone_idx;
current_speed = CM_ARGB_SPEED_NORMAL;
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());
GetStatus();
}
CMARGBController::~CMARGBController()
{
hid_close(dev);
}
void CMARGBController::GetStatus()
{
unsigned char buffer[0x40] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
int header = zone_index - 1;
/*buffer[CM_ARGB_REPORT_BYTE] = 0x80;
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
hid_write(dev, buffer, buffer_size);
buffer[CM_ARGB_COMMAND_BYTE] = 0x0b;
buffer[CM_ARGB_FUNCTION_BYTE] = 0x03;
buffer[CM_ARGB_ZONE_BYTE] = 0xFF;
hid_write(dev, buffer, buffer_size);
int i = 0;
do{
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
i++;
}while( (i < 4) );
current_mode = argb_mode_data[1][buffer[4]];
current_speed = buffer[5];*/
}
std::string CMARGBController::GetDeviceName()
{
return device_name;
}
std::string CMARGBController::GetSerial()
{
return serial;
}
std::string CMARGBController::GetLocation()
{
return location;
}
unsigned char CMARGBController::GetZoneIndex()
{
return zone_index;
}
unsigned char CMARGBController::GetMode()
{
return current_mode;
}
unsigned char CMARGBController::GetLedRed()
{
return current_red;
}
unsigned char CMARGBController::GetLedGreen()
{
return current_green;
}
unsigned char CMARGBController::GetLedBlue()
{
return current_blue;
}
unsigned char CMARGBController::GetLedSpeed()
{
return current_speed;
}
unsigned int CMARGBController::GetLargestColour(unsigned int red, unsigned int green, unsigned int blue)
{
unsigned int largest;
if ( red > green )
{
( red > blue ) ? largest = red : largest = blue;
}
else
{
( green > blue ) ? largest = green : largest = blue;
}
return (largest == 0) ? 1 : largest;
}
unsigned char CMARGBController::GetColourIndex(unsigned char red, unsigned char green, unsigned char blue)
{
//The Coolermaster ARGB controller uses a limited colour pallette referenced by an index
//Starting at 0x00 Random, 0x01 Red, 0x02 Green, 0x03 Blue, 0x04 Yellow, 0x05 Purple, 0x06 Cyan, 0x07 White
//The index can be calculated by normalising the input colour, rounding those values
//and using them as the indicies of a 3d array containing the correct index
unsigned int divisor = GetLargestColour( red, green, blue);
unsigned int r = round( red / divisor );
unsigned int g = round( green / divisor );
unsigned int b = round( blue / divisor );
unsigned char idx = argb_colour_index_data[r][g][b];
return idx;
}
void CMARGBController::SetMode(unsigned char mode, unsigned char speed)
{
current_mode = mode;
current_speed = speed;
SendUpdate();
}
void CMARGBController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
current_red = red;
current_green = green;
current_blue = blue;
SendUpdate();
}
void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_count)
{
const unsigned char buffer_size = 0x41;
unsigned char buffer[buffer_size] = { 0x00 };
unsigned char packet_count = 0x00;
std::vector<unsigned char> colours;
//Set up the RGB triplets to send
for(int i = 0; i < led_count; i++)
{
RGBColor colour = led_colours[i];
unsigned char r = RGBGetRValue(colour);
unsigned char g = RGBGetGValue(colour);
unsigned char b = RGBGetBValue(colour);
colours.push_back(r);
colours.push_back(g);
colours.push_back(b);
}
//buffer[CM_ARGB_REPORT_BYTE] = packet_count;
buffer[CM_ARGB_COMMAND_BYTE] = 0x10;
buffer[CM_ARGB_FUNCTION_BYTE] = 0x02;
buffer[CM_ARGB_ZONE_BYTE] = argb_header_data[zone_index].header;
buffer[CM_ARGB_MODE_BYTE] = 0x30; //30 might be the LED count??
unsigned char buffer_idx = CM_ARGB_MODE_BYTE + 1; //Start colour info from
for (std::vector<unsigned char>::iterator it = colours.begin(); it != colours.end(); buffer_idx = 0)
{
//Fill the write buffer till its full or the colour buffer is empty
buffer[CM_ARGB_REPORT_BYTE] = packet_count;
while (( buffer_idx < buffer_size) && ( it != colours.end() ))
{
buffer[buffer_idx] = *it;
buffer_idx++;
it++;
}
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
//reset the write buffer
memset(buffer, 0x00, sizeof(buffer) );
packet_count++;
}
buffer[CM_ARGB_REPORT_BYTE] = 0x82;
buffer[CM_ARGB_COMMAND_BYTE] = 0x62;
buffer[CM_ARGB_FUNCTION_BYTE] = 0x00;
buffer[CM_ARGB_ZONE_BYTE] = 0x73;
buffer[CM_ARGB_MODE_BYTE] = 0x00;
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = 0x33;
buffer[CM_ARGB_SPEED_BYTE] = 0x1B;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
}
void CMARGBController::SendUpdate()
{
unsigned char buffer[0x40] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
bool boolARGB_header = argb_header_data[zone_index].digital;
bool boolPassthru = ( current_mode == CM_ARGB_MODE_PASSTHRU );
bool boolDirect = ( current_mode == CM_ARGB_MODE_DIRECT );
unsigned char function = boolPassthru ? 0x02 : ( boolARGB_header ? 0x03 : 0x01);
buffer[CM_ARGB_REPORT_BYTE] = 0x80;
buffer[CM_ARGB_COMMAND_BYTE] = boolDirect ? 0x10 : 0x01;
buffer[CM_ARGB_FUNCTION_BYTE] = boolDirect ? 0x01 : function;
if ( boolDirect )
{
buffer[CM_ARGB_COMMAND_BYTE] = 0x10;
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
buffer[CM_ARGB_ZONE_BYTE] = argb_header_data[zone_index].header;
buffer[CM_ARGB_MODE_BYTE] = 0x30; //30 might be the LED count??
//hid_write(dev, buffer, buffer_size);
//hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
}
else
{
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
buffer[CM_ARGB_FUNCTION_BYTE] = function;
}
hid_write(dev, buffer, buffer_size);
if ( boolARGB_header )
{
buffer[CM_ARGB_COMMAND_BYTE] = 0x0b; //ARGB sends 0x0b (1011) RGB sends 0x04 (0100)
buffer[CM_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02; //This controls custom mode TODO
buffer[CM_ARGB_ZONE_BYTE] = argb_header_data[zone_index].header;
buffer[CM_ARGB_MODE_BYTE] = argb_mode_data[1][current_mode];
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = GetColourIndex( current_red, current_green, current_blue );
buffer[CM_ARGB_SPEED_BYTE] = current_speed;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
}
else
{
buffer[CM_ARGB_COMMAND_BYTE] = 0x04; //ARGB sends 0x0b (1011) RGB sends 0x04 (0100)
buffer[CM_ARGB_MODE_BYTE + CM_RGB_OFFSET] = argb_mode_data[0][current_mode];
buffer[CM_ARGB_COLOUR_INDEX_BYTE + CM_RGB_OFFSET] = GetColourIndex( current_red, current_green, current_blue );
buffer[CM_ARGB_SPEED_BYTE + CM_RGB_OFFSET] = current_speed;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
}
}
@@ -0,0 +1,127 @@
/*-------------------------------------------------------------------*\
| CMARGBController.h |
| |
| Driver for Coolermaster ARGB USB Controller |
| |
| Chris M (Dr_No) 10th Oct 2020 |
| |
| Simple RGB device with 5 modes |
| |
\*-------------------------------------------------------------------*/
#include <string>
#include <array>
#include <cmath> //Needed by round()
#include <hidapi/hidapi.h>
#include "RGBController.h" //Needed to set the direct mode
#pragma once
#define CM_ARGB_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
#define CM_ARGB_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
#define CM_ARGB_INTERRUPT_TIMEOUT 250
#define CM_ARGB_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define CM_RGB_OFFSET -2
#define HID_MAX_STR 255
enum
{
CM_ARGB_REPORT_BYTE = 1,
CM_ARGB_COMMAND_BYTE = 2,
CM_ARGB_FUNCTION_BYTE = 3,
CM_ARGB_ZONE_BYTE = 4,
CM_ARGB_MODE_BYTE = 5,
CM_ARGB_COLOUR_INDEX_BYTE = 6,
CM_ARGB_SPEED_BYTE = 7
};
struct argb_headers
{
const char* name;
unsigned char header;
bool digital;
unsigned int count;
};
static argb_headers argb_header_data[6] =
{
{ "RGB Header", 0xFF, false, 1 },
{ "Digital ARGB1", 0x01, true, 12 },
{ "Digital ARGB2", 0x02, true, 12 },
{ "Digital ARGB3", 0x04, true, 12 },
{ "Digital ARGB4", 0x08, true, 12 },
{ "All Digital ARGB", 0xFF, true, 12 }
};
enum
{
CM_RGB_MODE_OFF = 0, //Turn off
CM_RGB_MODE_COLOUR_CYCLE = 1, //Colour Cycle
CM_RGB_MODE_FLASH = 2, //Flash
CM_RGB_MODE_BREATHING = 3, //Breathing
CM_RGB_MODE_PASSTHRU = 4 //Motherboard Pass Thru Mode
};
enum
{
CM_ARGB_MODE_OFF = 0, //Turn off
CM_ARGB_MODE_SPECTRUM = 1, //Spectrum Mode
CM_ARGB_MODE_RELOAD = 2, //Reload Mode
CM_ARGB_MODE_RECOIL = 3, //Recoil Mode
CM_ARGB_MODE_BREATHING = 4, //Breathing Mode
CM_ARGB_MODE_REFILL = 5, //Refill Mode
CM_ARGB_MODE_DEMO = 6, //Demo Mode
CM_ARGB_MODE_FILLFLOW = 7, //Fill Flow Mode
CM_ARGB_MODE_RAINBOW = 8, //Rainbow Mode
CM_ARGB_MODE_DIRECT = 0xFE, //Direct Led Control
CM_ARGB_MODE_PASSTHRU = 0xFF //Motherboard Pass Thru Mode
};
enum
{
CM_ARGB_SPEED_SLOWEST = 0x00, // Slowest speed
CM_ARGB_SPEED_SLOW = 0x01, // Slower speed
CM_ARGB_SPEED_NORMAL = 0x02, // Normal speed
CM_ARGB_SPEED_FAST = 0x03, // Fast speed
CM_ARGB_SPEED_FASTEST = 0x04, // Fastest speed
};
class CMARGBController
{
public:
CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx);
~CMARGBController();
std::string GetDeviceName();
std::string GetSerial();
std::string GetLocation();
unsigned char GetZoneIndex();
unsigned char GetMode();
unsigned char GetLedRed();
unsigned char GetLedGreen();
unsigned char GetLedBlue();
unsigned char GetLedSpeed();
void SetMode(unsigned char mode, unsigned char speed);
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
void SetLedsDirect(RGBColor * led_colours, unsigned int led_count);
private:
std::string device_name;
std::string serial;
std::string location;
hid_device* dev;
unsigned char zone_index;
unsigned char current_mode;
unsigned char current_speed;
unsigned char current_red;
unsigned char current_green;
unsigned char current_blue;
unsigned int GetLargestColour(unsigned int red, unsigned int green, unsigned int blue);
unsigned char GetColourIndex(unsigned char red, unsigned char green, unsigned char blue);
void GetStatus();
void SendUpdate();
};
@@ -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,25 +1,33 @@
#include "Detector.h"
#include "CMMP750Controller.h"
#include "CMARGBcontroller.h"
#include "RGBController.h"
#include "RGBController_CMMP750Controller.h"
#include "RGBController_CMARGBController.h"
#include <hidapi/hidapi.h>
#define COOLERMASTER_VID 0x2516
#define COOLERMASTER_MP750_XL_PID 0x0109
#define COOLERMASTER_MP750_MEDIUM_PID 0x0105
#define COOLERMASTER_ARGB_PID 0x1011
#define COOLERMASTER_NUM_DEVICES (sizeof(cm_pids) / sizeof(cm_pids[ 0 ]))
enum
struct coolermaster_device
{
CM_PID = 0,
CM_INTERFACE = 1
unsigned int product_id;
unsigned short interface;
unsigned int usage_page;
unsigned int usage;
device_type type;
};
static const unsigned int cm_pids[][4] =
{ // PID, Interface
{ COOLERMASTER_MP750_XL_PID, 0x00 }, //Coolermaster MP750 (Extra Large)
{ COOLERMASTER_MP750_MEDIUM_PID, 0x00 } //Coolermaster MP750 (Medium)
static const coolermaster_device cm_pids[] =
{ // PID, Interface, Usage_Page, Usage, Device_Type
{ COOLERMASTER_MP750_XL_PID, 0x00, 0xFF00, 0x01, DEVICE_TYPE_MOUSEMAT }, //Coolermaster MP750 (Extra Large)
{ COOLERMASTER_MP750_MEDIUM_PID, 0x00, 0xFF00, 0x01, DEVICE_TYPE_MOUSEMAT }, //Coolermaster MP750 (Medium)
{ COOLERMASTER_ARGB_PID, 0x00, 0xFF00, 0x01, DEVICE_TYPE_LEDSTRIP } //Coolermaster ARGB Controller
};
/******************************************************************************************\
@@ -41,14 +49,22 @@ void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
while(info)
{
hid_device* dev = NULL;
device_type dev_type;
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]))
if((info->product_id == cm_pids[cm_pid_idx].product_id)
#ifdef USE_HID_USAGE
&&(info->usage == cm_pids[cm_pid_idx].usage) //Usage and usage page required to get the correct interface
&&(info->usage_page == cm_pids[cm_pid_idx].usage_page))
#else
&&(info->interface_number == cm_pids[cm_pid_idx].interface))
#endif //USE_HID_USAGE
{
dev = hid_open_path(info->path);
dev = hid_open_path(info->path);
dev_type = cm_pids[cm_pid_idx].type;
break;
}
}
@@ -56,11 +72,26 @@ void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
if(dev)
{
CMMP750Controller* controller = new CMMP750Controller(dev, info->manufacturer_string, info->product_string, info->path);
RGBController_CMMP750Controller* rgb_controller = new RGBController_CMMP750Controller(controller);
rgb_controllers.push_back(rgb_controller);
if (dev_type == DEVICE_TYPE_MOUSEMAT)
{
CMMP750Controller* controller = new CMMP750Controller(dev, info->manufacturer_string, info->product_string, info->path);
RGBController_CMMP750Controller* rgb_controller = new RGBController_CMMP750Controller(controller);
rgb_controllers.push_back(rgb_controller);
}
else if(dev_type == DEVICE_TYPE_LEDSTRIP)
{
for(std::size_t i = 0; i < CM_ARGB_HEADER_DATA_SIZE; i++)
{
CMARGBController* controller = new CMARGBController(dev, info->path, i);
RGBController_CMARGBController* rgb_controller = new RGBController_CMARGBController(controller);
rgb_controllers.push_back(rgb_controller);
}
}
}
info = info->next;
}
hid_free_enumeration(info);
}
} /* DetectCoolerMasterControllers() */
REGISTER_DETECTOR("Cooler Master", DetectCoolerMasterControllers);
@@ -0,0 +1,314 @@
/*-------------------------------------------------------------------*\
| RGBController_CMARGBController.cpp |
| |
| Driver for Coolermaster ARGB Controller |
| |
| Chris M (Dr_No) 14th Oct 2020 |
| |
\*-------------------------------------------------------------------*/
#include "RGBController_CMARGBController.h"
RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController *cmargb_ptr)
{
cmargb = cmargb_ptr;
unsigned char speed = cmargb->GetLedSpeed();
name = argb_header_data[cmargb->GetZoneIndex()].name;
type = DEVICE_TYPE_LEDSTRIP;
description = cmargb->GetDeviceName();
version = "1.0";
serial = cmargb->GetSerial();
location = cmargb->GetLocation();
if ( argb_header_data[cmargb->GetZoneIndex()].digital)
{
mode Off;
Off.name = "Turn Off";
Off.value = CM_ARGB_MODE_OFF;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Reload;
Reload.name = "Reload";
Reload.value = CM_ARGB_MODE_RELOAD;
Reload.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Reload.colors_min = 1;
Reload.colors_max = 1;
Reload.colors.resize(Reload.colors_max);
Reload.speed_min = CM_ARGB_SPEED_SLOWEST;
Reload.speed_max = CM_ARGB_SPEED_FASTEST;
Reload.color_mode = MODE_COLORS_RANDOM;
Reload.speed = speed;
modes.push_back(Reload);
mode Recoil;
Recoil.name = "Recoil";
Recoil.value = CM_ARGB_MODE_RECOIL;
Recoil.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Recoil.colors_min = 1;
Recoil.colors_max = 1;
Recoil.colors.resize(Reload.colors_max);
Recoil.speed_min = CM_ARGB_SPEED_SLOWEST;
Recoil.speed_max = CM_ARGB_SPEED_FASTEST;
Recoil.color_mode = MODE_COLORS_RANDOM;
Recoil.speed = speed;
modes.push_back(Recoil);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CM_ARGB_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Reload.colors_max);
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_RANDOM;
Breathing.speed = speed;
modes.push_back(Breathing);
mode Refill;
Refill.name = "Refill";
Refill.value = CM_ARGB_MODE_REFILL;
Refill.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Refill.colors_min = 1;
Refill.colors_max = 1;
Refill.colors.resize(Reload.colors_max);
Refill.speed_min = CM_ARGB_SPEED_SLOWEST;
Refill.speed_max = CM_ARGB_SPEED_FASTEST;
Refill.color_mode = MODE_COLORS_RANDOM;
Refill.speed = speed;
modes.push_back(Refill);
mode Demo;
Demo.name = "Demo";
Demo.value = CM_ARGB_MODE_DEMO;
Demo.flags = MODE_FLAG_HAS_SPEED;
Demo.speed_min = CM_ARGB_SPEED_SLOWEST;
Demo.speed_max = CM_ARGB_SPEED_FASTEST;
Demo.color_mode = MODE_COLORS_NONE;
Demo.speed = speed;
modes.push_back(Demo);
mode Spectrum;
Spectrum.name = "Spectrum";
Spectrum.value = CM_ARGB_MODE_SPECTRUM;
Spectrum.flags = MODE_FLAG_HAS_SPEED;
Spectrum.speed_min = CM_ARGB_SPEED_SLOWEST;
Spectrum.speed_max = CM_ARGB_SPEED_FASTEST;
Spectrum.color_mode = MODE_COLORS_NONE;
Spectrum.speed = speed;
modes.push_back(Spectrum);
mode FillFlow;
FillFlow.name = "Fill Flow";
FillFlow.value = CM_ARGB_MODE_FILLFLOW;
FillFlow.flags = MODE_FLAG_HAS_SPEED;
FillFlow.speed_min = CM_ARGB_SPEED_SLOWEST;
FillFlow.speed_max = CM_ARGB_SPEED_FASTEST;
FillFlow.color_mode = MODE_COLORS_NONE;
FillFlow.speed = speed;
modes.push_back(FillFlow);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CM_ARGB_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = CM_ARGB_SPEED_SLOWEST;
Rainbow.speed_max = CM_ARGB_SPEED_FASTEST;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.speed = speed;
modes.push_back(Rainbow);
mode Direct;
Direct.name = "Direct";
Direct.value = CM_ARGB_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode PassThru;
PassThru.name = "Pass Thru";
PassThru.value = CM_ARGB_MODE_PASSTHRU;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
}
else
{
mode Off;
Off.name = "Turn Off";
Off.value = CM_RGB_MODE_OFF;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CM_RGB_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_RANDOM;
Breathing.speed = speed;
modes.push_back(Breathing);
mode Flash;
Breathing.name = "Flash";
Breathing.value = CM_RGB_MODE_FLASH;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_RANDOM;
Breathing.speed = speed;
modes.push_back(Breathing);
mode ColourCycle;
ColourCycle.name = "Colour Cycle";
ColourCycle.value = CM_RGB_MODE_COLOUR_CYCLE;
ColourCycle.flags = MODE_FLAG_HAS_SPEED;
ColourCycle.speed_min = CM_ARGB_SPEED_SLOWEST;
ColourCycle.speed_max = CM_ARGB_SPEED_FASTEST;
ColourCycle.color_mode = MODE_COLORS_NONE;
ColourCycle.speed = speed;
modes.push_back(ColourCycle);
mode PassThru;
PassThru.name = "Pass Thru";
PassThru.value = CM_RGB_MODE_PASSTHRU;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
}
Init_Controller(); //Only processed on first run
SetupZones();
//active_mode = cmargb->GetMode();
}
RGBController_CMARGBController::~RGBController_CMARGBController()
{
}
void RGBController_CMARGBController::Init_Controller()
{
int zone_idx = cmargb->GetZoneIndex();
int zone_led_count = argb_header_data[zone_idx].count;
bool boolSingleLED = ( zone_led_count == 1 ); //If argb_header_data[zone_idx].count == 1 then the zone is ZONE_TYPE_SINGLE
zone ARGB_zone;
ARGB_zone.name = std::to_string(zone_idx);
ARGB_zone.type = (boolSingleLED) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR;
ARGB_zone.leds_min = 0;
ARGB_zone.leds_max = 64;
ARGB_zone.leds_count = zone_led_count;
ARGB_zone.matrix_map = NULL;
zones.push_back(ARGB_zone);
}
void RGBController_CMARGBController::SetupZones()
{
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
leds.clear();
colors.clear();
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
bool boolSingleLED = (zones[zone_idx].type == ZONE_TYPE_SINGLE); //Calculated for later use
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
{
led new_led;
unsigned int i = std::stoi(zones[zone_idx].name);
if(boolSingleLED)
{
new_led.name = i;
new_led.value = argb_header_data[i].header;
}
else
{
new_led.name = i;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = argb_header_data[i].header;
}
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_CMARGBController::ResizeZone(int zone, int new_size)
{
if((size_t) zone >= zones.size())
{
return;
}
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
{
zones[zone].leds_count = new_size;
SetupZones();
}
}
void RGBController_CMARGBController::DeviceUpdateLEDs()
{
/*unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
cmargb->SetColor(red, grn, blu);*/
//this one
cmargb->SetMode( modes[active_mode].value, modes[active_mode].speed );
cmargb->SetLedsDirect( zones[0].colors, zones[0].leds_count );
}
void RGBController_CMARGBController::UpdateZoneLEDs(int zone)
{
RGBColor colour = colors[zone];
unsigned char red = RGBGetRValue(colour);
unsigned char grn = RGBGetGValue(colour);
unsigned char blu = RGBGetBValue(colour);
cmargb->SetColor(red, grn, blu);
}
void RGBController_CMARGBController::UpdateSingleLED(int led)
{
//cmargb->SetMode( modes[active_mode].value, modes[active_mode].speed );
//cmargb->SetLedsDirect( zones[0].colors, zones[0].leds_count );
}
void RGBController_CMARGBController::SetCustomMode()
{
active_mode = CM_ARGB_MODE_DIRECT;
}
void RGBController_CMARGBController::DeviceUpdateMode()
{
if( modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC )
{
unsigned char red = RGBGetRValue(modes[active_mode].colors[0]);
unsigned char grn = RGBGetGValue(modes[active_mode].colors[0]);
unsigned char blu = RGBGetBValue(modes[active_mode].colors[0]);
cmargb->SetColor(red, grn, blu);
}
else
{
cmargb->SetColor(0, 0, 0); //If the mode is not colour specific then set colour to black for the random index
}
cmargb->SetMode( modes[active_mode].value, modes[active_mode].speed );
}
@@ -0,0 +1,35 @@
/*-------------------------------------------------------------------*\
| RGBController_CMARGBController.h |
| |
| Driver for Coolermaster ARGB Controller |
| |
| Chris M (Dr_No) 14th Oct 2020 |
| |
\*-------------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CMARGBcontroller.h"
#include <vector>
class RGBController_CMARGBController : public RGBController
{
public:
RGBController_CMARGBController(CMARGBController* cmargb_ptr);
~RGBController_CMARGBController();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
void Init_Controller();
int GetDeviceMode();
CMARGBController* cmargb;
};
@@ -0,0 +1,126 @@
/*------------------------------------------*\
| CorsairDominatorPlatinumController.cpp |
| |
| Drover for Corsair Domintator Platinum |
| RGB RAM lighting controller |
| |
| Erik Gilling (konkers) 9/25/2020 |
\*------------------------------------------*/
#include "CorsairDominatorPlatinumController.h"
#include <cstring>
using namespace std::chrono_literals;
CorsairDominatorPlatinumController::CorsairDominatorPlatinumController(i2c_smbus_interface *bus, corsair_dev_id dev)
{
this->bus = bus;
this->dev = dev;
led_data[0] = 0xc;
}
CorsairDominatorPlatinumController::~CorsairDominatorPlatinumController()
{
}
std::string CorsairDominatorPlatinumController::GetDeviceName()
{
return "Corsair Dominator Platinum RGB";
}
std::string CorsairDominatorPlatinumController::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("I2C: " + return_string);
}
void CorsairDominatorPlatinumController::SetAllColors
(
unsigned char red,
unsigned char green,
unsigned char blue
)
{
for(unsigned int led = 0; led < CORSAIR_PLAT_LED_COUNT; led++)
{
SetLEDColor(led, red, green, blue);
}
}
void CorsairDominatorPlatinumController::SetLEDColor
(
unsigned int led,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
if(led >= CORSAIR_PLAT_LED_COUNT)
{
return;
}
unsigned int offset = (led * 3) + 1;
led_data[offset] = red;
led_data[offset + 1] = green;
led_data[offset + 2] = blue;
}
unsigned char CorsairDominatorPlatinumController::crc8
(
unsigned char init,
unsigned char poly,
unsigned char* data,
unsigned char len
)
{
unsigned char crc = init;
for(unsigned int i = 0; i < len; i++)
{
unsigned char val = data[i];
for(unsigned char mask = 0x80; mask != 0; mask >>= 1)
{
unsigned char bit;
if ((val & mask) != 0)
{
bit = (crc & 0x80) ^ 0x80;
}
else
{
bit = crc & 0x80;
}
if (bit == 0)
{
crc <<= 1;
}
else
{
crc = (crc << 1) ^ poly;
}
}
}
return crc;
}
void CorsairDominatorPlatinumController::ApplyColors()
{
unsigned char data[sizeof(led_data)];
memcpy(data, led_data, sizeof(led_data));
unsigned char crc = crc8(0x0, 0x7, data, sizeof(data) - 1);
data[sizeof(data) - 1] = crc;
bus->i2c_smbus_write_block_data(dev, 0x31, 0x20, data);
std::this_thread::sleep_for(800us);
bus->i2c_smbus_write_block_data(dev, 0x32, sizeof(data) - 0x20, data + 0x20);
std::this_thread::sleep_for(200us);
}
@@ -0,0 +1,42 @@
/*-----------------------------------------*\
| CorsairDominatorPlatinumController.h |
| |
| Definitions and types for Corsair |
| Domintator Platinum RGB RAM lighting |
| controller |
| |
| Erik Gilling (konkers) 9/25/2020 |
\*-----------------------------------------*/
#include <string>
#include "i2c_smbus.h"
#pragma once
typedef unsigned char corsair_dev_id;
class CorsairDominatorPlatinumController
{
public:
CorsairDominatorPlatinumController(i2c_smbus_interface *bus, corsair_dev_id dev);
~CorsairDominatorPlatinumController();
std::string GetDeviceName();
std::string GetDeviceLocation();
size_t GetLEDCount() { return CORSAIR_PLAT_LED_COUNT; }
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void ApplyColors();
bool WaitReady();
private:
static constexpr size_t CORSAIR_PLAT_LED_COUNT = 12;
unsigned char led_data[CORSAIR_PLAT_LED_COUNT * 3 + 2];
i2c_smbus_interface* bus;
corsair_dev_id dev;
static unsigned char crc8(unsigned char init, unsigned char poly, unsigned char *data, unsigned char len);
};
@@ -0,0 +1,70 @@
#include "Detector.h"
#include "CorsairDominatorPlatinumController.h"
#include "RGBController.h"
#include "RGBController_CorsairDominatorPlatinum.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std::chrono_literals;
bool TestForCorsairDominatorPlatinumController(i2c_smbus_interface *bus, unsigned char address)
{
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if(res < 0)
{
return false;
}
res = bus->i2c_smbus_read_byte_data(address, 0x43);
if(res != 0x1b)
{
return false;
}
res = bus->i2c_smbus_read_byte_data(address, 0x44);
if(res != 0x04)
{
return false;
}
return true;
}
/******************************************************************************************\
* *
* DetectCorsairDominatorPlatinumControllers *
* *
* Detect Corsair Dominator Platinum controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where Aura device is connected *
* dev - I2C address of Aura device *
* *
\******************************************************************************************/
void DetectCorsairDominatorPlatinumControllers(std::vector<i2c_smbus_interface *> &busses, std::vector<RGBController *> &rgb_controllers)
{
for(unsigned int bus = 0; bus < busses.size(); bus++)
{
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
for(unsigned char addr = 0x58; addr <= 0x5f; addr++)
{
if(TestForCorsairDominatorPlatinumController(busses[bus], addr))
{
CorsairDominatorPlatinumController* new_controller = new CorsairDominatorPlatinumController(busses[bus], addr);
RGBController_CorsairDominatorPlatinum* new_rgbcontroller = new RGBController_CorsairDominatorPlatinum(new_controller);
rgb_controllers.push_back(new_rgbcontroller);
}
std::this_thread::sleep_for(10ms);
}
}
}
}
REGISTER_I2C_DETECTOR("Corsair Dominator Platinum", DetectCorsairDominatorPlatinumControllers);
@@ -0,0 +1,108 @@
/*-------------------------------------------------*\
| RGBController_CorsairDominatorPlatinum.cpp |
| |
| Corsair Vengeance Pro RGB driver |
| |
| Erik Gilling (konkers) 9/25/2020 |
\*-------------------------------------------------*/
#include "RGBController_CorsairDominatorPlatinum.h"
RGBController_CorsairDominatorPlatinum::RGBController_CorsairDominatorPlatinum(CorsairDominatorPlatinumController* corsair_ptr)
{
corsair = corsair_ptr;
name = corsair->GetDeviceName();
type = DEVICE_TYPE_DRAM;
description = "Corsair Dominator Platinum RGB Device";
location = corsair->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.speed_min = 0;
Direct.speed_max = 0;
Direct.speed = 0;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
active_mode = 0;
}
void RGBController_CorsairDominatorPlatinum::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone new_zone;
new_zone.name = "Corsair Platinum Zone";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = corsair->GetLEDCount();
new_zone.leds_max = corsair->GetLEDCount();
new_zone.leds_count = corsair->GetLEDCount();
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
{
led *new_led = new led();
new_led->name = "Corsair Platinum LED ";
new_led->name.append(std::to_string(led_idx));
leds.push_back(*new_led);
}
SetupColors();
}
void RGBController_CorsairDominatorPlatinum::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CorsairDominatorPlatinum::DeviceUpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
corsair->SetLEDColor(led, red, grn, blu);
}
corsair->ApplyColors();
}
void RGBController_CorsairDominatorPlatinum::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairDominatorPlatinum::UpdateSingleLED(int led)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
corsair->SetLEDColor(led, red, grn, blu);
corsair->ApplyColors();
}
void RGBController_CorsairDominatorPlatinum::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairDominatorPlatinum::DeviceUpdateMode()
{
}
@@ -0,0 +1,32 @@
/*--------------------------------------------*\
| RGBController_CorsairDominatorPlatinum.h |
| |
| Corsair Dominator Platinum RGB driver |
| |
| Erik Gilling (konkers) 9/25/2020 |
\*--------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CorsairDominatorPlatinumController.h"
class RGBController_CorsairDominatorPlatinum : public RGBController
{
public:
RGBController_CorsairDominatorPlatinum(CorsairDominatorPlatinumController* corsair_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
CorsairDominatorPlatinumController* corsair;
};
@@ -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);
@@ -0,0 +1,136 @@
/*-----------------------------------------*\
| RGBController_CorsairHydro.cpp |
| |
| Generic RGB Interface for Corsair |
| Hydro Series |
| |
| Adam Honse (CalcProgrammer1) 8/18/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairHydro.h"
RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* corsair_ptr)
{
corsair = corsair_ptr;
description = "Corsair Hydro Series Device";
version = corsair->GetFirmwareString();
type = DEVICE_TYPE_COOLER;
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Blinking;
Blinking.name = "Blinking";
Blinking.value = 1;
Blinking.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blinking.speed_min = 0x0F;
Blinking.speed_max = 0x05;
Blinking.speed = 0x0A;
Blinking.colors_min = 2;
Blinking.colors_max = 2;
Blinking.colors.resize(2);
modes.push_back(Blinking);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = 2;
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorShift.speed_min = 0x46;
ColorShift.speed_max = 0x0F;
ColorShift.speed = 0x28;
ColorShift.colors_min = 2;
ColorShift.colors_max = 2;
ColorShift.colors.resize(2);
modes.push_back(ColorShift);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = 3;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Pulsing.speed_min = 0x50;
Pulsing.speed_max = 0x1E;
Pulsing.speed = 0x37;
Pulsing.colors_min = 2;
Pulsing.colors_max = 2;
Pulsing.colors.resize(2);
modes.push_back(Pulsing);
SetupZones();
}
void RGBController_CorsairHydro::SetupZones()
{
zone new_zone;
new_zone.name = "Pump Zone";
new_zone.type = ZONE_TYPE_SINGLE;
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
led new_led;
new_led.name = "Pump LED";
leds.push_back(new_led);
SetupColors();
}
void RGBController_CorsairHydro::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CorsairHydro::DeviceUpdateLEDs()
{
DeviceUpdateMode();
}
void RGBController_CorsairHydro::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairHydro::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairHydro::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairHydro::DeviceUpdateMode()
{
switch(modes[active_mode].value)
{
case 0:
corsair->SetFixed(colors);
break;
case 1:
corsair->SetBlink(modes[active_mode].colors, modes[active_mode].speed);
break;
case 2:
corsair->SetShift(modes[active_mode].colors, modes[active_mode].speed);
break;
case 3:
corsair->SetPulse(modes[active_mode].colors, modes[active_mode].speed);
break;
}
}
@@ -0,0 +1,32 @@
/*-----------------------------------------*\
| RGBController_CorsairHydro.h |
| |
| Generic RGB Interface for Corsair |
| Hydro Series |
| |
| Adam Honse (CalcProgrammer1) 8/17/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CorsairHydroController.h"
class RGBController_CorsairHydro : public RGBController
{
public:
RGBController_CorsairHydro(CorsairHydroController* corsair_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
CorsairHydroController* corsair;
};
@@ -37,9 +37,10 @@ THREAD keepalive_thread(void *param)
THREADRETURN
}
CorsairLightingNodeController::CorsairLightingNodeController(hid_device* dev_handle)
CorsairLightingNodeController::CorsairLightingNodeController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
SendFirmwareRequest();
@@ -78,6 +79,11 @@ std::string CorsairLightingNodeController::GetFirmwareString()
return(firmware_version);
}
std::string CorsairLightingNodeController::GetLocationString()
{
return(location);
}
void CorsairLightingNodeController::SetChannelEffect(unsigned char channel,
unsigned char num_leds,
unsigned char mode,
@@ -79,10 +79,11 @@ enum
class CorsairLightingNodeController
{
public:
CorsairLightingNodeController(hid_device* dev_handle);
CorsairLightingNodeController(hid_device* dev_handle, const char* path);
~CorsairLightingNodeController();
std::string GetFirmwareString();
std::string GetLocationString();
unsigned int GetStripsOnChannel(unsigned int channel);
@@ -110,6 +111,7 @@ public:
private:
hid_device* dev;
std::string firmware_version;
std::string location;
std::chrono::time_point<std::chrono::steady_clock> last_commit_time;
void SendFirmwareRequest();
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairLightingNodeController.h"
#include "RGBController.h"
#include "RGBController_CorsairLightingNode.h"
@@ -63,7 +64,7 @@ void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_contr
if( dev )
{
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev);
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev, info->path);
RGBController_CorsairLightingNode* rgb_controller = new RGBController_CorsairLightingNode(controller);
@@ -77,3 +78,5 @@ void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_contr
}
}
} /* DetectCorsairLightingNodeControllers() */
REGISTER_DETECTOR("Corsair Lighting Node", DetectCorsairLightingNodeControllers);
@@ -18,6 +18,7 @@ RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLigh
description = "Corsair Lighting Node Device";
type = DEVICE_TYPE_LEDSTRIP;
version = corsair->GetFirmwareString();
location = corsair->GetLocationString();
mode Direct;
Direct.name = "Direct";
@@ -201,7 +202,7 @@ void RGBController_CorsairLightingNode::SetupZones()
| can support is 200. |
\*-------------------------------------------------*/
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = 200;
zones[channel_idx].leds_max = 204;
if(first_run)
{
@@ -22,11 +22,36 @@ 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)
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
ReadFirmwareInfo();
@@ -43,6 +68,21 @@ device_type CorsairPeripheralController::GetDeviceType()
return type;
}
std::string CorsairPeripheralController::GetDeviceLocation()
{
return(location);
}
int CorsairPeripheralController::GetPhysicalLayout()
{
return physical_layout;
}
int CorsairPeripheralController::GetLogicalLayout()
{
return logical_layout;
}
std::string CorsairPeripheralController::GetFirmwareString()
{
return firmware_version;
@@ -88,9 +128,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 +145,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 +170,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 +178,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 +186,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 +341,7 @@ void CorsairPeripheralController::SpecialFunctionControl()
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::ReadFirmwareInfo()
{
int actual;
@@ -340,6 +396,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 +452,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,13 +47,32 @@ 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(hid_device* dev_handle, const char* path);
~CorsairPeripheralController();
int GetLogicalLayout();
int GetPhysicalLayout();
device_type GetDeviceType();
std::string GetDeviceLocation();
std::string GetFirmwareString();
void SetLEDs(std::vector<RGBColor> colors);
@@ -66,7 +85,10 @@ private:
hid_device* dev;
std::string firmware_version;
std::string location;
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 |
\*-----------------------------------------------------------------------------------------------------*/
@@ -142,7 +147,7 @@ void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_control
if( dev )
{
CorsairPeripheralController* controller = new CorsairPeripheralController(dev);
CorsairPeripheralController* controller = new CorsairPeripheralController(dev, info->path);
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
{
@@ -157,4 +162,6 @@ void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_control
info = info->next;
}
}
}
} /* DetectCorsairPeripheralControllers() */
REGISTER_DETECTOR("Corsair Peripheral", DetectCorsairPeripheralControllers);
@@ -0,0 +1,806 @@
/*-----------------------------------------*\
| RGBController_CorsairPeripheral.cpp |
| |
| Generic RGB Interface for Corsair RGB |
| keyboard, mouse, and mousemat devices |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairPeripheral.h"
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
static unsigned int matrix_map_k95_platinum[7][24] =
{ { NA, NA, NA, NA, 107, 8, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 16, NA, NA, NA,},
{ 113, 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 114, 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 115, 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 116, 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 117, 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 118, 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
static unsigned int matrix_map_k95[7][26] =
{ { NA, NA, NA, 131, 132, 133, 134, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 107, 8, NA, NA, 16, NA, NA,},
{ 113, 114, 115, 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 116, 117, 118, 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 119, 120, 121, 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 122, 123, 124, 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 125, 126, 127, 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 128, 129, 130, 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
/*---------------------------------------------------------*\
| Normal Corsair Layout |
\*---------------------------------------------------------*/
static const char* zone_names[] =
{
"Keyboard",
};
static const unsigned int zone_sizes[] =
{
113
};
static const zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
/*---------------------------------------------------------*\
| K95 Platinum |
\*---------------------------------------------------------*/
static const char* zone_names_k95_platinum[] =
{
"Keyboard",
"Light Bar"
};
static const unsigned int zone_sizes_k95_platinum[] =
{
119,
19
};
static const zone_type zone_types_k95_platinum[] =
{
ZONE_TYPE_MATRIX,
ZONE_TYPE_LINEAR
};
/*---------------------------------------------------------*\
| K95 non-Platinum |
\*---------------------------------------------------------*/
static const char* zone_names_k95[] =
{
"Keyboard",
};
static const unsigned int zone_sizes_k95[] =
{
135
};
static const zone_type zone_types_k95[] =
{
ZONE_TYPE_MATRIX
};
static const char* led_names[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
};
static const char* led_names_k95_plat[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
"Key: Macro G1",
"Key: Macro G2",
"Key: Macro G3",
"Key: Macro G4",
"Key: Macro G5",
"Key: Macro G6",
"Light Bar 1",
"Light Bar 2",
"Light Bar 3",
"Light Bar 4",
"Light Bar 5",
"Light Bar 6",
"Light Bar 7",
"Light Bar 8",
"Light Bar 9",
"Light Bar 10",
"Light Bar 11",
"Light Bar 12",
"Light Bar 13",
"Light Bar 14",
"Light Bar 15",
"Light Bar 16",
"Light Bar 17",
"Light Bar 18",
"Light Bar 19"
};
static const char* led_names_k95[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
"Key: Macro G1",
"Key: Macro G2",
"Key: Macro G3",
"Key: Macro G4",
"Key: Macro G5",
"Key: Macro G6",
"Key: Macro G7",
"Key: Macro G8",
"Key: Macro G9",
"Key: Macro G10",
"Key: Macro G11",
"Key: Macro G12",
"Key: Macro G13",
"Key: Macro G14",
"Key: Macro G15",
"Key: Macro G16",
"Key: Macro G17",
"Key: Macro G18",
"Key: MR",
"Key: M1",
"Key: M2",
"Key: M3",
};
static const char* corsair_mouse_leds[] =
{
"Mouse LED 1",
"Mouse LED 2",
"Mouse LED 3",
"Mouse LED 4",
"Mouse LED 5",
"Mouse LED 6",
"Mouse LED 7",
"Mouse LED 8",
"Mouse LED 9",
"Mouse LED 10",
"Mouse LED 11",
"Mouse LED 12",
"Mouse LED 13",
"Mouse LED 14",
"Mouse LED 15",
};
static const char* corsair_sabre_rgb_leds[] =
{
"",
"Underglow",
"Logo",
"DPI",
"Scroll Wheel",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
};
static const char* corsair_harpoon_pro_leds[] =
{
"",
"",
"",
"Logo",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr)
{
corsair = corsair_ptr;
name = "Corsair RGB Peripheral Device";
description = "Corsair RGB Peripheral Device";
type = corsair->GetDeviceType();
version = corsair->GetFirmwareString();
location = corsair->GetDeviceLocation();
physical_layout = corsair->GetPhysicalLayout();
logical_layout = corsair->GetLogicalLayout();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_CorsairPeripheral::~RGBController_CorsairPeripheral()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_CorsairPeripheral::SetupZones()
{
/*---------------------------------------------------------*\
| Determine number of zones |
| For now, keyboard has 2 zones and mousemat has 1 |
\*---------------------------------------------------------*/
unsigned int num_zones = 0;
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
num_zones = 2;
break;
}
num_zones = 1;
break;
case DEVICE_TYPE_MOUSE:
case DEVICE_TYPE_MOUSEMAT:
num_zones = 1;
break;
case DEVICE_TYPE_HEADSET_STAND:
num_zones = 2;
break;
}
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
{
zone new_zone;
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
new_zone.name = zone_names_k95_platinum[zone_idx];
new_zone.type = zone_types_k95_platinum[zone_idx];
new_zone.leds_min = zone_sizes_k95_platinum[zone_idx];
new_zone.leds_max = zone_sizes_k95_platinum[zone_idx];
new_zone.leds_count = zone_sizes_k95_platinum[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 24;
new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95_platinum;
}
else
{
new_zone.matrix_map = NULL;
}
}
else if (logical_layout == CORSAIR_TYPE_K95)
{
new_zone.name = zone_names_k95[zone_idx];
new_zone.type = zone_types_k95[zone_idx];
new_zone.leds_min = zone_sizes_k95[zone_idx];
new_zone.leds_max = zone_sizes_k95[zone_idx];
new_zone.leds_count = zone_sizes_k95[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 26;
new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95;
}
else
{
new_zone.matrix_map = NULL;
}
}
else //default layout
{
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
}
break;
case DEVICE_TYPE_MOUSE:
new_zone.name = "Mouse Zone";
new_zone.type = ZONE_TYPE_SINGLE;
new_zone.leds_min = 15;
new_zone.leds_max = 15;
new_zone.leds_count = 15;
new_zone.matrix_map = NULL;
break;
case DEVICE_TYPE_MOUSEMAT:
new_zone.name = "Mousemat Zone";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = 15;
new_zone.leds_max = 15;
new_zone.leds_count = 15;
new_zone.matrix_map = NULL;
break;
case DEVICE_TYPE_HEADSET_STAND:
if(zone_idx == 0)
{
new_zone.name = "Base LED Strip";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = 8;
new_zone.leds_max = 8;
new_zone.leds_count = 8;
new_zone.matrix_map = NULL;
}
else
{
new_zone.name = "Logo";
new_zone.type = ZONE_TYPE_SINGLE;
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = NULL;
}
break;
}
zones.push_back(new_zone);
total_led_count += new_zone.leds_count;
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
if(logical_layout == CORSAIR_TYPE_K95_PLAT)
{
new_led.name = led_names_k95_plat[led_idx];
}
else if(logical_layout == CORSAIR_TYPE_K95)
{
new_led.name = led_names_k95[led_idx];
}
else
{
new_led.name = led_names[led_idx];
}
break;
case DEVICE_TYPE_MOUSE:
new_led.name = corsair_mouse_leds[led_idx];
break;
case DEVICE_TYPE_MOUSEMAT:
case DEVICE_TYPE_HEADSET_STAND:
new_led.name = "Mousemat LED ";
new_led.name.append(std::to_string(led_idx + 1));
break;
}
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_CorsairPeripheral::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CorsairPeripheral::DeviceUpdateLEDs()
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairPeripheral::UpdateZoneLEDs(int /*zone*/)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairPeripheral::UpdateSingleLED(int /*led*/)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairPeripheral::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairPeripheral::DeviceUpdateMode()
{
}
@@ -17,6 +17,9 @@ public:
RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr);
~RGBController_CorsairPeripheral();
int physical_layout;
int logical_layout;
void SetupZones();
void ResizeZone(int zone, int new_size);
@@ -36,7 +36,7 @@ std::string CorsairVengeanceController::GetDeviceLocation()
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
return("I2C: " + return_string);
}
unsigned int CorsairVengeanceController::GetLEDCount()
@@ -1,7 +1,9 @@
#include "Detector.h"
#include "CorsairVengeanceController.h"
#include "RGBController.h"
#include "RGBController_CorsairVengeance.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
@@ -57,69 +59,74 @@ void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Check for Corsair controller at 0x58
if (TestForCorsairVengeanceController(busses[bus], 0x58))
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x58);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x58
if (TestForCorsairVengeanceController(busses[bus], 0x58))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x58);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x59
if (TestForCorsairVengeanceController(busses[bus], 0x59))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x59);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x59
if (TestForCorsairVengeanceController(busses[bus], 0x59))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x59);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5A
if (TestForCorsairVengeanceController(busses[bus], 0x5A))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5A);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5A
if (TestForCorsairVengeanceController(busses[bus], 0x5A))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5A);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5B
if (TestForCorsairVengeanceController(busses[bus], 0x5B))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5B);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5B
if (TestForCorsairVengeanceController(busses[bus], 0x5B))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5B);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5C
if (TestForCorsairVengeanceController(busses[bus], 0x5C))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5C);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5C
if (TestForCorsairVengeanceController(busses[bus], 0x5C))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5C);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5D
if (TestForCorsairVengeanceController(busses[bus], 0x5D))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5D);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5D
if (TestForCorsairVengeanceController(busses[bus], 0x5D))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5D);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairVengeanceController(busses[bus], 0x5E))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5E);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairVengeanceController(busses[bus], 0x5E))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5E);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5F
if (TestForCorsairVengeanceController(busses[bus], 0x5F))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5F);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
// Check for Corsair controller at 0x5F
if (TestForCorsairVengeanceController(busses[bus], 0x5F))
{
new_corsair = new CorsairVengeanceController(busses[bus], 0x5F);
new_controller = new RGBController_CorsairVengeance(new_corsair);
rgb_controllers.push_back(new_controller);
}
}
}
} /* DetectCorsairVengeanceControllers() */
} /* DetectCorsairVengeanceControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance", DetectCorsairVengeanceControllers);
@@ -47,7 +47,7 @@ std::string CorsairVengeanceProController::GetDeviceLocation()
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
return("I2C: " + return_string);
}
unsigned int CorsairVengeanceProController::GetLEDCount()
@@ -1,7 +1,9 @@
#include "Detector.h"
#include "CorsairVengeanceProController.h"
#include "RGBController.h"
#include "RGBController_CorsairVengeancePro.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
@@ -65,69 +67,74 @@ void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &bus
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Check for Corsair controller at 0x58
if (TestForCorsairVengeanceProController(busses[bus], 0x58))
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x58);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x58
if (TestForCorsairVengeanceProController(busses[bus], 0x58))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x58);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x59
if (TestForCorsairVengeanceProController(busses[bus], 0x59))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x59);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x59
if (TestForCorsairVengeanceProController(busses[bus], 0x59))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x59);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5A
if (TestForCorsairVengeanceProController(busses[bus], 0x5A))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5A);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5A
if (TestForCorsairVengeanceProController(busses[bus], 0x5A))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5A);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5B
if (TestForCorsairVengeanceProController(busses[bus], 0x5B))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5B);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5B
if (TestForCorsairVengeanceProController(busses[bus], 0x5B))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5B);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5C
if (TestForCorsairVengeanceProController(busses[bus], 0x5C))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5C);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5C
if (TestForCorsairVengeanceProController(busses[bus], 0x5C))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5C);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5D
if (TestForCorsairVengeanceProController(busses[bus], 0x5D))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5D);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5D
if (TestForCorsairVengeanceProController(busses[bus], 0x5D))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5D);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairVengeanceProController(busses[bus], 0x5E))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5E);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairVengeanceProController(busses[bus], 0x5E))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5E);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5F
if (TestForCorsairVengeanceProController(busses[bus], 0x5F))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5F);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
// Check for Corsair controller at 0x5F
if (TestForCorsairVengeanceProController(busses[bus], 0x5F))
{
new_corsair_pro = new CorsairVengeanceProController(busses[bus], 0x5F);
new_controller = new RGBController_CorsairVengeancePro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
}
}
} /* DetectCorsairVengeanceProControllers() */
} /* DetectCorsairVengeanceProControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance Pro", DetectCorsairVengeanceProControllers);
@@ -18,6 +18,16 @@ RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVeng
description = "Corsair Vengeance Pro RGB Device";
location = corsair->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = CORSAIR_PRO_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.speed_min = 0;
Direct.speed_max = 0;
Direct.speed = 0;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = CORSAIR_PRO_MODE_COLOR_SHIFT;
@@ -134,16 +144,6 @@ RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVeng
Sequential.colors.resize(1);
modes.push_back(Sequential);
mode Static;
Static.name = "Static";
Static.value = CORSAIR_PRO_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.speed_min = 0;
Static.speed_max = 0;
Static.speed = 0;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
SetupZones();
active_mode = 9;
@@ -216,7 +216,7 @@ void RGBController_CorsairVengeancePro::UpdateSingleLED(int led)
void RGBController_CorsairVengeancePro::SetCustomMode()
{
active_mode = 9;
active_mode = 0;
}
void RGBController_CorsairVengeancePro::DeviceUpdateMode()
@@ -34,7 +34,7 @@ std::string CrucialController::GetDeviceLocation()
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
return("I2C: " + return_string);
}
unsigned int CrucialController::GetLEDCount()
@@ -1,7 +1,9 @@
#include "Detector.h"
#include "CrucialController.h"
#include "RGBController.h"
#include "RGBController_Crucial.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
@@ -73,16 +75,21 @@ void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Add Crucial controllers
for (unsigned int address_list_idx = 0; address_list_idx < CRUCIAL_ADDRESS_COUNT; address_list_idx++)
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
if (TestForCrucialController(busses[bus], crucial_addresses[address_list_idx]))
// Add Crucial controllers
for (unsigned int address_list_idx = 0; address_list_idx < CRUCIAL_ADDRESS_COUNT; address_list_idx++)
{
new_crucial = new CrucialController(busses[bus], crucial_addresses[address_list_idx]);
new_controller = new RGBController_Crucial(new_crucial);
rgb_controllers.push_back(new_controller);
if (TestForCrucialController(busses[bus], crucial_addresses[address_list_idx]))
{
new_crucial = new CrucialController(busses[bus], crucial_addresses[address_list_idx]);
new_controller = new RGBController_Crucial(new_crucial);
rgb_controllers.push_back(new_controller);
}
}
}
}
} /* DetectCrucialControllers() */
REGISTER_I2C_DETECTOR("Crucial", DetectCrucialControllers);
@@ -0,0 +1,495 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_Dummy.h"
#include "SettingsManager.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <string>
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int debug_keyboard_matrix_map[6][23] =
{ { 0, NA, 16, 30, 44, 54, NA, 65, 75, 84, 95, NA, 8, 23 , 38, 6 , 22, 36, 49, NA, NA, NA, NA },
{ 1, 17, 31, 45, 55, 66, 76, 85, 96, 9, 24, NA, 39, 7 , 37, NA , 60, 70, 80, 52, 63, 73, 82 },
{ 2, NA, 18, 32, 46, 56, NA, 67, 77, 86, 97, 10, 25, 40 , 90, 101, 50, 61, 71, 51, 62, 72, 93 },
{ 3, NA, 19, 33, 47, 57, NA, 68, 78, 87, 98, 11, 26, 41 , 28, 14 , NA, NA, NA, 92, 103, 53, NA },
{ 4, 20, 34, 48, 58, 69, NA, 79, NA, 88, 99, 12, 27, 42 , 81, NA , NA, 102, NA, 64, 74, 83, 104 },
{ 5, 21, 35, NA, NA, NA, NA, 59, NA, NA, NA, NA, 89, 100, 13, 91 , 15, 29, 43, 94, NA, 105, NA } };
static const char *led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: F12",
"Key: =",
"Key: F9",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Key: Menu",
"Key: Enter (ISO)",
"Key: Left Arrow",
"Key: F1",
"Key: 1",
"Key: Q",
"Key: A",
"Key: \\ (ISO)",
"Key: Left Windows",
"Key: Print Screen",
"Key: F10",
"Key: 0",
"Key: P",
"Key: ;",
"Key: .",
"Key: Enter",
"Key: Down Arrow",
"Key: F2",
"Key: 2",
"Key: W",
"Key: S",
"Key: Z",
"Key: Left Alt",
"Key: Scroll Lock",
"Key: Backspace",
"Key: F11",
"Key: -",
"Key: [",
"Key: '",
"Key: /",
"Key: Right Arrow",
"Key: F3",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Key: Pause/Break",
"Key: Delete",
"Key: Number Pad 7",
"Key: Num Lock",
"Key: Number Pad 6",
"Key: F4",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Key: Space",
"Key: Insert",
"Key: End",
"Key: Number Pad 8",
"Key: Number Pad /",
"Key: Number Pad 1",
"Key: F5",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Key: Home",
"Key: Page Down",
"Key: Number Pad 9",
"Key: Number Pad *",
"Key: Number Pad 2",
"Key: F6",
"Key: 6",
"Key: Y",
"Key: H",
"Key: B",
"Key: Page Up",
"Key: Right Shift",
"Key: Number Pad -",
"Key: Number Pad 3",
"Key: F7",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Key: Right Alt",
"Key: ]",
"Key: Right Control",
"Key: Number Pad 4",
"Key: Number Pad +",
"Key: Number Pad 0",
"Key: F8",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Key: Right Windows",
"Key: \\ (ANSI)",
"Key: Up Arrow",
"Key: Number Pad 5",
"Key: Number Pad Enter",
"Key: Number Pad .",
"RGB Strip 1",
"RGB Strip 2",
"RGB Strip 3",
"RGB Strip 4",
"RGB Strip 5",
"RGB Strip 6",
"RGB Strip 7",
"RGB Strip 8",
"RGB Strip 9",
"RGB Strip 10",
"RGB Strip 11",
"RGB Strip 12",
"RGB Strip 13",
"RGB Strip 14",
"RGB Strip 15",
"RGB Strip 16",
"RGB Strip 17",
"RGB Strip 18",
"Key: Media Previous",
"Key: Media Play/Pause",
"Key: Media Next",
"Key: Media Mute"
};
/******************************************************************************************\
* *
* DetectDebugControllers *
* *
* Add dummy controllers based on debug.txt *
* *
\******************************************************************************************/
void DetectDebugControllers(std::vector<RGBController*> &rgb_controllers)
{
json debug_settings;
/*-------------------------------------------------*\
| Get Debug Device settings from settings manager |
\*-------------------------------------------------*/
debug_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Setting_DebugDevices");
/*-------------------------------------------------*\
| If the Debug settings contains devices, process |
\*-------------------------------------------------*/
if(debug_settings.contains("devices"))
{
for(unsigned int device_idx = 0; device_idx < debug_settings["devices"].size(); device_idx++)
{
std::string type = "";
if(debug_settings["devices"][device_idx].contains("type"))
{
type = debug_settings["devices"][device_idx]["type"];
}
if(type == "motherboard")
{
/*---------------------------------------------------------*\
| Create a dummy motherboard |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_motherboard = new RGBController_Dummy();
dummy_motherboard->name = "Debug Motherboard";
dummy_motherboard->type = DEVICE_TYPE_MOTHERBOARD;
dummy_motherboard->description = "Debug Motherboard Device";
dummy_motherboard->location = "Debug Motherboard Location";
dummy_motherboard->version = "Debug Motherboard Version";
dummy_motherboard->serial = "Debug Motherboard Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy motherboard |
\*---------------------------------------------------------*/
mode dummy_motherboard_direct_mode;
dummy_motherboard_direct_mode.name = "Direct";
dummy_motherboard_direct_mode.value = 0;
dummy_motherboard_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_motherboard_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_motherboard->modes.push_back(dummy_motherboard_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy motherboard |
\*---------------------------------------------------------*/
zone dummy_motherboard_single_zone;
dummy_motherboard_single_zone.name = "Single Zone";
dummy_motherboard_single_zone.type = ZONE_TYPE_SINGLE;
dummy_motherboard_single_zone.leds_min = 1;
dummy_motherboard_single_zone.leds_max = 1;
dummy_motherboard_single_zone.leds_count = 1;
dummy_motherboard_single_zone.matrix_map = NULL;
dummy_motherboard->zones.push_back(dummy_motherboard_single_zone);
led dummy_motherboard_single_led;
dummy_motherboard_single_led.name = "Single LED";
dummy_motherboard->leds.push_back(dummy_motherboard_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy motherboard |
\*---------------------------------------------------------*/
zone dummy_motherboard_linear_zone;
dummy_motherboard_linear_zone.name = "Linear Zone";
dummy_motherboard_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_motherboard_linear_zone.leds_min = 10;
dummy_motherboard_linear_zone.leds_max = 10;
dummy_motherboard_linear_zone.leds_count = 10;
dummy_motherboard_linear_zone.matrix_map = NULL;
dummy_motherboard->zones.push_back(dummy_motherboard_linear_zone);
for(std::size_t led_idx = 0; led_idx < 10; led_idx++)
{
led dummy_motherboard_linear_led;
dummy_motherboard_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_motherboard->leds.push_back(dummy_motherboard_linear_led);
}
dummy_motherboard->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy motherboard onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_motherboard);
}
else if(type == "dram")
{
/*---------------------------------------------------------*\
| Create a dummy DRAM |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_dram = new RGBController_Dummy();
dummy_dram->name = "Debug DRAM";
dummy_dram->type = DEVICE_TYPE_DRAM;
dummy_dram->description = "Debug DRAM Device";
dummy_dram->location = "Debug DRAM Location";
dummy_dram->version = "Debug DRAM Version";
dummy_dram->serial = "Debug DRAM Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy DRAM |
\*---------------------------------------------------------*/
mode dummy_dram_direct_mode;
dummy_dram_direct_mode.name = "Direct";
dummy_dram_direct_mode.value = 0;
dummy_dram_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_dram_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_dram->modes.push_back(dummy_dram_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy DRAM |
\*---------------------------------------------------------*/
zone dummy_dram_single_zone;
dummy_dram_single_zone.name = "Single Zone";
dummy_dram_single_zone.type = ZONE_TYPE_SINGLE;
dummy_dram_single_zone.leds_min = 1;
dummy_dram_single_zone.leds_max = 1;
dummy_dram_single_zone.leds_count = 1;
dummy_dram_single_zone.matrix_map = NULL;
dummy_dram->zones.push_back(dummy_dram_single_zone);
led dummy_dram_single_led;
dummy_dram_single_led.name = "Single LED";
dummy_dram->leds.push_back(dummy_dram_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy DRAM |
\*---------------------------------------------------------*/
zone dummy_dram_linear_zone;
dummy_dram_linear_zone.name = "Linear Zone";
dummy_dram_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_dram_linear_zone.leds_min = 5;
dummy_dram_linear_zone.leds_max = 5;
dummy_dram_linear_zone.leds_count = 5;
dummy_dram_linear_zone.matrix_map = NULL;
dummy_dram->zones.push_back(dummy_dram_linear_zone);
for(std::size_t led_idx = 0; led_idx < 5; led_idx++)
{
led dummy_dram_linear_led;
dummy_dram_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_dram->leds.push_back(dummy_dram_linear_led);
}
dummy_dram->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy DRAM onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_dram);
}
else if(type == "gpu")
{
/*---------------------------------------------------------*\
| Create a dummy GPU |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_gpu = new RGBController_Dummy();
dummy_gpu->name = "Debug GPU";
dummy_gpu->type = DEVICE_TYPE_GPU;
dummy_gpu->description = "Debug GPU Device";
dummy_gpu->location = "Debug GPU Location";
dummy_gpu->version = "Debug GPU Version";
dummy_gpu->serial = "Debug GPU Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy GPU |
\*---------------------------------------------------------*/
mode dummy_gpu_direct_mode;
dummy_gpu_direct_mode.name = "Direct";
dummy_gpu_direct_mode.value = 0;
dummy_gpu_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_gpu_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_gpu->modes.push_back(dummy_gpu_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_gpu_single_zone;
dummy_gpu_single_zone.name = "Single Zone";
dummy_gpu_single_zone.type = ZONE_TYPE_SINGLE;
dummy_gpu_single_zone.leds_min = 1;
dummy_gpu_single_zone.leds_max = 1;
dummy_gpu_single_zone.leds_count = 1;
dummy_gpu_single_zone.matrix_map = NULL;
dummy_gpu->zones.push_back(dummy_gpu_single_zone);
led dummy_gpu_single_led;
dummy_gpu_single_led.name = "Single LED";
dummy_gpu->leds.push_back(dummy_gpu_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_gpu_linear_zone;
dummy_gpu_linear_zone.name = "Linear Zone";
dummy_gpu_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_gpu_linear_zone.leds_min = 15;
dummy_gpu_linear_zone.leds_max = 15;
dummy_gpu_linear_zone.leds_count = 15;
dummy_gpu_linear_zone.matrix_map = NULL;
dummy_gpu->zones.push_back(dummy_gpu_linear_zone);
for(std::size_t led_idx = 0; led_idx < 15; led_idx++)
{
led dummy_gpu_linear_led;
dummy_gpu_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_gpu->leds.push_back(dummy_gpu_linear_led);
}
dummy_gpu->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy GPU onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_gpu);
}
else if(type == "keyboard")
{
/*---------------------------------------------------------*\
| Create a dummy Keyboard |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_keyboard = new RGBController_Dummy();
dummy_keyboard->name = "Debug Keyboard";
dummy_keyboard->type = DEVICE_TYPE_KEYBOARD;
dummy_keyboard->description = "Debug Keyboard Device";
dummy_keyboard->location = "Debug Keyboard Location";
dummy_keyboard->version = "Debug Keyboard Version";
dummy_keyboard->serial = "Debug Keyboard Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy GPU |
\*---------------------------------------------------------*/
mode dummy_gpu_direct_mode;
dummy_gpu_direct_mode.name = "Direct";
dummy_gpu_direct_mode.value = 0;
dummy_gpu_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_gpu_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_keyboard->modes.push_back(dummy_gpu_direct_mode);
/*---------------------------------------------------------*\
| Create a matrix zone for the debug Keyboard |
\*---------------------------------------------------------*/
zone dummy_keyboard_matrix_zone;
dummy_keyboard_matrix_zone.name = "Keyboard Matrix Zone";
dummy_keyboard_matrix_zone.type = ZONE_TYPE_MATRIX;
dummy_keyboard_matrix_zone.leds_min = 106;
dummy_keyboard_matrix_zone.leds_max = 106;
dummy_keyboard_matrix_zone.leds_count = 106;
dummy_keyboard_matrix_zone.matrix_map = new matrix_map_type;
dummy_keyboard_matrix_zone.matrix_map->height = 6;
dummy_keyboard_matrix_zone.matrix_map->width = 23;
dummy_keyboard_matrix_zone.matrix_map->map = (unsigned int*)&debug_keyboard_matrix_map;
dummy_keyboard->zones.push_back(dummy_keyboard_matrix_zone);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_keyboard_linear_zone;
dummy_keyboard_linear_zone.name = "Linear Zone";
dummy_keyboard_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_keyboard_linear_zone.leds_min = 18;
dummy_keyboard_linear_zone.leds_max = 18;
dummy_keyboard_linear_zone.leds_count = 18;
dummy_keyboard_linear_zone.matrix_map = NULL;
dummy_keyboard->zones.push_back(dummy_keyboard_linear_zone);
for(std::size_t led_idx = 0; led_idx < 124; led_idx++)
{
led dummy_keyboard_led;
dummy_keyboard_led.name = led_names[led_idx];
dummy_keyboard->leds.push_back(dummy_keyboard_led);
}
dummy_keyboard->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy Keyboard onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_keyboard);
}
}
}
} /* DetectDebugControllers() */
REGISTER_DETECTOR("Debug Controllers", DetectDebugControllers);
@@ -10,9 +10,10 @@
#include <cstring>
#include "DuckyKeyboardController.h"
DuckyKeyboardController::DuckyKeyboardController(hid_device* dev_handle)
DuckyKeyboardController::DuckyKeyboardController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
SendInitialize();
}
@@ -22,6 +23,11 @@ DuckyKeyboardController::~DuckyKeyboardController()
}
std::string DuckyKeyboardController::GetDeviceLocation()
{
return(location);
}
void DuckyKeyboardController::SendColors
(
unsigned char* color_data,
@@ -184,4 +190,4 @@ void DuckyKeyboardController::SendTerminateColorPacket()
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
}
@@ -17,9 +17,11 @@
class DuckyKeyboardController
{
public:
DuckyKeyboardController(hid_device* dev_handle);
DuckyKeyboardController(hid_device* dev_handle, const char* path);
~DuckyKeyboardController();
std::string GetDeviceLocation();
void SendColors
(
unsigned char* color_data,
@@ -28,6 +30,7 @@ public:
private:
hid_device* dev;
std::string location;
void SendInitialize();
void SendInitializeColorPacket();
@@ -38,4 +41,4 @@ private:
unsigned int color_size
);
void SendTerminateColorPacket();
};
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "DuckyKeyboardController.h"
#include "RGBController.h"
#include "RGBController_DuckyKeyboard.h"
@@ -66,7 +67,7 @@ void DetectDuckyKeyboardControllers(std::vector<RGBController*>& rgb_controllers
if( dev )
{
DuckyKeyboardController* controller = new DuckyKeyboardController(dev);
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path);
RGBController_DuckyKeyboard* rgb_controller = new RGBController_DuckyKeyboard(controller);
@@ -78,4 +79,6 @@ void DetectDuckyKeyboardControllers(std::vector<RGBController*>& rgb_controllers
info = info->next;
}
}
}
} /* DetectDuckyKeyboardControllers() */
REGISTER_DETECTOR("Ducky Keyboard", DetectDuckyKeyboardControllers);
@@ -0,0 +1,279 @@
/*-----------------------------------------*\
| RGBController_DuckyKeyboard.cpp |
| |
| Generic RGB Interface for Ducky RGB |
| keyboard devices |
| |
| Adam Honse (CalcProgrammer1) 7/4/2020 |
\*-----------------------------------------*/
#include "RGBController_DuckyKeyboard.h"
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 12, 18, 24, 30, NA, 42, 48, 54, 60, NA, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126 },
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, NA, 67, 73, 85, NA, 91, 97, 103, 109, 115, 121, 127 },
{ 2, NA, 8, 14, 20, 26, NA, 32, 38, 44, 50, 56, 62, 68, 74, 86, 92, 98, 104, 110, 116, 122, 128 },
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 87, NA, NA, NA, NA, 111, 117, 123, NA },
{ 4, NA, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, 112, 118, 124, 131 },
{ 5, 11, 17, NA, NA, NA, NA, 41, NA, NA, NA, NA, 65, 77, 83, 89, 95, 101, 107, 113, NA, 125, NA } };
static const char* zone_names[] =
{
"Keyboard"
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
132
};
static const char *led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Unused",
"Key: 1",
"Key: Q",
"Key: A",
"Unused",
"Key: Left Windows",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: Z",
"Key: Left Alt",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Unused",
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Unused",
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Unused",
"Unused",
"Key: 6",
"Key: Y",
"Key: H",
"Key: B",
"Key: Space",
"Key: F5",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Unused",
"Key: F6",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Unused",
"Key: F7",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Unused",
"Key: F8",
"Key: 0",
"Key: P",
"Key: ;",
"Key: .",
"Key: Right Alt",
"Key: F9",
"Key: -",
"Key: [",
"Key: '",
"Key: /",
"Unused",
"Key: F10",
"Key: =",
"Key: ]",
"Unused",
"Unused",
"Key: Right Windows",
"Key: F11",
"Unused",
"Unused",
"Unused",
"Key: Right Shift",
"Key: Right Fn",
"Key: F12",
"Key: Backspace",
"Key: \\ (ANSI)",
"Key: Enter",
"Unused",
"Key: Right Control",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
"Unused",
"Unused",
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
"Unused",
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
"Unused",
"Unused",
"Key: Right Arrow",
"Key: Calculator",
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
"Key: Media Mute",
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
"Unused",
"Key: Media Volume Down",
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad .",
"Key: Media Volume Up",
"Key: Number Pad -",
"Key: Number Pad +",
"Unused",
"Unused",
"Key: Number Pad Enter",
};
RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController* ducky_ptr)
{
ducky = ducky_ptr;
name = "Ducky Keyboard Device";
type = DEVICE_TYPE_KEYBOARD;
description = "Ducky Keyboard Device";
location = ducky->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_DuckyKeyboard::~RGBController_DuckyKeyboard()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_DuckyKeyboard::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_DuckyKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_DuckyKeyboard::DeviceUpdateLEDs()
{
unsigned char colordata[155*3];
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
colordata[(color_idx*3)+0] = RGBGetRValue(colors[color_idx]);
colordata[(color_idx*3)+1] = RGBGetGValue(colors[color_idx]);
colordata[(color_idx*3)+2] = RGBGetBValue(colors[color_idx]);
}
ducky->SendColors(colordata, sizeof(colordata));
}
void RGBController_DuckyKeyboard::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_DuckyKeyboard::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_DuckyKeyboard::SetCustomMode()
{
}
void RGBController_DuckyKeyboard::DeviceUpdateMode()
{
}
@@ -0,0 +1,238 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_E131.h"
#include "SettingsManager.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <string>
/******************************************************************************************\
* *
* DetectE131Controllers *
* *
* Detect devices supported by the E131 driver *
* *
\******************************************************************************************/
void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
{
json e131_settings;
std::vector<std::vector<E131Device>> device_lists;
E131Device dev;
/*-------------------------------------------------*\
| Get E1.31 settings from settings manager |
\*-------------------------------------------------*/
e131_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Setting_E131Devices");
/*-------------------------------------------------*\
| If the E1.31 settings contains devices, process |
\*-------------------------------------------------*/
if(e131_settings.contains("devices"))
{
for(unsigned int device_idx = 0; device_idx < e131_settings["devices"].size(); device_idx++)
{
/*-------------------------------------------------*\
| Clear E1.31 device data |
\*-------------------------------------------------*/
dev.name = "";
dev.type = ZONE_TYPE_SINGLE;
dev.num_leds = 0;
dev.rgb_order = E131_RGB_ORDER_RBG;
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
dev.matrix_width = 0;
dev.matrix_height = 0;
dev.start_channel = 1;
dev.start_universe = 1;
if(e131_settings["devices"][device_idx].contains("name"))
{
dev.name = e131_settings["devices"][device_idx]["name"];
}
if(e131_settings["devices"][device_idx].contains("num_leds"))
{
dev.num_leds = e131_settings["devices"][device_idx]["num_leds"];
}
if(e131_settings["devices"][device_idx].contains("start_universe"))
{
dev.start_universe = e131_settings["devices"][device_idx]["start_universe"];
}
if(e131_settings["devices"][device_idx].contains("start_channel"))
{
dev.start_channel = e131_settings["devices"][device_idx]["start_channel"];
}
if(e131_settings["devices"][device_idx].contains("matrix_order"))
{
std::string matrix_order_val = e131_settings["devices"][device_idx]["matrix_order"];
if(matrix_order_val == "HORIZONTAL_TOP_LEFT")
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
}
else if(matrix_order_val == "HORIZONTAL_TOP_RIGHT")
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT;
}
else if(matrix_order_val == "HORIZONTAL_BOTTOM_LEFT")
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT;
}
else if(matrix_order_val == "HORIZONTAL_BOTTOM_RIGHT")
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT;
}
else if(matrix_order_val == "VERTICAL_TOP_LEFT")
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_LEFT;
}
else if(matrix_order_val == "VERTICAL_TOP_RIGHT")
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT;
}
else if(matrix_order_val == "VERTICAL_BOTTOM_LEFT")
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT;
}
else if(matrix_order_val == "VERTICAL_BOTTOM_RIGHT")
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT;
}
else
{
dev.matrix_order = e131_settings["devices"][device_idx]["matrix_order"];
}
}
if(e131_settings["devices"][device_idx].contains("rgb_order"))
{
std::string rgb_order_val = e131_settings["devices"][device_idx]["rgb_order"];
if(rgb_order_val == "RGB")
{
dev.rgb_order = E131_RGB_ORDER_RGB;
}
else if(rgb_order_val == "RBG")
{
dev.rgb_order = E131_RGB_ORDER_RBG;
}
else if(rgb_order_val == "GRB")
{
dev.rgb_order = E131_RGB_ORDER_GRB;
}
else if(rgb_order_val == "GBR")
{
dev.rgb_order = E131_RGB_ORDER_GBR;
}
else if(rgb_order_val == "BRG")
{
dev.rgb_order = E131_RGB_ORDER_BGR;
}
else if(rgb_order_val == "BGR")
{
dev.rgb_order = E131_RGB_ORDER_BGR;
}
else
{
dev.rgb_order = e131_settings["devices"][device_idx]["rgb_order"];
}
}
if(e131_settings["devices"][device_idx].contains("matrix_width"))
{
dev.matrix_width = e131_settings["devices"][device_idx]["matrix_width"];
}
if(e131_settings["devices"][device_idx].contains("matrix_height"))
{
dev.matrix_height = e131_settings["devices"][device_idx]["matrix_height"];
}
if(e131_settings["devices"][device_idx].contains("type"))
{
std::string type_val = e131_settings["devices"][device_idx]["type"];
if(type_val == "SINGLE")
{
dev.type = ZONE_TYPE_SINGLE;
}
else if(type_val == "LINEAR")
{
dev.type = ZONE_TYPE_LINEAR;
}
else if(type_val == "MATRIX")
{
dev.type = ZONE_TYPE_MATRIX;
}
else
{
dev.type = e131_settings["devices"][device_idx]["type"];
}
}
/*---------------------------------------------------------*\
| Determine whether to create a new list or add this device |
| to an existing list. A device is added to an existing |
| list if both devices share one or more universes for the |
| same output destination |
\*---------------------------------------------------------*/
bool device_added_to_existing_list = false;
for(unsigned int list_idx = 0; list_idx < device_lists.size(); list_idx++)
{
for(unsigned int device_idx = 0; device_idx < device_lists[list_idx].size(); device_idx++)
{
/*---------------------------------------------------------*\
| Check if any universes used by this new device exist in |
| the existing device. If so, add the new device to the |
| existing list. |
\*---------------------------------------------------------*/
if(dev.start_universe == device_lists[list_idx][device_idx].start_universe)
{
device_lists[list_idx].push_back(dev);
device_added_to_existing_list = true;
break;
}
}
if(device_added_to_existing_list)
{
break;
}
}
/*---------------------------------------------------------*\
| If the device did not overlap with existing devices, |
| create a new list for it |
\*---------------------------------------------------------*/
if(!device_added_to_existing_list)
{
std::vector<E131Device> new_list;
new_list.push_back(dev);
device_lists.push_back(new_list);
}
}
for(unsigned int list_idx = 0; list_idx < device_lists.size(); list_idx++)
{
RGBController_E131* rgb_controller;
rgb_controller = new RGBController_E131(device_lists[list_idx]);
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectE131Controllers() */
REGISTER_DETECTOR("E1.31", DetectE131Controllers);
@@ -0,0 +1,424 @@
/*-----------------------------------------*\
| RGBController_LEDStrip.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| E1.31 Streaming ACN interface |
| |
| Adam Honse (CalcProgrammer1) 10/18/2019 |
\*-----------------------------------------*/
#include "RGBController_E131.h"
#include <e131.h>
#include <math.h>
using namespace std::chrono_literals;
RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
{
devices = device_list;
name = "E1.31 Device Group";
type = DEVICE_TYPE_LEDSTRIP;
description = "E1.31 Streaming ACN Device";
location = "E1.31: ";
/*-----------------------------------------*\
| If this controller only represents a |
| single device, use the device name for the|
| controller name |
\*-----------------------------------------*/
if(devices.size() == 1)
{
name = devices[0].name;
}
/*-----------------------------------------*\
| Append the destination address to the |
| location field (multicast only for now) |
\*-----------------------------------------*/
location += "Multicast, ";
/*-----------------------------------------*\
| Calculate universe list |
| Use this to fill in the location field |
\*-----------------------------------------*/
std::vector<unsigned int> universe_list;
for(unsigned int device_idx = 0; device_idx < devices.size(); device_idx++)
{
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
for(unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
{
bool found = false;
for(unsigned int univ_list_idx = 0; univ_list_idx < universe_list.size(); univ_list_idx++)
{
if((devices[device_idx].start_universe + univ_idx) == universe_list[univ_list_idx])
{
found = true;
break;
}
}
if(!found)
{
universe_list.push_back(devices[device_idx].start_universe + univ_idx);
}
}
}
/*-----------------------------------------*\
| Append "Universe" and make plural if there|
| are multiple universes in use |
\*-----------------------------------------*/
location += "Universe";
if(universe_list.size() > 1)
{
location += "s ";
}
else
{
location += " ";
}
/*-----------------------------------------*\
| Append comma separated list of universes |
\*-----------------------------------------*/
for(unsigned int univ_list_idx = 0; univ_list_idx < universe_list.size(); univ_list_idx++)
{
location += std::to_string(universe_list[univ_list_idx]);
if(univ_list_idx < (universe_list.size() - 1))
{
location += ", ";
}
}
/*-----------------------------------------*\
| Set up modes |
\*-----------------------------------------*/
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
/*-----------------------------------------*\
| Create E1.31 socket |
\*-----------------------------------------*/
sockfd = e131_socket();
keepalive_delay = 0ms;
SetupZones();
for (std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
{
/*-----------------------------------------*\
| Update keepalive delay |
\*-----------------------------------------*/
if(devices[device_idx].keepalive_time > 0)
{
if(keepalive_delay.count() == 0 || keepalive_delay.count() > devices[device_idx].keepalive_time)
{
keepalive_delay = std::chrono::milliseconds(devices[device_idx].keepalive_time);
}
}
/*-----------------------------------------*\
| Add Universes |
\*-----------------------------------------*/
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
for (unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
{
unsigned int universe = devices[device_idx].start_universe + univ_idx;
bool universe_exists = false;
for (std::size_t pkt_idx = 0; pkt_idx < packets.size(); pkt_idx++)
{
if(universes[pkt_idx] == universe)
{
universe_exists = true;
}
}
if(!universe_exists)
{
e131_packet_t packet;
e131_addr_t dest_addr;
e131_pkt_init(&packet, universe, 512);
e131_multicast_dest(&dest_addr, universe, E131_DEFAULT_PORT);
packets.push_back(packet);
universes.push_back(universe);
dest_addrs.push_back(dest_addr);
}
}
/*-----------------------------------------*\
| Generate matrix maps |
\*-----------------------------------------*/
if(devices[device_idx].type == ZONE_TYPE_MATRIX)
{
unsigned int led_idx = 0;
matrix_map_type * new_map = new matrix_map_type;
new_map->width = devices[device_idx].matrix_width;
new_map->height = devices[device_idx].matrix_height;
new_map->map = new unsigned int[devices[device_idx].matrix_width * devices[device_idx].matrix_height];
switch(devices[device_idx].matrix_order)
{
case E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT:
for(unsigned int y = 0; y < new_map->height; y++)
{
for(unsigned int x = 0; x < new_map->width; x++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT:
for(unsigned int y = 0; y < new_map->height; y++)
{
for(int x = new_map->width - 1; x >= 0; x--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT:
for(int y = new_map->height; y >= 0; y--)
{
for(unsigned int x = 0; x < new_map->width; x++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT:
for(int y = new_map->height; y >= 0; y--)
{
for(int x = new_map->width - 1; x >= 0; x--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_TOP_LEFT:
for(unsigned int x = 0; x < new_map->width; x++)
{
for(unsigned int y = 0; y < new_map->height; y++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT:
for(int x = new_map->width - 1; x >= 0; x--)
{
for(unsigned int y = 0; y < new_map->height; y++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT:
for(unsigned int x = 0; x < new_map->width; x++)
{
for(int y = new_map->height - 1; y >= 0; y--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT:
for(int x = new_map->width - 1; x >= 0; x--)
{
for(int y = new_map->height - 1; y >= 0; y--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
}
zones[device_idx].matrix_map = new_map;
}
}
if(keepalive_delay.count() > 0)
{
KeepaliveThread = new std::thread(&RGBController_E131::KeepaliveThreadFunction, this);
}
}
RGBController_E131::~RGBController_E131()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
if(zones[zone_index].matrix_map->map != NULL)
{
delete zones[zone_index].matrix_map->map;
}
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_E131::SetupZones()
{
/*-----------------------------------------*\
| Add Zones |
\*-----------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < devices.size(); zone_idx++)
{
zone led_zone;
led_zone.name = devices[zone_idx].name;
led_zone.type = devices[zone_idx].type;
led_zone.leds_min = devices[zone_idx].num_leds;
led_zone.leds_max = devices[zone_idx].num_leds;
led_zone.leds_count = devices[zone_idx].num_leds;
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
}
/*-----------------------------------------*\
| Add LEDs |
\*-----------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
led new_led;
new_led.name = zones[zone_idx].name + " LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_E131::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_E131::DeviceUpdateLEDs()
{
int color_idx = 0;
last_update_time = std::chrono::steady_clock::now();
for(std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
{
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
unsigned int channel_idx = devices[device_idx].start_channel;
unsigned int led_idx = 0;
unsigned int rgb_idx = 0;
bool done = false;
for (unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
{
unsigned int universe = devices[device_idx].start_universe + univ_idx;
for(std::size_t packet_idx = 0; packet_idx < packets.size(); packet_idx++)
{
if(!done && (universes[packet_idx] == universe))
{
while(!done && (channel_idx <= 512))
{
switch(rgb_idx)
{
case 0:
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetRValue( colors[color_idx] );
rgb_idx = 1;
break;
case 1:
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetGValue( colors[color_idx] );
rgb_idx = 2;
break;
case 2:
packets[packet_idx].dmp.prop_val[channel_idx] = RGBGetBValue( colors[color_idx] );
rgb_idx = 0;
led_idx++;
color_idx++;
break;
}
if(led_idx >= devices[device_idx].num_leds)
{
done = true;
}
channel_idx++;
}
}
}
channel_idx = 1;
}
}
for(std::size_t packet_idx = 0; packet_idx < packets.size(); packet_idx++)
{
e131_send(sockfd, &packets[packet_idx], &dest_addrs[packet_idx]);
packets[packet_idx].frame.seq_number++;
}
}
void RGBController_E131::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_E131::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_E131::SetCustomMode()
{
}
void RGBController_E131::DeviceUpdateMode()
{
}
void RGBController_E131::KeepaliveThreadFunction()
{
while(1)
{
if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) )
{
UpdateLEDs();
}
std::this_thread::sleep_for(keepalive_delay / 2);
}
}
@@ -0,0 +1,84 @@
/*-----------------------------------------*\
| RGBController_E131.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| E1.31 Streaming ACN interface |
| |
| Adam Honse (CalcProgrammer1) 10/18/2019 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include <e131.h>
#include <chrono>
#include <thread>
typedef unsigned int e131_rgb_order;
enum
{
E131_RGB_ORDER_RGB,
E131_RGB_ORDER_RBG,
E131_RGB_ORDER_GRB,
E131_RGB_ORDER_GBR,
E131_RGB_ORDER_BRG,
E131_RGB_ORDER_BGR
};
enum
{
E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT,
E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT,
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT,
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT,
E131_MATRIX_ORDER_VERTICAL_TOP_LEFT,
E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT,
E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT,
E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT
};
typedef unsigned int e131_matrix_order;
struct E131Device
{
std::string name;
unsigned int num_leds;
unsigned int start_universe;
unsigned int start_channel;
unsigned int keepalive_time;
e131_rgb_order rgb_order;
zone_type type;
unsigned int matrix_width;
unsigned int matrix_height;
e131_matrix_order matrix_order;
};
class RGBController_E131 : public RGBController
{
public:
RGBController_E131(std::vector<E131Device> device_list);
~RGBController_E131();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void KeepaliveThreadFunction();
private:
std::vector<E131Device> devices;
std::vector<e131_packet_t> packets;
std::vector<e131_addr_t> dest_addrs;
std::vector<unsigned int> universes;
int sockfd;
std::thread * KeepaliveThread;
std::chrono::milliseconds keepalive_delay;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};
+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,97 @@
#include "Detector.h"
#include "EVGAGPUv1Controller.h"
#include "EVGAGPUv2Controller.h"
#include "RGBController.h"
#include "RGBController_EVGAGPUv1.h"
#include "RGBController_EVGAGPUv2.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
enum
{
EVGA_RGB_V1,
EVGA_RGB_V2,
};
typedef struct
{
int pci_vendor;
int pci_device;
int pci_subsystem_vendor;
int pci_subsystem_device;
int gpu_rgb_version;
const char * name;
} gpu_pci_device;
#define GPU_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1070 FTW" },
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, EVGA_SUB_VEN, EVGA_RTX2070_XC_OC_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 XC OC" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_XC_ULTRA_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER XC ULTRA" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, EVGA_SUB_VEN, EVGA_RTX2080_XC_GAMING_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2080 XC GAMING" },
};
/******************************************************************************************\
* *
* DetectEVGAGPUControllers *
* *
* Detect EVGA GPU controllers on the enumerated I2C busses at address 0x49. *
* *
* bus - pointer to i2c_smbus_interface where EVGA GPU device is connected *
* dev - I2C address of EVGA GPU device *
* *
\******************************************************************************************/
void DetectEVGAGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
{
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
for(unsigned int dev_idx = 0; dev_idx < GPU_NUM_DEVICES; dev_idx++)
{
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)
{
switch(device_list[dev_idx].gpu_rgb_version)
{
case EVGA_RGB_V1:
{
EVGAGPUv1Controller* new_controller;
RGBController_EVGAGPUv1* new_rgbcontroller;
new_controller = new EVGAGPUv1Controller(busses[bus], 0x49);
new_rgbcontroller = new RGBController_EVGAGPUv1(new_controller);
new_rgbcontroller->name = device_list[dev_idx].name;
rgb_controllers.push_back(new_rgbcontroller);
}
break;
case EVGA_RGB_V2:
{
EVGAGPUv2Controller* new_controller;
RGBController_EVGAGPUv2* new_rgbcontroller;
new_controller = new EVGAGPUv2Controller(busses[bus], 0x49);
new_rgbcontroller = new RGBController_EVGAGPUv2(new_controller);
new_rgbcontroller->name = device_list[dev_idx].name;
rgb_controllers.push_back(new_rgbcontroller);
}
break;
}
}
}
}
} /* DetectEVGAGPUControllers() */
REGISTER_I2C_DETECTOR("EVGA GPU", DetectEVGAGPUControllers);
@@ -0,0 +1,58 @@
/*-----------------------------------------*\
| EVGAGPUv1Controller.cpp |
| |
| Driver for EVGA GPU RGB V1 (Pascal) |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 9/11/2020 |
\*-----------------------------------------*/
#include "EVGAGPUv1Controller.h"
EVGAGPUv1Controller::EVGAGPUv1Controller(i2c_smbus_interface* bus, evga_dev_id dev)
{
this->bus = bus;
this->dev = dev;
}
EVGAGPUv1Controller::~EVGAGPUv1Controller()
{
}
std::string EVGAGPUv1Controller::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("I2C: " + return_string);
}
unsigned char EVGAGPUv1Controller::GetRed()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_RED));
}
unsigned char EVGAGPUv1Controller::GetGreen()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_GREEN));
}
unsigned char EVGAGPUv1Controller::GetBlue()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_BLUE));
}
void EVGAGPUv1Controller::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_RED, red);
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_GREEN, green);
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_BLUE, blue);
}
void EVGAGPUv1Controller::SetMode(unsigned char mode)
{
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V1_REG_MODE, mode);
}
@@ -0,0 +1,52 @@
/*-----------------------------------------*\
| EVGAGPUv1Controller.h |
| |
| Definitions and types for EVGA GPU RGB |
| V1 (Pascal) lighting controller |
| |
| Adam Honse (CalcProgrammer1) 9/11/2020 |
\*-----------------------------------------*/
#include <string>
#include "i2c_smbus.h"
#pragma once
typedef unsigned char evga_dev_id;
enum
{
EVGA_GPU_V1_REG_MODE = 0x0C,
EVGA_GPU_V1_REG_RED = 0x09,
EVGA_GPU_V1_REG_GREEN = 0x0A,
EVGA_GPU_V1_REG_BLUE = 0x0B,
};
enum
{
EVGA_GPU_V1_MODE_OFF = 0x00,
EVGA_GPU_V1_MODE_CUSTOM = 0x01,
EVGA_GPU_V1_MODE_RAINBOW = 0x02,
EVGA_GPU_V1_MODE_BREATHING = 0x05,
};
class EVGAGPUv1Controller
{
public:
EVGAGPUv1Controller(i2c_smbus_interface* bus, evga_dev_id dev);
~EVGAGPUv1Controller();
std::string GetDeviceLocation();
unsigned char GetRed();
unsigned char GetGreen();
unsigned char GetBlue();
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode);
private:
i2c_smbus_interface* bus;
evga_dev_id dev;
};
@@ -0,0 +1,68 @@
/*-----------------------------------------*\
| EVGAGPUv2Controller.cpp |
| |
| Driver for EVGA GPU RGB V2 (Turing) |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 9/13/2020 |
\*-----------------------------------------*/
#include "EVGAGPUv2Controller.h"
EVGAGPUv2Controller::EVGAGPUv2Controller(i2c_smbus_interface* bus, evga_dev_id dev)
{
this->bus = bus;
this->dev = dev;
}
EVGAGPUv2Controller::~EVGAGPUv2Controller()
{
}
std::string EVGAGPUv2Controller::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("I2C: " + return_string);
}
unsigned char EVGAGPUv2Controller::GetRed()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_RED));
}
unsigned char EVGAGPUv2Controller::GetGreen()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_GREEN));
}
unsigned char EVGAGPUv2Controller::GetBlue()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_BLUE));
}
void EVGAGPUv2Controller::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
bus->i2c_smbus_write_byte_data(dev, 0x0E, 0xE5);
bus->i2c_smbus_write_byte_data(dev, 0x0E, 0xE9);
bus->i2c_smbus_write_byte_data(dev, 0x0E, 0xF5);
bus->i2c_smbus_write_byte_data(dev, 0x0E, 0xF9);
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_RED, red);
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_GREEN, green);
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_BLUE, blue);
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_BRIGHTNESS, 0x64);
bus->i2c_smbus_write_byte_data(dev, 0x08, 0x01);
bus->i2c_smbus_write_byte_data(dev, 0x0E, 0xF0);
bus->i2c_smbus_write_byte_data(dev, 0x0E, 0xE0);
}
void EVGAGPUv2Controller::SetMode(unsigned char mode)
{
bus->i2c_smbus_write_byte_data(dev, EVGA_GPU_V2_REG_MODE, mode);
}
@@ -0,0 +1,57 @@
/*-----------------------------------------*\
| EVGAGPUv2Controller.h |
| |
| Definitions and types for EVGA GPU RGB |
| V2 (Turing) lighting controller |
| |
| Adam Honse (CalcProgrammer1) 9/13/2020 |
\*-----------------------------------------*/
#include <string>
#include "i2c_smbus.h"
#pragma once
typedef unsigned char evga_dev_id;
enum
{
EVGA_GPU_V2_REG_MODE = 0x60,
EVGA_GPU_V2_REG_COLOR_A_RED = 0x6C,
EVGA_GPU_V2_REG_COLOR_A_GREEN = 0x6D,
EVGA_GPU_V2_REG_COLOR_A_BLUE = 0x6E,
EVGA_GPU_V2_REG_COLOR_A_BRIGHTNESS = 0x6F,
EVGA_GPU_V2_REG_COLOR_B_RED = 0x70,
EVGA_GPU_V2_REG_COLOR_B_GREEN = 0x71,
EVGA_GPU_V2_REG_COLOR_B_BLUE = 0x72,
EVGA_GPU_V2_REG_COLOR_B_BRIGHTNESS = 0x73,
};
enum
{
EVGA_GPU_V2_MODE_OFF = 0x00,
EVGA_GPU_V2_MODE_CUSTOM = 0x01,
EVGA_GPU_V2_MODE_RAINBOW = 0x0F,
EVGA_GPU_V2_MODE_BREATHING = 0x22,
};
class EVGAGPUv2Controller
{
public:
EVGAGPUv2Controller(i2c_smbus_interface* bus, evga_dev_id dev);
~EVGAGPUv2Controller();
std::string GetDeviceLocation();
unsigned char GetRed();
unsigned char GetGreen();
unsigned char GetBlue();
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode);
private:
i2c_smbus_interface* bus;
evga_dev_id dev;
};
@@ -0,0 +1,118 @@
/*-----------------------------------------*\
| RGBController_EVGAGPUv1.cpp |
| |
| Generic RGB Interface for OpenRGB EVGA |
| GPU V1 (Pascal) Driver |
| |
| Adam Honse (CalcProgrammer1) 9/11/2020 |
\*-----------------------------------------*/
#include "RGBController_EVGAGPUv1.h"
RGBController_EVGAGPUv1::RGBController_EVGAGPUv1(EVGAGPUv1Controller* evga_ptr)
{
evga = evga_ptr;
name = "EVGA GPU";
description = "EVGA RGB v1 GPU Device";
location = evga->GetDeviceLocation();
type = DEVICE_TYPE_GPU;
mode Off;
Off.name = "Off";
Off.value = EVGA_GPU_V1_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Direct;
Direct.name = "Direct";
Direct.value = EVGA_GPU_V1_MODE_CUSTOM;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = EVGA_GPU_V1_MODE_RAINBOW;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = EVGA_GPU_V1_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
SetupZones();
// Initialize active mode
active_mode = 0;
}
void RGBController_EVGAGPUv1::SetupZones()
{
/*---------------------------------------------------------*\
| This device only has one LED, so create a single zone and |
| LED for it |
\*---------------------------------------------------------*/
zone* new_zone = new zone();
led* new_led = new led();
new_zone->name = "GPU Zone";
new_zone->type = ZONE_TYPE_SINGLE;
new_zone->leds_min = 1;
new_zone->leds_max = 1;
new_zone->leds_count = 1;
new_zone->matrix_map = NULL;
new_led->name = "GPU LED";
/*---------------------------------------------------------*\
| Push the zone and LED on to device vectors |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
zones.push_back(*new_zone);
SetupColors();
}
void RGBController_EVGAGPUv1::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_EVGAGPUv1::DeviceUpdateLEDs()
{
RGBColor color = colors[0];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
evga->SetColor(red, grn, blu);
}
void RGBController_EVGAGPUv1::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_EVGAGPUv1::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_EVGAGPUv1::SetCustomMode()
{
active_mode = 1;
}
void RGBController_EVGAGPUv1::DeviceUpdateMode()
{
evga->SetMode((unsigned char)modes[(unsigned int)active_mode].value);
}

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