Compare commits

...
Author SHA1 Message Date
Adam Honse 70901d6ef6 openrgb_qmk_testing 2020-11-23 02:05:33 -06:00
Kasper 8dace12920 Fix Linux build not compiling 2020-11-12 20:16:03 +02:00
Kasper f7af8a432e Implemented a qmk rgb matrix controller 2020-11-11 04:14:40 +02:00
Chris f106e83c94 Adding Razer Tartarus V2 to OpenRazerDevices.h to fix #721
* Also fixed Orbweavers matrix declaration
2020-11-10 19:34:39 -06:00
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
crashniels 68a92d0219 Read device mode and colours 2020-07-26 23:13:13 -05:00
crashniels 5221d93fc0 Changed UpdateMode() to DeviceUpdateMode() 2020-07-26 23:13:07 -05:00
crashniels 22deb13ac0 Added Galax modes in 2020-07-26 23:12:28 -05:00
crashniels 58b875d5ed Added missing references in the Qt Project file 2020-07-26 23:12:15 -05:00
crashniels 12f5d6070f WIP Galax RTX GPU support
Setting RGB values works. Modes still unknown.
2020-07-26 23:07:35 -05:00
crashniels 5e0b1fa3cc Added 0x3A to the Aura Ram Address list 2020-07-26 20:04:35 -05:00
Roger Roger 1ee3a7c3e2 Fix crash related to Razer Naga Trinity
Not all devices have static_mode at position 1, just setting it without
checking can crash the app
2020-07-26 15:49:39 -05:00
edbgon 43c13db970 Updated HID feature report with report ID for Windows compatibility 2020-07-26 15:46:20 -05:00
edbgon b5818d22af Update HID feature report to include report number for windows compatibility 2020-07-26 15:45:45 -05:00
Adam Honse fd7a5fc057 Add empty files/classes for HyperX Pulsefire Surge 2020-07-25 17:36:24 -05:00
Adam Honse 5af1ca9363 Fix formatting 2020-07-25 16:51:56 -05:00
Adam Honse c4d096e60c Update warning section in README to clarify a few things 2020-07-25 16:50:41 -05:00
Adam Honse 174b0743a9 Update timer resolution every 500ms to ensure it stays set while OpenRGB is active 2020-07-25 01:51:39 -05:00
Adam Honse 4b50533560 Uncomment timer initialization... 2020-07-25 01:33:18 -05:00
Adam Honse 1555dae1c8 Set timer resolution to 0.5ms on Windows 2020-07-25 01:20:49 -05:00
Chris 8b5717470a Fix for Gigabyte Fusion2 USB detection
* Adjusted the selection criteria for  USE_HID_USAGE flags
* Slight changes to the Fusion2USB controller to avoid crashes
* Updated DMIInfo to return correct Motherboard name on windows
2020-07-24 12:41:25 -05:00
edbgon 38b2cf03b0 LED name for 3rd LED group fixed 2020-07-24 12:39:24 -05:00
cjber 1293b07c9e add MSI 2070S Gaming X Support 2020-07-24 12:37:39 -05:00
Adam Honse aa4c41ddf7 Add Razer Blade Stealth and Blade Pro (2017) keymaps 2020-07-24 12:02:16 -05:00
Chris 628f423171 Minor fix for the Razer Blackwidow X Chroma 1532:0216
* Changed the 'w' to 'W' to match upstream
2020-07-23 21:57:21 -05:00
roger roger a9d179f93a Fixed typo that prevented the razer naga trinity from being detected 2020-07-23 21:56:26 -05:00
衛俊儒 4955dc0844 Update MSIGPUControllerDetect.cpp
MSI RTX2080 Sea Hawk EK X
2020-07-23 21:55:04 -05:00
Al_eXs 3f66f0d67a Fix Tab navigation order in the GUI 2020-07-23 21:48:31 -05:00
Adam Honse bc7ab5170a Add Razer BlackWidow Chroma Tournament Edition keymap 2020-07-23 21:18:30 -05:00
Adam Honse d61649f748 Add Razer BlackWidow Chroma keymap 2020-07-23 21:09:38 -05:00
Adam Honse 9a33a78574 Add keymap support to OpenRazer code and add a keymap for the Huntsman Elite 2020-07-23 14:42:34 -05:00
Adam Honse 030c0c60f3 Add (ANSI) and (ISO) specifiers to keys that differ between layouts 2020-07-23 11:17:23 -05:00
Adam Honse 19ff834d99 Fix apostrophe key on G810 2020-07-23 10:54:59 -05:00
Adam Honse 400a078a05 Fix media key names 2020-07-23 10:46:45 -05:00
Adam Honse 618bebc46b Update key names for G810 and Poseidon Z RGB 2020-07-23 10:26:16 -05:00
Adam Honse dee23ec52e Use synchronous mode update function in CLI 2020-07-22 23:29:32 -05:00
Adam Honse baca85b8cd Create a detection list for MSI GPU controller with card names 2020-07-22 22:32:00 -05:00
Arturo Casal 00b1cfcb3b Added Identifiers for MSI RTX 2080 Gaming X Trio 2020-07-22 20:47:55 -05:00
Shawn a9dbf5ef70 Add support for MSI 2060 Gaming X 2020-07-22 20:45:45 -05:00
Jeff Geer a0b1153ec3 Added Identifiers for MSI RTX 2080 Ti Gaming X Trio 2020-07-21 23:22:15 -05:00
Adam Honse 39a5e0eba0 Increment version number post-release 2020-07-21 23:21:10 -05:00
Adam Honse 308bb6f9b8 OpenRGB version 0.3 2020-07-21 19:34:18 -05:00
Adam Honse 86d96848a2 Fix buffer pointer in HyperX Alloy Origins controller 2020-07-21 19:33:34 -05:00
Adam Honse 98100a9bad Add two skipped slots before Number Pad Enter on HyperX Alloy Origins 2020-07-21 17:28:40 -05:00
Adam Honse e66562bb25 Fix number pad mapping on HyperX Alloy Origins 2020-07-21 16:29:17 -05:00
Adam Honse 902ebc2e83 Initialize transmit color count after inserting blanks 2020-07-21 12:28:05 -05:00
Adam Honse 403d60e214 Update skip list for HyperX Alloy Origins 2020-07-21 12:25:34 -05:00
Adam Honse 1c5130e78a HyperX Alloy Origins keymap 2020-07-20 23:30:10 -05:00
Miles M 481a5dea2e Update RGBController/OpenRazerDevices.h 2020-07-20 18:14:46 -05:00
Adam Honse 320129633d Add SMBus detection mode selection box 2020-07-20 17:49:12 -05:00
xgelectro 0dea21a53e i2c_smbus_nvapi::i2c_smbus_xfer now returns -1 for I2C_SMBUS_QUICK accesses which are unsupported 2020-07-20 17:37:43 -05:00
xgelectro 79625e9c8a Removed read bit from i2c_dev_address, so the detection of ASUS ROG RTX20xx Super is now working 2020-07-20 17:37:38 -05:00
Adam Honse 0cff1734ce Use 65 as size for Alloy Origins feature reports 2020-07-20 17:29:45 -05:00
David Reidsma e1d8f48cb9 changed max brightness from 5 to 4 2020-07-19 13:32:47 -05:00
B Horn 752737034b AddressSanitizer build time configuration option
This adds a configuration time option for enabling AddressSanitizer,
a tool included with recent versions of gcc (4.8+) and clang (3.1+).

To use it:
qmake CONFIG+=asan <path to orgb>
2020-07-19 13:25:51 -05:00
B Horn ecf1d2ce98 Bounds checking for ResizeZone implementations
As noted in #350, various RGBControllers don't validate if the zone they
are trying to resize actually exists.

This was fixed by a just checking they remain in bounds.
2020-07-19 13:23:40 -05:00
B Horn bb743c6b62 Validating user provided indexes in RGBController
When using the SDK Server, it was possible to provide indexes that would
later be used inside the various SetXDescription functions in
RGBController. This would result in possible out of bounds reads /
writes.

This is patched by checking the various indexes remain in bounds.
2020-07-19 13:19:59 -05:00
B Horn f02223d6ba Checks to avoid null dereferences in NetworkServer
Various commands in NetworkServer require extra data. However, if the
packet size is set to 0 for these, the code will skip over reading the
data in and allocating memory. This results in null dereferences.

This patch adds checks to the relevant commands to make sure they don't
continue reading a null pointer.
2020-07-19 13:16:19 -05:00
edbgon b87980965d Updated key names in accordance with usb spec 2020-07-19 13:05:51 -05:00
edbgon 2255eea14e Proper matrix map for Apex 7 keyboard 2020-07-19 13:05:26 -05:00
Adam Honse 0ccf2d0c33 Remove some debugging printouts in Network Client and Server code 2020-07-17 22:10:53 -05:00
Adam Honse 5ce6ec9ea7 Request updated controller mode from server after sending a Set Custom Mode command 2020-07-17 18:29:37 -05:00
Adam Honse 97e1c3e913 Update mode asynchronously 2020-07-17 18:29:37 -05:00
Adam Honse 9937731ad8 Remove WinUSB instructions and instead provide WinUSB uninstall instructions after the Windows HID switch 2020-07-17 17:15:19 -05:00
Adam Honse bd4f3728f6 Re-add interface check for Corsair driver when not using HID usages. Only set special function control for non-keyboards 2020-07-17 09:23:50 -05:00
Chris 009a6ccd2a Updated detector to include code pages
* Report descriptor for GB Fusion2 USB 048d:8297

0x06, 0x89, 0xFF,  // Usage Page (Vendor Defined 0xFF89)
0x09, 0x10,        // Usage (0x10)
0xA1, 0x01,        // Collection (Application)
0x85, 0x5A,        //   Report ID (90)
0x09, 0x01,        //   Usage (0x01)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x10,        //   Report Count (16)
0xB1, 0x00,        //   Feature (Data,Array,Abs,No Wrap,Linear,Preferred
State,No Null Position,Non-volatile)
0xC0,              // End Collection
0x06, 0x89, 0xFF,  // Usage Page (Vendor Defined 0xFF89)
0x09, 0xCC,        // Usage (0xCC)
0xA1, 0x01,        // Collection (Application)
0x85, 0xCC,        //   Report ID (-52)
0x09, 0x01,        //   Usage (0x01)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0xB1, 0x00,        //   Feature (Data,Array,Abs,No Wrap,Linear,Preferred
State,No Null Position,Non-volatile)
0xC0,              // End Collection
2020-07-17 09:23:50 -05:00
Katzenbiber 6606ab92bd Fix Wraith Prism using WinUSB on Windows
- Add Usage Page to Wraith Prism Detect, which fixes WinUSB bugs.
- Change AMDWraithPrismControllerDetect.cpp structure
2020-07-17 09:23:49 -05:00
Adam Honse 595248cc10 Fix issues preventing hidapi from working without WinUSB on Windows 2020-07-17 09:23:49 -05:00
Chris ffc02e6c98 Coolermaster MP750 now supports on load status from device
Previous issues with hidapi-hidraw vs hidapi-libusb have been resolved.
CMMP750Controller.cpp now calls GetStatus in the constructor to query
device and set current state. Added "Getters" to the public interface to
allow the RGBController_CMMP750Controller.cpp to access current state in
construction.
2020-07-17 09:16:02 -05:00
Adam Honse ac2d911566 Disable MSI Mystic Light controller until the bricking issues are understood 2020-07-16 23:34:50 -05:00
Adam Honse 633dfdbddd Re-add EKControllerDetect.cpp with fixed capitalization (to fix build break on case-sensitive systems 2020-07-16 13:09:59 -05:00
Adam Honse 54cd8408e8 Temporarily delete EKControllerdetect.cpp (lower case) 2020-07-16 13:09:19 -05:00
Chris 384011aab3 Preliminary functionality implemented for EK Loop Connect
* 9 modes implemented
* Speed Slider works
* Currently single (non linear) zone
2020-07-16 11:12:59 -05:00
Chris 95ded7b871 Initial commit for the EK Loop Connect Support
* Implemented Static & Breathing modes
2020-07-16 11:12:48 -05:00
Adam Honse 607d83b795 More Sapphire GPU work 2020-07-15 14:47:37 -05:00
SuNNjek f4872c52bd Add support for MSI RTX 2070 ARMOR 2020-07-15 10:20:05 -05:00
Adam Honse 505e2d2aa4 Initial driver for Sapphire GPU (tested on RX580 Nitro+ on Windows) 2020-07-15 00:22:46 -05:00
Chris 77ecfc3b46 Cleaned up MSI Mysticlight detect pids
* Added all MSI Mystic light PIDS to udev rules
* Slight tweak to speed up CM detector
2020-07-14 15:43:40 -05:00
Chris 8107288838 Additonal code corrections and updates for B550 2020-07-14 15:36:56 -05:00
Adam Honse 05e76cc733 Fix Windows build 2020-07-12 17:02:11 -05:00
Adam Honse 816eabb1d1 Update direct packet for HyperX keyboards based on Alloy FPS captures 2020-07-12 16:53:20 -05:00
Adam Honse 9b6e24947d Code style cleanup for MSI GPU controller 2020-07-12 16:29:34 -05:00
Hex3l 5778d344e0 adds support to MSI 2080 Ti Sea Hawk EK X 2020-07-12 16:25:56 -05:00
xyz b785f2efbf Attach PCI IDs in DetectNvAPII2CBusses() 2020-07-12 16:25:07 -05:00
xyz 224f59450e Add support for MSI RTX 2080S Gaming X Trio 2020-07-12 16:20:57 -05:00
Adam Honse b80cbe931e Add Corsair Glaive RGB PRO to detection list 2020-07-12 16:06:58 -05:00
Adam Honse 87adb0bdb7 Add keepalive thread for Alloy Origins 2020-07-12 02:41:07 -05:00
Adam Honse 78c7572a2c Update constants for Alloy Origin driver and use 64 byte instead of 65 byte operations 2020-07-12 02:10:05 -05:00
Adam Honse bbed1f64a7 Use interface 3 for Alloy Origins 2020-07-12 01:20:59 -05:00
Adam Honse ac071902c0 Fix MSVC paths from 2017 to 2019 upgrade 2020-07-12 00:54:06 -05:00
Adam Honse 62a4cd31c5 Update QT path for GitLab CI 2020-07-12 00:47:32 -05:00
Adam Honse 751961b3b3 Initial controller for HyperX Alloy Origins 2020-07-12 00:31:40 -05:00
Chris 30625548e5 Adding USB PID 048D:5702 for Gigabyte B550 Aorus Elite 2020-07-09 22:38:12 -05:00
Chris 9451771ccb Rewrote the RGBFusion2USBController to allow for per model
configurations of LED's and zones

* largely changed knownLayoutsLookup to remove reliance on other enums /
structures and made it a map of maps
* rewritten the code to accomodate that change
2020-07-09 22:25:56 -05:00
Chris 12442046e2 Initial commit for dmiinfo.cpp
- Tested working for Linux
- Implemented in Fusion2USB controller and the motherboard name will
populate the controller name in the GUI / CLI
2020-07-09 22:25:45 -05:00
B Horn 47baeb6b6b Improving NetworkServer's memory management (#373)
This patch resolves several bugs:

* NetworkServer would allocate various instances of `NetworkClientInfo`.
  This is patched by deallocating the NetworkClientInfo when it's
  listening thread ends in the `listen_done` section.

* Memory would be allocated for threads that wouldn't be freed. This
  is resolved by detaching from the threads, so they no longer need to
  be joined to be freed, and then freeing the memory as they finish.

* Thread-Safety issues involving `ServerClients` would result in stray
  `NetworkClientInfo`'s not being removed from the list in certain
  situations. This is resolved by used a mutex to lock access to this
  from different threads.
2020-07-09 21:56:42 -05:00
Neel Chotai 263561868c fix musl compilation 2020-07-09 21:51:33 -05:00
Adam Honse 9bc58b039b Add Corsair Harpoon (non-Pro) to detected Corsair Peripheral list 2020-07-09 12:00:02 -05:00
Adam Honse 82c0ff8452 Add HyperX Alloy FPS to detected HyperX keyboard list 2020-07-08 11:43:41 -05:00
edbgon 2d7e996e4b Added initial support for SteelSeries Apex 7 Keyboard (Nordic model) 2020-07-08 03:22:03 -05:00
Adam Honse 0ae76e40c2 Add matrix map for Ducky One 2 TKL 2020-07-07 16:33:21 -05:00
Adam Honse 343c285321 Initial driver for Ducky One 2 keyboard 2020-07-07 13:15:02 -05:00
Adam Honse 6492852627 Add Corsair Harpoon RGB Pro to supported devices list 2020-07-07 01:20:56 -05:00
Adam Honse acc032a69c Adjust Polychrome speed 2020-07-06 13:17:39 -05:00
Adam Honse 950a3be01d More MSI Mystic Light cleanup 2020-07-06 03:45:45 -05:00
Adam Honse 6626321e80 Don't update NZXT fan status for any Hue 2 devices until we get initialization packet working 2020-07-06 02:13:00 -05:00
Adam Honse 7276f5e1d5 Add speed control to Polychrome controller 2020-07-06 02:03:47 -05:00
Adam Honse 5f9c4f8432 Code cleanup and rework for MSI Mystic Light controller
* Replace decimal constants with hexadecimal constants when ANDing/ORing values
* Add comments to explain what the code is doing
* Use C-style casts to fit the project standards
2020-07-05 18:27:51 -05:00
Adam Honse a1cd324731 Add comments and minor cleanup to Kraken driver 2020-07-05 12:12:07 -05:00
Adam Honse c2c5e6666d Fix previous commit 2020-07-05 12:04:35 -05:00
Adam Honse f7d6ede033 Update NZXT Hue 2 and Kraken detectors 2020-07-05 12:02:29 -05:00
Adam Honse 25f9e2a110 Add --client command line argument for opening network clients 2020-07-05 04:25:46 -05:00
Adam Honse 8ef6888a28 Add I2C byte operation to piix4 driver on Windows 2020-07-04 15:40:46 -05:00
B Horn 78a7be63ef Using the correct PID for the Steelseries 300 (0x1710) 2020-07-04 03:28:46 -05:00
Adam Honse f108515a6e Fix Set All Devices being slow and crashing on certain setups. It was sending the update multiple times 2020-07-03 02:59:54 -05:00
Adam Honse ad4e198aea Replace C-style clock() with std::chrono::steady_clock to fix timing on Linux 2020-07-02 16:59:30 -05:00
Adam Honse 5aad79135f Don't try to read fan status for Hue 2 devices without fan controllers 2020-07-01 19:25:29 -05:00
Adam Honse 5fc6981c16 Fix OpenRazer devices with logo/scroll/left/right matrix effect nodes on Windows 2020-06-30 18:11:15 -05:00
Adam Honse 942df26432 Update Readme 2020-06-30 18:10:44 -05:00
Adam Honse b3860be638 Bring in NZXT Hue 2 controller improvements from fan_devel branch 2020-06-28 23:44:35 -05:00
Adam Honse 8ecabb0789 Add 32-bit GitLab CI build target for Windows 2020-06-28 22:40:42 -05:00
Adam Honse d3fc88b24f Fix USB serial port detection in Windows. Fixes false Hue+ detection 2020-06-28 22:36:25 -05:00
Adam Honse dfb2e52e7b Add --i2c-tools to help text with warning, set GUI flag if --i2c-tools is specified 2020-06-28 21:41:00 -05:00
Adam Honse 96af869d79 Check for local server before detecting devices from hardware and tweak timeouts to make network connections faster 2020-06-28 21:08:59 -05:00
Adam Honse 4c6429ae76 Add OpenRGB client support to GUI 2020-06-28 17:57:27 -05:00
Adam Honse 7d2877a8e9 Don't exit after loading a profile from the command line 2020-06-28 11:21:56 -05:00
Adam Honse a25f3ef2fc GUI rework to provide more control over optional tabs to main.cpp, add TODO comments for client mode 2020-06-28 03:01:43 -05:00
Adam Honse 15ace9d094 Add flag to start application minimized to tray 2020-06-28 02:30:23 -05:00
Adam Honse 58aba0a147 Allow specifying --gui and --server together 2020-06-28 02:18:28 -05:00
EXtremeExploit 199db16ec0 Fix RGB problem with strip and media keys 2020-06-26 20:59:54 -05:00
EXtremeExploit c364fabf57 Add the UK Enter and UK Backslash leds 2020-06-26 20:20:46 -05:00
Adam Honse 15a2d5beaf Add zadig clarification to readme 2020-06-26 13:50:00 -05:00
Adam Honse 5b956f7ff1 Add missing Corsair PIDs 2020-06-26 11:15:59 -05:00
Chris dc42248a88 Added Warrior Kane TC235 2020-06-25 23:59:28 -05:00
Adam Honse eeeab399be Fix LED count in Corsair Lighting Node controller 2020-06-25 22:32:33 -05:00
Adam Honse 39d451793b Update Lighting Node detection to detect multiple of the same device. Add reads to Lighting Node driver to fix compatibility with Corsair Lighting Protocol Arduino project 2020-06-25 22:30:31 -05:00
Adam Honse 5db888fba0 Add Fedora dependency list to README 2020-06-25 14:51:02 -05:00
Adam Honse 1b91687fac Re-add LED 2 for WiFi X570 Gigabyte boards 2020-06-25 13:25:11 -05:00
Chris 7d38cd4a78 Fix issue #161
- removed added LED in known_channels for the x570
- ensured that the .header address is passed to SetLEDEffect() correctly
2020-06-25 13:07:18 -05:00
Chris 899b90decc Udev rules to replace 99-openRGB.rules
- whilst rule number is arbiturary TAG=+"uaccess" needs to be run prior
to /lib/udev/rules.d/70-uaccess.rules
- Removed unsafe MODE="666" access
- Removed GROUP tags as no longer required

- Confirmed working on Ubuntu & Arch. See issue #329
2020-06-25 09:15:50 -05:00
edbgon 8dcb1f075d Add LED header for Gigabyte RGB Fusion 2.0 - X570 I AORUS PRO WIFI (rev. 1.0) motherboards. Solves #161. 2020-06-25 08:50:47 -05:00
Nate Dean 5588f9b7a9 Quick G403 Hero support (First Time contributing to something so hopefully I don't mess up) 2020-06-25 08:16:54 -05:00
Thomas Karl Pietrowski 717620e8dd debian: openrgb-udev depends on udev
Makes sense, no?

Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-24 12:05:29 -05:00
Thomas Karl Pietrowski 877d462dbc debian: Remove package dependencies
debhelper is smart enough to determine these on it's own.

Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-24 12:05:19 -05:00
Thomas Karl Pietrowski d3cf315175 debian: Also recommend openrgb-dkms-drivers
Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-24 10:51:32 -05:00
Thomas Karl Pietrowski f47129902a debian: Building in parallel
Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-24 10:51:07 -05:00
Thomas Karl Pietrowski 5a3c69ec32 debian: Recommend to install openrgb-udev
Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-24 10:50:55 -05:00
Thomas Karl Pietrowski 392c547b87 debian: Making openrgb-udev a arch-indep package
Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-24 10:50:37 -05:00
Thomas Karl Pietrowski 38527a5122 debian: Adding pkg-config as Build-Dep
Signed-off-by: Thomas Karl Pietrowski <[email protected]> (github: thopiekar)
2020-06-24 10:49:37 -05:00
Thomas Karl Pietrowski 77412a959f debian: Cleanup
Signed-off-by: Thomas Karl Pietrowski <[email protected]> (github: thopiekar)
2020-06-24 10:49:17 -05:00
Thomas Karl Pietrowski 3a5ebe387e debian: Adding separate package for udev rule
Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-24 10:48:49 -05:00
Térence Clastres 1db412e970 Fix high CPU usage when running the SDK server
It was coming from `recv_select()` and `accept_select()`
The timeval struct members for select() is reset after each call to select() for
whatever reason so like FD_ZERO and FD_SET it needs to be placed inside
the loop.

Source: https://stackoverflow.com/questions/3324078/why-select-always-return-0-after-the-first-timeout
2020-06-24 10:08:40 -05:00
Chris a3c931392a Merged MP750 Medium changes and made logic changes to correctly compile
and execute
2020-06-24 10:04:39 -05:00
Térence Clastres b94f701db8 Fix high CPU usage when running the SDK server
It was coming from `recv_select()` `nd accept_select()`
The timeout for select() is only when waiting for the file descriptor to
be ready for reading/writing so when the FD is ready AND there is
nothing to read, it will not return and instead keep executing the while loop with no timeout.
Fix this by adding a 100ms timeout when there is nothing to read.
2020-06-24 09:35:31 -05:00
Térence Clastres b79ff124e6 Replace Sleep() by std::thread::sleep_for() 2020-06-24 09:28:11 -05:00
Adam Honse 60baf6d05f Remove duplicate line 2020-06-24 08:26:09 -05:00
Swyter cb9b22804a Implement human color parsing in the command-line by using the standardized CSS 3 subset, well known for styling. Interpret first as text to avoid problems like 'darkgreen' being picked up as 0xDA.
- Also, and make case insensitive by using the strcasecmp() function. Both for colors and modes. The only improvement I can think of is stripping whitespace beforehand.
  - Also, improve digit parsing by using `strtoul()`, previously only FF00FF worked, whereas now we can type things like 0xFF00ff or 0xff00ff.

For example; something like this should work: `OpenRGB.exe -c darkgreen,ff00ff,0xff0000,red,REd,teal,pink,gOLd,AAgoldo,magenta -m breathing`

(`AAgoldo` will throw a `Error: Unknown color: 'AAgoldo', skipping.`; and pick the next color instead, this is intended behavior)
2020-06-23 23:15:10 -05:00
Térence Clastres d2dfd03551 Use the default SDK port constant in the CLI 2020-06-23 23:10:41 -05:00
Térence Clastres f3bdee9bd2 CLI: Allow --mode flag to be case insensitive
Also fix handling when no argument passed
2020-06-23 23:10:29 -05:00
Adam Honse 7a3de1edbb Add firmware version request to NZXT Hue 2 controller 2020-06-22 23:23:36 -05:00
Adam Honse 0464fbcbe2 Make default SDK port a defined constant 2020-06-22 11:32:32 -05:00
Adam Honse 12226804f3 Rename small to medium for Cooler Master MP750 2020-06-22 11:23:26 -05:00
Adam Honse f06d71bd0c Add Cooler Master MP750 small variant PID 2020-06-22 08:59:42 -05:00
Adam Honse 112d5a1cb2 Add Corsair Strafe IDs to detection list 2020-06-22 08:47:46 -05:00
Martin Hartl b70658e37d Asus USB: Fail detection if config table read fails 2020-06-21 20:24:52 -05:00
Adam Honse 80a2770263 Update Corsair peripheral controller to use HID writes and reads instead of feature reports where possible 2020-06-21 20:11:16 -05:00
Erik Karlsson 765ef62858 Add SteelSeries Siberia 350 2020-06-21 19:18:38 -05:00
Matthias Wirtz 0e58fcc236 Update AuraUSBControllerDetect.cpp 2020-06-21 01:45:42 -05:00
Adam Honse 4bf0330974 Fix mode colors in Corsair Lighting Node controller 2020-06-20 22:14:30 -05:00
Térence Clastres 6d585d3eeb Network: Print used port on startup and change default to 6742
Also print an error if server can't be started

1337 is already used by razer's rest server
Port idea by @bahorn (6742 = ORGB on a phone numpad)
2020-06-20 14:39:14 -05:00
Térence Clastres 0286a5dd58 CLI: Add daemon/server mode 2020-06-20 14:39:01 -05:00
Térence Clastres b3cadbae5d Fix CLI
It was not changing the colors since e3e6c034 and had an overflow on
`options->devices.size()` since 0f4ddd16 causing options not to be applied

Second issue was a bit trickier as it was not reproducable when using a
debug build. It seemed like `std::vector<DeviceOptions> devices` had an
overflow. I saw a bunch of warnings regarding comparison with implicit
cast so I figured I'd fix that first and see if it makes a difference.
Turns out it did and fixed the issue.

While toying around, I also noticed that `throw` didn't seem to work,
causing crashes later in the program. It turns out the catch-all clause
`catch (...)` is not necessary matching a `throw NULL` expression as it
might be of type `int`. The solution is to use `thrown nullptr;`
instead.

Reference: https://en.cppreference.com/w/cpp/language/try_catch
2020-06-19 16:46:57 -05:00
Adam Honse e26e874d1c Fix file that didn't get renamed 2020-06-19 16:34:51 -05:00
Adam Honse c9c214267d Update matrix map to fix offsets and add ISO layout keys to the matrix. ENTER was shifted right one column to account for ISO #/~ key 2020-06-19 15:18:52 -05:00
Adam Honse 6957c1ca03 Add link to OpenRGB.NET project by diogotr7 to README 2020-06-19 14:51:37 -05:00
Diogo Trindade f5aafda340 Added logitech g512 PID 2020-06-19 14:41:14 -05:00
Adam Honse f1fe428f59 Rename Hue2Controller to NZXTHue2Controller and add additional Hue 2 protocol devices documented in liquidctl 2020-06-19 14:41:09 -05:00
Thomas Karl Pietrowski 614c9768ad Needed changes for nightly builds on launchpad.net
Signed-off-by: Thomas Karl Pietrowski <[email protected]>
2020-06-19 08:35:43 -05:00
Adam Honse 5828c4df8d Add Debian packaging files 2020-06-19 08:35:26 -05:00
Adam Honse 6cf32b8a94 Remove icon extension in desktop file 2020-06-18 21:51:51 -05:00
B Horn bc6487505a Adding scripts and tooling to build an AppImage 2020-06-18 21:36:59 -05:00
Diogo Trindade d1e8104442 Added missing g810 keys and PID 2020-06-18 11:48:33 -05:00
Adam Honse 91414084d6 Move Off mode to second position in MSI Mystic Light mode list so that custom mode works 2020-06-18 10:50:25 -05:00
Adam Honse 372ff746ad Add SteelSeries Rival 300 Black Ops edition to PID detecton list 2020-06-18 09:47:39 -05:00
Adam Honse ab297281d3 Fix Blackwidow 2019 string in OpenRazer device list 2020-06-17 03:26:22 -05:00
Adam Honse 2cbba19bf9 Code style changes to MSI Mystic Light detection, use the same hidapi detection code as used by other drivers 2020-06-16 17:21:35 -05:00
Adam Honse b5001c983e Add RGB Fusion 2 USB to udev rules 2020-06-16 13:47:14 -05:00
Adam Honse 7d4d6152ab Add OpenRGB E1.31 Receiver to SDK projects list 2020-06-15 22:46:51 -05:00
Adam Honse f2c1022c7f Don't consider client online until it has been initialized 2020-06-15 22:41:33 -05:00
Adam Honse 771e362a63 Do not automatically refresh HyperX direct mode unless it has been 50ms since last device update to prevent flickering 2020-06-15 11:04:59 -05:00
Adam Honse 3eba2c3dd3 Add underglow zone for Razer Huntsman Elite 2020-06-14 15:57:50 -05:00
Adam Honse 305f66ad3d Treat the LED strip on the Razer Diamondback as a single zone 2020-06-14 14:14:12 -05:00
Adam Honse 3191a87f46 Update README 2020-06-13 19:45:59 -05:00
Adam Honse a9493d46aa Implement LED packing for Logitech G810 direct mode 2020-06-13 17:32:39 -05:00
Adam Honse 6499ee4312 Add Logitech G810 direct mode, LED list, and matrix keymap. Update function still needs optimization to pack multiple keys per packet 2020-06-13 16:51:20 -05:00
Adam Honse f26897df71 Fix Logitech G810 controller build on Linux 2020-06-12 19:49:04 -05:00
Adam Honse 8ae07ea9e2 Logitech G810 Orion Spectrum driver, does not include direct mode yet 2020-06-12 15:23:22 -05:00
Adam Honse cb94b4fe28 Update .gitignore 2020-06-11 08:31:51 -05:00
Adam Honse f51f222fb4 Initialize color modes for per-LED modes on Aura Core controller 2020-06-10 18:58:00 -05:00
Swyter d3162ea2e8 Initial version of the MSVC/Qt5 GitLab buildbot. On Windows also copy inpoutx64.dll and libusb-1.0.dll to the final destination and use intermediate build folders to get rid of the cruft. 2020-06-10 18:32:40 -05:00
Adam Honse fa1f0b05ce Initialize i2c start and done flags 2020-06-10 11:42:28 -05:00
Adam Honse c7bb002b7c Add Aura X570 interface number workaround to libusb DLLs
Source for my libusb fork can be found on GitHub:

https://github.com/CalcProgrammer1/libusb
2020-06-10 09:43:30 -05:00
crashniels b1de039f21 Finished up all the modes 2020-06-07 18:05:29 -05:00
Adam Honse e086ecd0bb Fix wheel color changing when setting all devices 2020-06-07 18:01:48 -05:00
Adam Honse f612ca8bdc Fix bug with ColorWheel updating 2020-06-07 17:58:55 -05:00
Adam Honse 5b8441c57d Initial implementation of RGB Fusion 2 DRAM controller 2020-06-07 15:49:28 -05:00
Adam Honse 919d89d52f Update Redragon M711 controller with generic write function 2020-06-03 21:48:17 -05:00
crashniels 479d51df87 AMD ADL Windows 2020-06-02 20:39:26 -05:00
Adam Honse 687424e732 Rename Glorious Model 0 detection file 2020-06-02 17:35:22 -05:00
crashniels a2a613f22d use hidapi instead of libusb 2020-06-02 17:34:01 -05:00
crashniels a34d0f93a3 Added most modes in 2020-06-02 17:31:14 -05:00
crashniels 8e62be0b9e Added the Model O 2020-06-02 17:31:02 -05:00
vinno97 95bcc5e0fd Add pkgconf to the dependencies in the README
If the `pkg-config` command cannot be found, `packagesExist(...) {...} else {...}` always chooses the 'else' branch.
2020-06-02 17:11:04 -05:00
Chris 19ef8afe70 Updated controller to use HIDAPI instead of LIBUSB
& added code to pass back info from the USB device
2020-06-02 17:08:29 -05:00
Adam Honse 5fdea9d34f Delete zone matrix maps when destroying RGBController 2020-05-31 19:36:01 -05:00
Adam Honse 32938ec2af Add sleep to OpenRazer driver to fix hangs updating certain devices 2020-05-31 16:20:35 -05:00
Adam Honse 8d29a40954 Convert Corsair Lighting Node driver to use hidapi instead of libusb 2020-05-30 23:48:59 -05:00
Adam Honse a75a2bbf8b Update README udev rules section 2020-05-30 13:44:53 -05:00
Adam Honse f96a4c3557 Fix incorrect PID in Corsair Peripheral driver and add udev rules file for all OpenRGB devices 2020-05-30 13:26:54 -05:00
Adam Honse 1d426f109a Convert AMD Wraith Prism driver to use hidapi instead of libusb 2020-05-29 16:21:05 -05:00
Adam Honse 8827d0e0c2 Convert Hue 2 driver to use hidapi instead of libusb 2020-05-29 13:19:16 -05:00
Adam Honse edfb4f8d4e Update app screenshot in README 2020-05-29 11:02:31 -05:00
Adam Honse 13ce388e9a Convert Thermaltake Riing driver to use hidapi instead of libusb 2020-05-28 23:16:20 -05:00
Adam Honse 316902b2c3 Fix Steelseries path 2020-05-28 22:47:50 -05:00
B Horn 6667cdeed9 Rival 300 should now be properly intergrated with the RGBController. 2020-05-28 17:04:09 -05:00
B Horn de44c57081 Added all the PIDs for the various Rival 300 Mouses 2020-05-28 17:00:12 -05:00
B Horn 30a1bc9893 fixing bug that would stop the mouse from updating color 2020-05-28 16:57:20 -05:00
B Horn cf4b421abd Early work on enabling support for the Rival 300. 2020-05-28 16:56:01 -05:00
B Horn 1a9e1c2430 List all the devices types in the switch statement 2020-05-28 16:50:34 -05:00
B Horn bde9e7ea6b Adding list of devices this should support currently (all the 100-series rival mouses) 2020-05-28 16:49:57 -05:00
B Horn fc9c6585af Modified the SteelSeries RGB Controller to read the device name. 2020-05-28 16:47:07 -05:00
B Horn be9711a021 First working version to support the Rival 110 mouse 2020-05-28 16:44:46 -05:00
Adam Honse bfa7f63486 Add hidapi dependency to readme 2020-05-27 23:24:01 -05:00
Adam Honse 8f19267886 Use hidraw backend for hidapi if available 2020-05-27 23:19:03 -05:00
Adam Honse fab6e41810 Fix uninitialized loop counter in AuraUSB controller 2020-05-27 11:17:21 -05:00
Adam Honse c3ceac1ed9 Add more MacOS project definitions 2020-05-26 01:44:39 -05:00
Adam Honse bb01790d71 Add MacOS libraries and paths to project file 2020-05-26 01:25:46 -05:00
Adam Honse 9cf7bdea29 Use system hidapi on Linux 2020-05-26 00:21:10 -05:00
Adam Honse 6da6ff6cc0 Reorganize Qt project file and add section for MacOS configuration 2020-05-25 20:21:22 -05:00
Adam Honse baa04913c3 Add headset stand type string 2020-05-25 16:45:58 -05:00
Adam Honse 64c0861097 Move icon lookup to its own function for reusability 2020-05-25 16:41:56 -05:00
Adam Honse 522016137b Razer Base Station Chroma is a headset stand 2020-05-25 14:06:11 -05:00
Adam Honse 40d0f17ae2 Update icons 2020-05-25 13:57:04 -05:00
Adam Honse c88e71d52a Add device table to HyperX keyboard detection code 2020-05-24 16:16:52 -05:00
Adam Honse c3d284c97b Add speed control to Logitech G203 2020-05-24 15:10:20 -05:00
Adam Honse 19b572da30 Fix Polychrome controller detection 2020-05-24 14:18:07 -05:00
Martin Hartl e6c4017ad0 Add Logitech G403 driver 2020-05-24 14:04:07 -05:00
Martin Hartl b862912fb1 NZXT Kraken: Rewrite to use hidapi 2020-05-24 12:35:03 -05:00
Adam Honse 02f7f57130 Fix BlackWidow Elite string 2020-05-18 17:55:49 -05:00
Adam Honse c6b3d7c675 Add matrix mapping for Redragon keyboards 2020-05-18 17:35:33 -05:00
Adam Honse 1b2a5a4b14 Add Redragon K552 Kumara to Redragon device list 2020-05-18 16:24:37 -05:00
Adam Honse c0190d35d1 Logitech G203 requires a read after writing 2020-05-18 11:12:29 -05:00
Adam Honse 4d0219b184 Add Tecware Phantom Elite to Redragon driver as it uses the same controller 2020-05-18 10:24:10 -05:00
Adam Honse 85fc72232a Logitech G203 and Corsair ST100 support 2020-05-18 09:45:38 -05:00
Adam Honse cbb13b0d22 Add MacOS support to NetworkClient.cpp 2020-05-16 23:33:49 -07:00
Adam Honse bd6ec4c41e Get client stop function working 2020-05-14 10:06:22 -05:00
Martin Hartl d843b3d619 Aura USB: Do effect changes only once
* Improve the zone naming
2020-05-13 18:41:00 -05:00
Martin Hartl ca9c40f084 Aura USB: Addressable header and direct mode fixes
* Add addressable header and integrated LED count detection
* Correctly use the direct mode
2020-05-13 18:24:23 -05:00
Adam Honse 6a85729f10 Increment version number post-release 2020-05-12 16:35:34 -05:00
Adam Honse 13414ec9b8 OpenRGB version 0.2 2020-05-12 16:33:41 -05:00
Adam Honse 74faee0f73 Reorder Thermaltake Riing modes to put direct at top 2020-05-12 16:04:52 -05:00
Adam Honse 3f0027aa90 Use byte index 2 of config table for channel count on addressable Aura controllers 2020-05-12 15:58:00 -05:00
Adam Honse d22aa1ed6c Only allow ASRock firmwares 1.x, 2.x, and 3.x for now 2020-05-12 15:11:11 -05:00
Adam Honse 23d51f65d0 Only update mode for zones with nonzero size 2020-05-12 15:02:02 -05:00
Adam Honse cad356efca Remove hard coded list of Polychrome firmware versions as it seems all firmwares 1.x and 2.x use ASR LED protocol and 3.x+ use Polychrome 2020-05-12 14:46:11 -05:00
Adam Honse 70e83c13cc Attempt to auto detect unknown Polychrome firmware versions 2020-05-12 13:39:14 -05:00
Martin Hartl 7ca0a1b6ab Add Aura USB controller for X570 mainboards 2020-05-12 12:25:02 -05:00
Adam Honse 9bd5536d07 Add ASR LED firmware 1.5 2020-05-12 12:06:34 -05:00
Adam Honse eaa3b9a368 Add command line option to enable i2c tools 2020-05-12 11:01:46 -05:00
Adam Honse 599c468de8 Small changes for 0.2 - report 5 channels from Aura Addressable controller until config table is figured out, increase sleep in Corsair Peripheral write to 2ms to prevent device crashing in Linux 2020-05-12 08:59:19 -05:00
Adam Honse 9f21814395 Code style changes for RGB Fusion 2 SMBus 2020-05-11 12:24:25 -05:00
Adam Honse cb8a551683 Disable RGB Fusion 2 SMBus controller until better detection scheme is implemented 2020-05-11 11:43:42 -05:00
Matt Harper 7f1156d81c Rename UpdateLEDs to DeviceUpdateLEDs 2020-05-11 11:40:34 -05:00
Matt Harper 5beee08166 Write only the absolutely necessary LEDs 2020-05-11 11:40:34 -05:00
Matt Harper 1334129078 Additional protocol options 2020-05-11 11:40:34 -05:00
Matt Harper 216b492f24 Const cleanup, fix behavioral bugs by writing all LEDs every time 2020-05-11 11:40:34 -05:00
Matt Harper 1b65bb9cc3 Rudimentary RGB Fusion 2 SMBus support 2020-05-11 11:40:34 -05:00
Adam Honse 0f4ddd164f RGB Fusion 2 SMBus initial work 2020-05-11 11:40:33 -05:00
Adam Honse e6aadc414b Handle socket errors on Windows, which does not return 0 when a socket is disconnected like Linux does 2020-05-10 16:22:29 -05:00
Adam Honse 883a78ad9d Fix client on Windows 2020-05-10 16:16:59 -05:00
Adam Honse 15d23d3009 Add client status update callback to NetworkClient 2020-05-10 13:41:01 -05:00
Adam Honse e2c2b8c1df Client will now close listener thread when disconnected and attempt to reconnect. Initialization behavior (controller requests, client string update) are performed automatically upon reconnection 2020-05-10 01:19:38 -05:00
Adam Honse 5133c30242 Update BlackWidow V2 device string 2020-05-09 18:21:46 -05:00
Matt Harper 69e1e19bf9 Bugfix - properly free ServerClients 2020-05-09 17:30:54 -05:00
Adam Honse 46f08f7423 Disable SMBus tools again 2020-05-09 15:49:47 -05:00
Adam Honse 352b9928ca Add file headers to network files and some minor code cleanup 2020-05-09 15:48:16 -05:00
Adam Honse 87854d5781 Fix crash when stopping server 2020-05-09 15:48:16 -05:00
Adam Honse 1b3f8f9eb4 Clean up server page 2020-05-09 15:48:16 -05:00
Adam Honse 6438c15dd3 Fix build on Windows 2020-05-09 15:48:16 -05:00
Adam Honse dbe29991f0 Send client string after server is connected 2020-05-09 15:48:15 -05:00
Adam Honse a5e9a3de05 Add mutex on updating callbacks 2020-05-09 15:48:15 -05:00
Adam Honse edf1b251c0 Send and receive client string 2020-05-09 15:48:15 -05:00
Adam Honse 9ff4314840 Add callback to NetworkServer to handle UI updates when client information changes 2020-05-09 15:48:15 -05:00
Adam Honse 3ad0986ae7 Add IP field to client information and display client IP in the server tab's connected client list 2020-05-09 15:48:15 -05:00
Adam Honse 6bfc9dd9db Create a structure to hold client information in the network server and fix i2c hanging on destructor when bus is not available. 2020-05-09 15:48:15 -05:00
Adam Honse 9b8a0d465e Functions to set IP and port and start client 2020-05-09 15:48:15 -05:00
Adam Honse 119741b736 Fix build on Windows 2020-05-09 15:48:15 -05:00
Adam Honse 2fe958783c Use select on accept call as well so that server closes on Linux 2020-05-09 15:48:15 -05:00
Adam Honse 1c59ef6b80 Fix build on Linux 2020-05-09 15:48:15 -05:00
Adam Honse 9e44e4ba4f Add server information to user interface and provide buttons to start and stop server, change port 2020-05-09 15:48:15 -05:00
Adam Honse b8e14ea067 Server info WIP 2020-05-09 15:48:14 -05:00
Adam Honse 525071c205 Use condition variables and mutexes to eliminate sleeps from SMBus threading 2020-05-09 15:48:14 -05:00
Adam Honse bfe03b0564 Handle all SMBus controller activity on a separate thread to avoid corrupting the SMBus data 2020-05-09 15:48:14 -05:00
Adam Honse 04b87ce2eb Use std::thread for NetworkClient threads 2020-05-09 15:48:14 -05:00
Adam Honse 81acc47cd6 Use std::thread for NetworkServer threads 2020-05-09 15:48:14 -05:00
Adam Honse 6e426b1403 Fix thread conflicts for HyperX keyboard in Direct mode 2020-05-09 15:48:14 -05:00
Adam Honse 6509e53a9b Disable I2C devices until threading issues are resolved, don't start a NetworkClient in main 2020-05-09 15:48:14 -05:00
Adam Honse 5b42b3d11d Use TCP_NODELAY on client socket 2020-05-09 15:48:14 -05:00
Adam Honse 8bd515296d Add key matrix map for Corsair K70 keyboards 2020-05-09 15:48:14 -05:00
Adam Honse 2bbf66c0ee Fix memory leaks in client 2020-05-09 15:48:14 -05:00
Adam Honse d716973642 Get network client working on Windows 2020-05-09 15:48:14 -05:00
Adam Honse 25f7a87a79 Get network server working in Windows 2020-05-09 15:48:14 -05:00
Adam Honse 0619a16be2 Add matrix map for HyperX Alloy Elite 2020-05-09 15:48:13 -05:00
Adam Honse 4a3802f344 Add matrix map for Poseidon Z RGB keyboard 2020-05-09 15:48:13 -05:00
Adam Honse 105f5642ef Add matrix map support 2020-05-09 15:48:13 -05:00
Adam Honse 54ab57cea6 Add zone types to HyperX and Poseidon Z RGB keyboard controllers 2020-05-09 15:48:13 -05:00
Adam Honse e3e6c0347e Add a thread to RGBController to asynchronously perform device updates. Only implemented for UpdateLEDs for now 2020-05-09 15:48:13 -05:00
Adam Honse 4d6706ce61 Close server listener thread when read returns zero (client connection lost) 2020-05-09 15:48:13 -05:00
Adam Honse 39c5aff864 Send color data over the network when calling color update functions 2020-05-09 15:48:13 -05:00
Adam Honse 450f438538 Send mode data block when updating mode 2020-05-09 15:48:13 -05:00
Adam Honse 0270c745ce Implement RGBController_Network packet sending for current set of RGBController commands 2020-05-09 15:48:13 -05:00
Adam Honse e2dfcd5b0f Client now requests list of all controllers from server and adds them to the master list 2020-05-09 15:48:13 -05:00
Adam Honse 68fa3c2def Create functions for sending replies 2020-05-09 15:48:13 -05:00
Adam Honse cde7469191 Create functions for sending requests 2020-05-09 15:48:13 -05:00
Adam Honse 7c1a1396ca Client requests controller count and first controller data block from server, prints response 2020-05-09 15:48:13 -05:00
Adam Honse 7f052f21aa Run client from main 2020-05-09 15:48:12 -05:00
Adam Honse dff667751b Start work on network client 2020-05-09 15:48:12 -05:00
Adam Honse 2625807c1a Add RGBController function call packet functionality 2020-05-09 15:48:12 -05:00
Adam Honse 7af283fdbf Implement requests for number of controllers and controller information block 2020-05-09 15:48:12 -05:00
Adam Honse c7ffe3b926 Network server can now receive packets properly 2020-05-09 15:48:12 -05:00
Adam Honse 46339c5f86 More work on network support, need to implement spawning of one read thread for each client socket 2020-05-09 15:48:12 -05:00
Adam Honse cf69598fd1 Start working on server request processing code 2020-05-09 15:48:12 -05:00
Adam Honse 594f66ab23 Initial network files 2020-05-09 15:48:12 -05:00
Adam Honse 01e0808e41 Add 1ms sleep after every Corsair peripheral USB message because K70 RGB locks up on Linux otherwise 2020-05-04 17:02:39 -05:00
Adam Honse 2dc443ff1e Add 0x18A3 to Aura addressable PID list (Z390-F) 2020-05-01 15:28:49 -05:00
Adam Honse 0ab0586dfa Update OpenRazer-Win32 DLLs to openrazer commit 134d7bf 2020-05-01 13:41:42 -05:00
Adam Honse 88fa6bf25a Hide SMBus tools panel, will add a settings option to show it 2020-04-29 16:36:37 -05:00
Adam Honse 9346490e4a Fix memory leak in OpenRazer controller 2020-04-28 20:08:43 -05:00
Adam Honse 7d4e5d6122 Add Redragon M715 support 2020-04-28 17:07:59 -05:00
Adam Honse d4a03b23c8 Add Redragon K550 support 2020-04-28 16:55:39 -05:00
Adam Honse 47b5c94310 Add WinUSB/Zadig info to README 2020-04-23 19:32:57 -05:00
Adam Honse 079a984f8d Add some information to the README and update the formatting a bit 2020-04-23 19:24:27 -05:00
Adam Honse b6e35c4155 Add Mamba 2012 and fix Mamba (wireless Chroma version) device string 2020-04-21 20:02:32 -05:00
Adam Honse c9d1ac5d8f Update OpenRazerWindows to support DeathAdder Chroma command format 2020-04-21 19:40:09 -05:00
Adam Honse 427c635ed8 Update to OpenRazer-Win32 API, device attribute pointers are now filled in by the driver during device probe, so we don't need to fill them in manually by device type anymore 2020-04-21 16:22:39 -05:00
Chris 0703bcd0a8 Several improvements to the controller
Corrected syntax errors
Corrected logical errors
Readability improvements
Build no longer segfaults changing zone
2020-04-21 15:51:54 -05:00
Adam Honse 984c6bb7f5 Fix naming convention 2020-04-21 15:27:46 -05:00
Adam Honse d27095dacd Fix duplicate strings in OpenRazer device list 2020-04-21 15:26:22 -05:00
Chris 9228b5c4cd Added missing RGB devices found in upstream Openrazer
Sections sorted alphabetically

Added Razer Keyboards
    anansi_device
    cynosa_chroma_device
    blackwidow_2019_device
    blackwidow_chroma_v2_device
    blackwidow_chroma_overwatch_device
    blackwidow_elite_device
    blackwidow_x_chroma_device
    huntsman_device
    huntsman_te_device

Added Razer Mice
    abyssus_elite_dva_edition_device
    abyssus_essential_device
    basilisk_device
    lancehead_te_device
    mamba_chroma_wired_device
    mamba_chroma_wireless_device
    mamba_wireless_wired_device
    naga_hex_v2_device
    naga_trintiy_device
    viper_ultimate_device

Added Mousepad
    firefly_device_hyperflux
    goliathus_device
2020-04-21 00:38:55 -05:00
Chris 7fe87703e5 Initial addition for the CoolerMaster MP750 Controller 2020-04-19 03:12:31 -05:00
Adam Honse c65edbeebc Fix UpdateLEDs for non-matrix OpenRazer devices 2020-04-19 01:22:40 -05:00
Adam Honse b6bf34279c Add disclaimer and warning about SMBus access functionality 2020-04-19 01:08:00 -05:00
Adam Honse 68e444aa3b Fix Naga Epic Chroma definition in device list 2020-04-19 00:58:02 -05:00
Adam Honse 3d12930067 Add Razer Naga Epic Chroma support (requires support in OpenRazer) 2020-04-19 00:56:42 -05:00
Adam Honse 3de7f32a3a Get Naga Chroma working 2020-04-19 00:13:06 -05:00
Adam Honse 216fe063e0 Fix apply all for Razer devices that don't have custom mode 2020-04-18 23:34:32 -05:00
Adam Honse ef6195271e Add support for OpenRazer mice with _led_effect and _led_rgb control scheme (DeathAdder Chroma) 2020-04-18 23:30:10 -05:00
Adam Honse 86eb273e46 Pull in OpenRazer improvements to OpenRazerWindows and fix some minor issues with OpenRazer controller code for both platforms 2020-04-18 20:47:34 -05:00
chris 22813c06dc Added Blackwidow X TE and Deathadder Elite + associated modes 2020-04-18 20:28:19 -05:00
Adam Honse 9840f0a8b6 Initial driver for ROG Aura Core laptop keyboards. Untested. 2020-04-18 00:24:35 -05:00
Adam Honse 69539432b5 Treat direct control as a mode in Aura Addressable controller 2020-04-16 13:53:25 -05:00
Adam Honse 4433760cab Set mode to all Aura addressable channels 2020-04-16 09:36:26 -05:00
Adam Honse ba2ce98a3e Add support for multiple addressable channels in Aura addressable controller. Direct mode only for now 2020-04-15 20:39:58 -05:00
Adam Honse 1e171fcfb0 Store and print configuration table for Aura Addressable controller 2020-04-14 19:09:27 -05:00
Adam Honse dc88b1a752 Add Aura Terminal PID to addressable controller and implement firmware string retrieval 2020-04-14 18:46:54 -05:00
Adam Honse 3f2a118a39 Add referenced projects to README 2020-04-13 12:03:43 -05:00
Adam Honse b8c80e6ba5 Fix infinite for loop in Aura Addressable controller 2020-04-11 12:43:31 -05:00
Adam Honse 405bbc5464 Remove unused variable 2020-04-11 02:34:16 -05:00
Adam Honse 5371fe1cc2 Fix infinite loop in Aura Addressable controller direct mode 2020-04-11 02:29:51 -05:00
Juri Berlanda cdce79bd07 [README] Fix typo on apt install. 2020-04-10 15:15:37 -05:00
Adam Honse 87395d0b0d Update name string for Razer Blade 15 (Mid 2019) Mercury 2020-04-10 03:27:17 -05:00
Adam Honse 7050a0dac1 Use mode specific colors for RGB Fusion 2 USB effect modes 2020-04-10 02:04:16 -05:00
Adam Honse bc01b53de5 Add Razer Tiamat 7.1 V2 to OpenRazer device list 2020-04-09 13:33:50 -05:00
Adam Honse 680c143ad7 Add the rest of the OpenRazer supported laptops to the device list 2020-04-09 12:45:13 -05:00
Adam Honse 38c3f2d94c Add Blade 15 mid-2019 (Mercury) to OpenRazer supported device list 2020-04-09 10:22:33 -05:00
Adam Honse 5344806a85 Remove submodule update steps from instructions 2020-04-09 09:34:04 -05:00
Adam Honse 21f29a1a56 Remove libe131 submodule and add necessary files to main repo. Fixes Gitlab automatic packaging issue 2020-04-09 09:29:54 -05:00
Adam Honse c5149b2521 Add links to third party projects used in OpenRGB to the README 2020-04-09 08:55:47 -05:00
Nagy Tam?s (T-bond) f9a25c9612 + Added to get current mode of zone
+ Option to get/set cycle num
 + Option to read device settings
 + Option to set/get sync settings
 * Fix GUI max led count

Signed-off-by: Nagy Tam?s (T-bond) <[email protected]>
2020-04-09 00:19:35 -05:00
Nagy Tam?s (T-bond) 4b4d3bf790 + Added read all settings data
+ Added option to configure Corsair zone settings
+ Added option to set volumes (?)

Signed-off-by: Nagy Tam?s (T-bond) <[email protected]>
2020-04-09 00:12:22 -05:00
Nagy Tam?s (T-bond) 3a11ed4e43 + Read controller ID, ROM versions, and Manufacturer + Product name. 2020-04-09 00:02:57 -05:00
Nagy Tam?s (T-bond) 238dc0f0ae + Save settings on system power off. 2020-04-08 23:25:59 -05:00
Nagy Tam?s (T-bond) 0568fc5ed2 + Added all effect to the GUI list. 2020-04-08 23:13:34 -05:00
Nagy Tam?s (T-bond) 37241ee6f2 + Started implementation of MSI Mystic Light USB controllers. 2020-04-08 23:09:21 -05:00
Martin Hartl 1f91dd227f NZXT Kraken: Add a default logo mode 2020-04-08 16:42:42 -05:00
Martin Hartl facfa05062 Add NZXT Kraken driver
Driver should work for NZXT Kraken X42/X52/X62/X72. Most of the color
modes and settings are already working. However, there are currently
some limitations in settings different ring and logo modes.
2020-04-08 16:35:41 -05:00
Adam Honse 6fd6c7f176 Initial support for addressable headers on Asus Aura motherboards. 2020-04-08 14:21:07 -05:00
Adam Honse d947cc2499 Add description to devices that were missing a description 2020-04-06 20:44:52 -05:00
Adam Honse 5db52e5dc2 Add resizing to RGB Fusion 2 USB controller addressable headers 2020-04-06 16:31:09 -05:00
Adam Honse 1249814e93 Fix segfault in Linux USB serial port auto-detection 2020-04-06 14:42:15 -05:00
Adam Honse dda8e9470f Update README 2020-04-06 11:42:43 -05:00
Adam Honse 72482d4ff9 Remove 0x66 from the Aura motherboard list as it is also in the Aura RAM list and gets double-detected if it exists 2020-04-04 20:48:16 -05:00
Adam Honse a50049e63b Add NCT6798D to Super-IO list in Windows 2020-04-04 18:41:38 -05:00
Nagy Tam?s (T-bond) 2970e56324 * Fixed Exit action on system tray icon 2020-04-04 17:08:48 -05:00
Adam Honse aa1ad8db85 Add zone resizing to CLI 2020-04-04 02:53:55 -05:00
Adam Honse 7f865cfee9 Allow up to 200 LEDs per channel on Corsair Lighting Node devices 2020-04-02 16:24:21 -05:00
Adam Honse c7b9fe90a6 Detect serial devices behind USB hubs 2020-04-01 16:57:56 -05:00
Adam Honse 0c7009b973 Update color wheel when choosing an LED from the LED selection box 2020-03-31 16:34:55 -05:00
Adam Honse d791361f22 Fix filename case to get ColorWheel building in Linux 2020-03-30 19:23:50 -05:00
Adam Honse 5719956441 Add color wheel color picker to UI 2020-03-30 17:54:25 -05:00
Adam Honse eba9fc0213 Add check to ensure we have a valid SMBus index before detecting/dumping, prevents segfaults when clicking detect on an invalid bus 2020-03-29 17:31:29 -05:00
Adam Honse 556fb634bb Clean up Redragon K556 code and add speed and color control 2020-03-29 14:54:39 -05:00
Adam Honse e39617a665 Compute checksum for Redragon K556 packets 2020-03-29 02:14:59 -05:00
Adam Honse 9f6c3819bd Increment version number post-release 2020-03-28 15:29:49 -05:00
Adam Honse 91c8ec0cb0 OpenRGB version 0.1 2020-03-28 15:06:37 -05:00
cip91sk 314283a37c add missing aura ram address 2020-03-28 14:46:02 -05:00
Adam Honse c3e5d91b6b Allow manual resizing of Hue+ channels 2020-03-28 14:37:27 -05:00
Adam Honse c769c20af1 Move static mode to top of Redragon M711 mode list 2020-03-28 14:35:14 -05:00
Adam Honse 2a43cefbe6 Add Redragon K556 modes, though grouped modes and colors aren't implemented yet 2020-03-27 23:24:16 -05:00
Adam Honse 68960b7b14 Add RGBController for Redragon K556 keyboard, only supports custom mode for now 2020-03-27 23:24:16 -05:00
Adam Honse ad85efcb14 Update Redragon code, split mouse and keyboard into their own controllers, and get mouse control working 2020-03-27 23:24:16 -05:00
Adam Honse 7c221416cc Redragon M709 and K556 development 2020-03-27 23:24:16 -05:00
Adam Honse 9ba1b2fc57 Bring in nct6775 SMBus driver improvements from updated patch to Windows 2020-03-24 18:07:23 -05:00
Adam Honse caf1e5c7f0 Update OpenRazer-win32 DLLs to openrazer commit bd864c8 2020-03-24 17:58:03 -05:00
Adam Honse 2b660a47c7 Fix wrong index being used in profile lookup that would cause segfaults if there are more controllers detected than in profile 2020-03-23 23:40:18 -05:00
Adam Honse 0c45e26c98 Add timeouts to i2c-nct6775 driver and fix kernel segfault caused by byte access with no data 2020-03-23 23:22:25 -05:00
Adam Honse fdbaf9bf63 Fix segfault in CLI 2020-03-22 22:18:30 -05:00
Adam Honse 08a1197b7e Fix arguments not parsing in CLI, add mode specific color support to CLI 2020-03-22 16:22:59 -05:00
Adam Honse 87a9ea5b14 Add some comments to the CLI code and clean up some warnings 2020-03-22 03:49:08 -05:00
Adam Honse 2b8d25559a Move help and version functions to the same place as the other arguments 2020-03-22 01:48:57 -05:00
Adam Honse 3db9189cbb Fix current device ID in CLI 2020-03-22 01:01:01 -05:00
Adam Honse a0c379e8c7 Add profile saving to command line 2020-03-22 00:26:06 -05:00
Adam Honse 0ae4964545 Clean up some of the CLI code and add option to load a profile from the command line 2020-03-22 00:04:27 -05:00
Adam Honse 69651b3f91 Load sizes for variable-size controllers in CLI mode 2020-03-20 13:50:54 -05:00
Adam Honse ce9508aa88 Allow 0x03 or 0x04 for detecting Corsair Pro DRAM 2020-03-20 13:05:49 -05:00
Adam Honse aa182936ba Clean up warnings, except in hidapi and cli files 2020-03-20 12:10:18 -05:00
Adam Honse 745bbac93b Fix i2c bus names on Linux 2020-03-20 10:20:46 -05:00
Adam Honse 5c3c15f930 Remove Synchronized Effects tab as the effects engine has been postponed until after 1.0 2020-03-20 00:39:29 -05:00
Adam Honse 4919b03bd1 Remove controller-side LED count from Corsair Lighting Node and ThermalTake Riing controllers, initialize them to zero LED count 2020-03-19 20:55:57 -05:00
Adam Honse 18c18e3999 Automatically save a sizes.ors profile when resizing a zone, then automatically load zone sizes from sizes.ors on start 2020-03-19 14:24:39 -05:00
Adam Honse 01020b50d9 Set default number of LEDs per strip in RGB Fusion 2 controller 2020-03-18 22:49:35 -05:00
Adam Honse 00f422375b Initial Corsair mouse support, tested on M65 RGB Elite. Shows as mousemat with 15 zones for now as zone mapping isn't supported yet 2020-03-13 18:55:07 -05:00
Adam Honse 25807902c9 Set each LED independently for Crucial effect modes 2020-03-13 21:41:23 +00:00
Adam Honse 0bbef425a4 Enable effects on Crucial controller, but color modes unimplemented 2020-03-13 17:20:32 +00:00
Adam Honse ec65d8a2a9 Update OpenRazer-win32 DLLs to openrazer commit 692e36b 2020-03-12 17:37:26 -05:00
Adam Honse 47df8f3414 Fix leftover un-renamed types 2020-03-12 14:53:32 -05:00
Adam Honse c560ee4b7e Rename RGBFusion2Controller to RGBFusion2USBController 2020-03-12 18:58:28 +00:00
Adam Honse 74080150e0 Rename AuraController to AuraSMBusController 2020-03-12 17:27:52 +00:00
Adam Honse ab7ddc1629 Rename HyperXController to HyperXDRAMController 2020-03-11 19:37:10 -05:00
Adam Honse 000bef969c Add more Corsair keyboards to the detection list 2020-03-11 19:19:37 -05:00
Adam Honse c8e0aec596 Use 24-bit color protocol for Corsair keyboards 2020-03-11 17:31:30 -05:00
Adam Honse ecf4427c76 Rename CorsairController to CorsairVengeanceController, CorsairProController to CorsairVengeanceProController 2020-03-11 21:15:05 +00:00
Adam Honse d299e90954 Fix 24-bit keyboard color set function 2020-03-11 12:18:24 -05:00
Adam Honse 98bb92acdb Add 24-bit color set function for keyboards 2020-03-11 15:15:43 +00:00
Adam Honse 0e77149444 Rename CorsairKeyboardController to CorsairPeripheralController 2020-03-10 21:26:36 -05:00
Adam Honse e6c21f0a72 Add firmware version to Corsair Lighting Node driver 2020-03-10 15:57:46 -05:00
Adam Honse da9f6d7c72 Add description for ASUS Aura device driver 2020-03-10 14:09:43 -05:00
Adam Honse 97975b6d36 Update description on Corsair Lighting Node driver 2020-03-10 13:59:17 -05:00
Adam Honse ad98cc173b Update description on Corsair peripheral driver 2020-03-10 11:35:16 -05:00
Adam Honse 5a33c80d65 Fix build issue in Linux in Corsair Keyboard driver 2020-03-09 20:47:07 -05:00
Adam Honse f661bf66f1 Fix button sizes a bit, it's not perfect but it's better than it was 2020-03-09 20:41:41 -05:00
Adam Honse f1e1c41d68 Add support for Corsair Polaris MM800 mousemat using CorsairKeyboardController driver 2020-03-09 20:39:55 -05:00
Adam Honse a7ed250c4e Don't initialize pointers on zones with no LEDs 2020-03-09 16:39:38 -05:00
Adam Honse 62c06202e0 Re-enable and update RGBController data block get/set functions for new API parameters. This gets profile savig and loading working again 2020-03-09 12:28:50 -05:00
Adam Honse 23ad5ca244 Fix setting individual LEDs when a specific zone is selected 2020-03-08 20:51:30 -05:00
Adam Honse 5712717ef8 Update maximum number of LEDs for Thermaltake Riing zone to 20 LEDs 2020-03-08 20:25:07 -05:00
Adam Honse da54e89839 Fix Thermaltake Riing controller 2020-03-08 17:07:57 -05:00
Adam Honse 57b8377f5a Disable built in effects before setting strip colors in RGB Fusion 2 controller 2020-03-08 17:01:09 -05:00
Adam Honse fbb718c532 Update RGB Fusion 2 controller to new RGBController API. Reworked some of the RGB Fusion 2 controller code to be more consistent with the rest of the project. 2020-03-08 12:06:21 -05:00
Adam Honse 5a469ea615 Update Corsair Keyboard controller to new RGBController API 2020-03-07 18:06:55 -06:00
Adam Honse 2099abb126 Update Patriot Viper RGB controller to new RGBController API 2020-03-07 18:01:00 -06:00
Adam Honse 4b4e939d10 Update Crucial Ballistix RGB controller to new RGBController API 2020-03-07 17:55:41 -06:00
Adam Honse e0094915fe Update ThermalTake Poseidon Z RGB controller to new RGBController API 2020-03-07 17:46:38 -06:00
Adam Honse aa6e2e611b Update HyperX Keyboard controller to new RGBController API 2020-03-07 17:37:50 -06:00
Adam Honse ce8331b467 Update Faustus controller to new RGBController API 2020-03-07 17:18:44 -06:00
Adam Honse 54ff4d57b0 Fix Hue 2 controller build on Linux 2020-03-07 17:12:31 -06:00
Adam Honse 3abb0c05ba Update Corsair Vengeance RGB Pro controller to new RGBController API 2020-03-07 17:08:04 -06:00
Adam Honse acc84f6a09 Update ASUS Aura GPU controller to new RGBController API. Also update ASUS Aura controller to read colors from hardware during initialization. 2020-03-07 16:55:02 -06:00
Adam Honse 74b0d195d9 Update Corsair Vengeance RGB controller to new RGBController API 2020-03-07 16:41:59 -06:00
Adam Honse 920e001bab Update MSI 3-Zone Keyboard controller to new RGBController API 2020-03-07 16:35:54 -06:00
Adam Honse 4c2ceed5b6 Update ASRock Polychrome controller to new RGBController API 2020-03-07 16:30:00 -06:00
Adam Honse 515c17b8dd Update MSI-RGB controller to new RGBController API 2020-03-07 16:20:35 -06:00
Adam Honse 2ffb02abde Update E1.31 controller to new RGBController API 2020-03-07 16:13:15 -06:00
Adam Honse 3237c8842a Update NZXT Hue+ and Hue 2 controllers to new RGBController API. Fix direct mode not working on Hue 2. 2020-03-07 15:56:07 -06:00
Adam Honse fde468a162 Update LED Strip controller to new RGBController API 2020-03-07 01:38:32 -06:00
Adam Honse f854441cf7 Update HyperX RGB RAM controller to new RGBController API 2020-03-07 01:28:26 -06:00
Adam Honse 408020c244 Update Gigabyte RGB Fusion 1.0 controller to new RGBController API 2020-03-07 01:10:26 -06:00
Adam Honse f806f3ad66 Update AMD Wraith Prism controller to new RGBController API 2020-03-07 01:00:58 -06:00
Adam Honse 7c1c9a7979 Update OpenRazer (Windows and Linux) controllers for new RGBController API 2020-03-07 00:38:42 -06:00
Adam Honse 283cb5a8ac Update RGB Fusion GPU controller to new RGBController API 2020-03-06 16:54:53 -06:00
Adam Honse 5f21674b8f Update Aura controller for RGBController API changes 2020-03-06 14:20:17 -06:00
Adam Honse fe6a84d6c9 Rename NodePro to LightingNode 2020-03-06 12:11:53 -06:00
Adam Honse f7cb8ca969 Delete CorsairCmdrProController files now that Corsair Pro is merged into Lighting Node driver 2020-03-05 22:26:29 -06:00
Adam Honse 64dad049f9 Set endpoint based on Corsair Lighting Node device table 2020-03-05 22:04:30 -06:00
Adam Honse 1115213d5a Consolidate Corsair Lighting Node and compatible device drivers 2020-03-05 21:12:17 -06:00
Adam Honse bc01ec0e4b Update Thermaltake Riing controller for resizable channels 2020-03-05 12:29:17 -06:00
Adam Honse 62518b5163 Update RGBController API and GUI to handle resizable zones. All controllers except for CorsairNodePro have been disabled pending rework 2020-03-04 19:29:58 -06:00
Adam Honse 736e624366 Resize button. Resizes mode specific color lists. Partial implementation of resizing zones 2020-03-04 17:53:44 -06:00
Adam Honse d7298cafd0 Fix build on Linux 2020-03-03 22:06:46 -06:00
Adam Honse 70783fb28f Add button to delete profiles and confirmation dialog 2020-03-03 21:15:33 -06:00
Adam Honse 45a5f629e5 Do a complete refresh of profile list when saving profile 2020-03-03 21:02:50 -06:00
Adam Honse ec73337929 Update OpenRazer-Win32 DLLs to fix corrupt serial and version strings, enable reading these in OpenRGB. 2020-03-03 13:22:23 -06:00
Adam Honse 148b84b7d1 Add support for ASRock Polychrome FW 3.04 (X570 Taichi) 2020-03-03 12:15:55 -06:00
Adam Honse 3cf855bd10 Search through controller list for each controller when loading profile, allows controller order to change without breaking the profile 2020-03-03 12:11:21 -06:00
Adam Honse 9deb0f8fff Move profile code from Qt UI to new ProfileManager class 2020-03-02 16:05:07 -06:00
Adam Honse 8c86686d01 Delay 200ms after changing Poseidon Z RGB mode so that direct colors are set correctly 2020-03-01 22:12:51 -06:00
Adam Honse c451487401 Change direct effects mode back to Direct mode on HyperX keyboard 2020-03-01 22:04:52 -06:00
Adam Honse 5defbc1580 Fix color mode for Thermaltake Riing direct mode 2020-03-01 22:00:24 -06:00
Adam Honse b5af840dcc Fix possible out of bounds access when initializing Aura RAM addresses 2020-03-01 21:50:08 -06:00
Adam Honse 1b170ff664 Update libusb DLLs to include a small change to fix detection of some composite HID devices such as RGB keyboards. Source for this new DLL at my libusb fork - https://github.com/CalcProgrammer1/libusb 2020-03-01 21:42:43 -06:00
Adam Honse 31a6da1b21 Build hidapi from source using libusb backend. This requires installation of WinUSB driver on Windows but fixes issues with Windows-specific HID implementation 2020-03-01 21:16:22 -06:00
Adam Honse cb6dfd83d8 Add refreshing thread for HyperX keyboard Direct mode 2020-03-01 20:57:04 -06:00
Adam Honse 50ea274205 Add timeouts to fix HyperX and Poseidon Z RGB in Linux 2020-03-01 20:56:07 -06:00
Adam Honse c7960c090a Add software version information to CLI 2020-02-29 14:01:06 -06:00
Adam Honse 85b2545409 Fill in software information and set version to 0.0 for now 2020-02-29 13:45:43 -06:00
Adam Honse e10881db3e Add empty software information tab to information UI 2020-02-28 12:31:32 -06:00
Adam Honse 977feabe6e Add profile selection to system tray icon menu 2020-02-27 13:16:10 -06:00
Adam Honse a6c9d1232a Don't apply colors unless per LED mode 2020-02-26 21:16:02 -06:00
Adam Honse 4024e6de85 Fix build on Linux 2020-02-26 19:40:25 -06:00
Adam Honse f3df584d3a Don't update devices if the profile could not be loaded 2020-02-26 19:36:00 -06:00
Adam Honse 60a0ab5c93 Populate profile list with .orp files and load profile selected in list 2020-02-26 19:36:00 -06:00
Adam Honse c908847577 Add dialog to name profile. Save all controllers to a single file. Add a file header with version number and use extension .orp for OpenRgb Profile 2020-02-26 19:36:00 -06:00
Adam Honse bd027e596e Set colors when updating mode 2020-02-26 19:36:00 -06:00
Adam Honse 51c3568f7a Profile save and load test 2020-02-26 19:36:00 -06:00
Adam Honse 4f8db7d63f Add cstring include to fix build on Linux 2020-02-25 21:07:06 -06:00
523 changed files with 85213 additions and 10942 deletions
+7
View File
@@ -1 +1,8 @@
*.pro.user*
*.o
ui_*
moc_*
qrc_*
OpenRGB
Makefile
OpenRGB-x86_64.AppImage
+197
View File
@@ -0,0 +1,197 @@
# swy: some useful references; the MSVC part of the CI script is based on the one from bind9, by Michał Kępień:
# https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/blob/master/cookbooks/preinstalled-software/README.md
# https://gitlab.isc.org/isc-projects/bind9/commit/facc6a051fcac70fbbc61cb92a37be8c3e4db5ec#587d266bb27a4dc3022bbed44dfa19849df3044c_718_731
# https://www.kittell.net/code/powershell-unix-sed-equivalent-change-text-file/
# https://powershell.org/forums/topic/how-to-use-ansi-vt100-formatting-in-powershell-ooh-pretty-colors/
#-----------------------------------------------------------------------#
# OpenRGB GitLab CI Configuration #
#-----------------------------------------------------------------------#
.shared_windows_runners:
tags:
- shared-windows
- windows
- windows-1809
stages:
- build
before_script:
- echo "started by ${GITLAB_USER_NAME}"
#-----------------------------------------------------------------------#
# Linux (AppImage) 32-bit Build Target #
#-----------------------------------------------------------------------#
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:
- apt update
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
- ./scripts/build-appimage.sh
artifacts:
paths:
- OpenRGB-x86_64.AppImage
expire_in: 30 days
#-----------------------------------------------------------------------#
# Windows (32-bit) Build Target #
#-----------------------------------------------------------------------#
build_windows_32:
extends:
- .shared_windows_runners
stage: build
script:
- $esc = "$([char]27)"
- $count = 0
- function _unix_tmsec_ { [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds }
- function _fold_start_ { param( [string]$TEXT_TAG ) $t=_unix_tmsec_; $global:count += 1; Write-Host -NoNewLine "`r`n`r`nsection_start:${t}:sect_${count}`r${esc}[0K${esc}[33m${TEXT_TAG}${esc}[39m`r`n"; }
- function _fold_final_ { $t=_unix_tmsec_; Write-Host -NoNewLine "`r`n`r`nsection_end:${t}:sect_${count}`r${esc}[0K`r`n" ; }
- _fold_start_ 'configuring the msvc environment variables'
- Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Auxiliary/Build"
- '& cmd.exe /C "vcvarsall.bat x86 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }'
- Pop-Location
- _fold_final_
- _fold_start_ 'downloading precompiled versions of qtbase, qttools (for windeployqt) and jom (for a more parallel nmake)'
- mkdir _qt
- mkdir _qt_download
- Push-Location _qt_download
- curl.exe -LJ -o qt-base.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win32_msvc2019/5.15.0-0-202005150700qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86.7z'
- curl.exe -LJ -o qt-tools.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win32_msvc2019/5.15.0-0-202005150700qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86.7z'
- curl.exe -LJ -o qt-jom.zip 'https://download.qt.io/official_releases/jom/jom.zip'
- _fold_final_
- _fold_start_ 'extracting the downloaded qt binaries'
- 7z x qt-base.7z '-o../_qt' -y
- 7z x qt-tools.7z '-o../_qt' -y
- 7z x qt-jom.zip '-o../_qt' -y
- _fold_final_
- _fold_start_ 'turn the qt install from enterprise to foss; remove the licensing checks'
- ${qconfig-pri-folder} = '..\_qt\5.15.0\msvc2019\mkspecs\qconfig.pri'
- (Get-Content ${qconfig-pri-folder}).replace('QT_EDITION = Enterprise', 'QT_EDITION = OpenSource') | Set-Content ${qconfig-pri-folder}
- (Get-Content ${qconfig-pri-folder}).replace('QT_LICHECK = licheck.exe', '') | Set-Content ${qconfig-pri-folder}
- Pop-Location
- _fold_final_
- _fold_start_ 'run qmake and generate the msvc nmake makefile'
- mkdir _build; cd _build
- ..\_qt\5.15.0\msvc2019\bin\qmake ..\OpenRGB.pro
- _fold_final_
- _fold_start_ 'start the actual build with jom instead of nmake; for speed'
- ..\_qt\jom
- _fold_final_
- _fold_start_ 'run windeployqt to automatically copy the needed dll files'
- ..\_qt\5.15.0\msvc2019\bin\windeployqt --no-angle --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime --no-webkit2 .\release\
- _fold_final_
- _fold_start_ 'compressing the release folder so that we can upload it as artifact'
- mv release 'OpenRGB Windows 32-bit'
- ${datetime} = Get-Date ([datetime]::UtcNow) -Format "yyyy-MM-ddTHH-mm-ss"
- ${revision} = ((git rev-parse --short HEAD) | Out-String).Trim()
- ${rversion} = (((Get-Content '..\OpenRGB.pro' | Select-String -Pattern "VERSION =") | Out-String).Trim().Split("="))[1].Trim()
- 7z a -mx9 -r -y "OpenRGB_${rversion}_32_${revision}_nightly_${datetime}.7z" 'OpenRGB Windows 32-bit'
- _fold_final_
# cache:
# key: same-key
# paths:
# - C:\vcpkg\installed\
artifacts:
paths:
- _build/*.7z
expire_in: 30 days
#-----------------------------------------------------------------------#
# Windows (64-bit) Build Target #
#-----------------------------------------------------------------------#
build_windows_64:
extends:
- .shared_windows_runners
stage: build
script:
- $esc = "$([char]27)"
- $count = 0
- function _unix_tmsec_ { [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds }
- function _fold_start_ { param( [string]$TEXT_TAG ) $t=_unix_tmsec_; $global:count += 1; Write-Host -NoNewLine "`r`n`r`nsection_start:${t}:sect_${count}`r${esc}[0K${esc}[33m${TEXT_TAG}${esc}[39m`r`n"; }
- function _fold_final_ { $t=_unix_tmsec_; Write-Host -NoNewLine "`r`n`r`nsection_end:${t}:sect_${count}`r${esc}[0K`r`n" ; }
- _fold_start_ 'configuring the msvc environment variables'
- Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Auxiliary/Build"
- '& cmd.exe /C "vcvarsall.bat x64 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }'
- Pop-Location
- _fold_final_
- _fold_start_ 'downloading precompiled versions of qtbase, qttools (for windeployqt) and jom (for a more parallel nmake)'
- mkdir _qt
- mkdir _qt_download
- Push-Location _qt_download
- curl.exe -LJ -o qt-base.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win64_msvc2019_64/5.15.0-0-202005150700qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z'
- curl.exe -LJ -o qt-tools.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win64_msvc2019_64/5.15.0-0-202005150700qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z'
- curl.exe -LJ -o qt-jom.zip 'https://download.qt.io/official_releases/jom/jom.zip'
- _fold_final_
- _fold_start_ 'extracting the downloaded qt binaries'
- 7z x qt-base.7z '-o../_qt' -y
- 7z x qt-tools.7z '-o../_qt' -y
- 7z x qt-jom.zip '-o../_qt' -y
- _fold_final_
- _fold_start_ 'turn the qt install from enterprise to foss; remove the licensing checks'
- ${qconfig-pri-folder} = '..\_qt\5.15.0\msvc2019_64\mkspecs\qconfig.pri'
- (Get-Content ${qconfig-pri-folder}).replace('QT_EDITION = Enterprise', 'QT_EDITION = OpenSource') | Set-Content ${qconfig-pri-folder}
- (Get-Content ${qconfig-pri-folder}).replace('QT_LICHECK = licheck.exe', '') | Set-Content ${qconfig-pri-folder}
- Pop-Location
- _fold_final_
- _fold_start_ 'run qmake and generate the msvc nmake makefile'
- mkdir _build; cd _build
- ..\_qt\5.15.0\msvc2019_64\bin\qmake ..\OpenRGB.pro
- _fold_final_
- _fold_start_ 'start the actual build with jom instead of nmake; for speed'
- ..\_qt\jom
- _fold_final_
- _fold_start_ 'run windeployqt to automatically copy the needed dll files'
- ..\_qt\5.15.0\msvc2019_64\bin\windeployqt --no-angle --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime --no-webkit2 .\release\
- _fold_final_
- _fold_start_ 'compressing the release folder so that we can upload it as artifact'
- mv release 'OpenRGB Windows 64-bit'
- ${datetime} = Get-Date ([datetime]::UtcNow) -Format "yyyy-MM-ddTHH-mm-ss"
- ${revision} = ((git rev-parse --short HEAD) | Out-String).Trim()
- ${rversion} = (((Get-Content '..\OpenRGB.pro' | Select-String -Pattern "VERSION =") | Out-String).Trim().Split("="))[1].Trim()
- 7z a -mx9 -r -y "OpenRGB_${rversion}_64_${revision}_nightly_${datetime}.7z" 'OpenRGB Windows 64-bit'
- _fold_final_
# cache:
# key: same-key
# paths:
# - C:\vcpkg\installed\
artifacts:
paths:
- _build/*.7z
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
-->
-3
View File
@@ -1,6 +1,3 @@
[submodule "dependencies/libe131"]
path = dependencies/libe131
url = https://github.com/CalcProgrammer1/libe131
[submodule "razer-drivers-win32"]
path = razer-drivers-win32
url = https://github.com/rsandoz/razer-drivers-win32
+309
View File
@@ -0,0 +1,309 @@
#---------------------------------------------------------------#
# OpenRGB udev rules #
# #
# Adam Honse (CalcProgrammer1) 5/29/2020 #
#---------------------------------------------------------------#
#---------------------------------------------------------------#
# User I2C/SMBus Access #
#---------------------------------------------------------------#
KERNEL=="i2c-[0-99]*", TAG+="uaccess"
#---------------------------------------------------------------#
# User hidraw Access #
#---------------------------------------------------------------#
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", TAG+="uaccess"
#---------------------------------------------------------------#
# AMD Wraith Prism #
#---------------------------------------------------------------#
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 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1854", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1869", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1866", TAG+="uaccess"
#---------------------------------------------------------------#
# ASUS Aura USB Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1867", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1872", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1889", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18a3", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18f3", TAG+="uaccess"
#---------------------------------------------------------------#
# Cooler Master Peripheral Devices #
# #
# Mousemats: #
# Cooler Master MP750 #
#---------------------------------------------------------------#
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 #
# #
# Corsair Lighting Node Core #
# Corsair Lighting Node Pro #
# Corsair Commander Pro #
# Corsair LS100 #
# Corsair 1000D Obsidian #
# Corsair Spec Omega RGB #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c1a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c0b", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c10", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c1e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1d00", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1d04", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Peripheral Devices #
# #
# Keyboards: #
# Corsair K55 RGB #
# Corsair K65 RGB #
# Corsair K65 RGB Lux #
# Corsair K65 RGB Rapidfire #
# Corsair K68 RGB #
# Corsair K70 RGB #
# Corsair K70 RGB Lux #
# Corsair K70 RGB Rapidfire #
# Corsair K70 RGB MK2 #
# Corsair K70 RGB MK2 SE #
# Corsair K70 RGB MK2 LP #
# Corsair K95 RGB #
# Corsair K95 Platinum #
# Corsair Strafe #
# Corsair Strafe MK2 #
# #
# Mice: #
# Corsair M65 Pro #
# Corsair M65 RGB Elite #
# #
# Mousemats: #
# Corsair MM800 RGB Polaris #
# #
# Headset Stands: #
# Corsair ST100 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b3d", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b17", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b37", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b39", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b4f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b13", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b33", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b38", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b49", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b6b", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b55", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b11", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b2d", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b20", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b48", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b2e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b5a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b3b", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a34", TAG+="uaccess"
#---------------------------------------------------------------#
# HyperX Peripheral Devices #
# #
# Keyboards: #
# HyperX Alloy Elite #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16be", TAG+="uaccess"
#---------------------------------------------------------------#
# Logitech Peripheral Devices #
# #
# 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 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="3EA4", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="4559", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B10", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B93", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B94", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B96", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C34", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C35", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C36", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C37", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C42", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C56", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C59", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C60", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C67", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C70", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C71", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C73", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C75", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C76", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C77", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C79", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C80", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C81", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C82", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C83", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C84", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C85", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C86", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C87", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C88", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C89", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C90", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C91", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C92", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C94", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C95", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C96", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C98", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C99", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="905D", TAG+="uaccess"
#---------------------------------------------------------------#
# MSI/SteelSeries 3-Zone Laptop Keyboard #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1770", ATTR{idProduct}=="FF00", TAG+="uaccess"
#---------------------------------------------------------------#
# NZXT Hue 2 Devices #
# #
# NZXT Hue 2 #
# NZXT Smart Device V2 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2001", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2006", TAG+="uaccess"
#---------------------------------------------------------------#
# NZXT Kraken #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="170e", TAG+="uaccess"
#---------------------------------------------------------------#
# Redragon Peripheral Devices #
# #
# Keyboards: #
# Redragon K550 Yama #
# Redragon K552 Kumara #
# Redragon K556 Devarajas #
# Tecware Phantom Elite #
# #
# Mice: #
# Redragon M711 Cobra #
# Redragon M715 Dagger #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="0c45", ATTR{idProduct}=="5204", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0c45", ATTR{idProduct}=="5104", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0c45", ATTR{idProduct}=="5004", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0c45", ATTR{idProduct}=="652f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc30", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc39", TAG+="uaccess"
#---------------------------------------------------------------#
# Gigabyte/Aorus RGB Fusion 2 USB #
#---------------------------------------------------------------#
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 #
# #
# Mice: #
# SteelSeries Rival 100 #
# SteelSeries Rival 100 DotA 2 Edition #
# SteelSeries Rival 105 #
# SteelSeries Rival 110 #
# SteelSeries Rival 300 #
# Acer Predator Gaming Mouse (Rival 300) #
# SteelSeries Rival 300 CS:GO Fade Edition #
# SteelSeries Rival 300 CS:GO Fade Edition (stm32) #
# SteelSeries Rival 300 CS:GO Hyperbeast Edition #
# SteelSeries Rival 300 Dota 2 Edition #
# SteelSeries Rival 300 HP Omen Edition #
# Headsets: #
# SteelSeries Siberia 350 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1702", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="170c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1814", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1729", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1384", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1714", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1394", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1716", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="171a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1392", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1718", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1229", TAG+="uaccess"
#---------------------------------------------------------------#
# Thermaltake Poseidon Z RGB Keyboard #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="264a", ATTR{idProduct}=="3006", TAG+="uaccess"
@@ -12,9 +12,10 @@
#include <stdio.h>
#include <stdlib.h>
AMDWraithPrismController::AMDWraithPrismController(libusb_device_handle* 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;
@@ -49,6 +55,7 @@ std::string AMDWraithPrismController::GetEffectChannelString(unsigned char chann
unsigned char usb_buf[] =
{
0x00,
0x40, 0x21, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@@ -67,12 +74,10 @@ std::string AMDWraithPrismController::GetEffectChannelString(unsigned char chann
0x00, 0x00, 0x00, 0x00,
};
int actual;
usb_buf[0x03] = channel;
usb_buf[0x02] = channel;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 64);
ret_string.append((char *)&usb_buf[0x08]);
@@ -85,6 +90,7 @@ std::string AMDWraithPrismController::GetFirmwareVersionString()
unsigned char usb_buf[] =
{
0x00,
0x12, 0x20, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@@ -103,11 +109,10 @@ std::string AMDWraithPrismController::GetFirmwareVersionString()
0x00, 0x00, 0x00, 0x00,
};
int actual;
unsigned char fw_buf[16] = {0x00};
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 64);
for(int char_idx = 0; char_idx < 16; char_idx+=2)
{
@@ -209,6 +214,7 @@ void AMDWraithPrismController::SendEnableCommand()
{
unsigned char usb_buf[] =
{
0x00,
0x41, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@@ -227,16 +233,15 @@ void AMDWraithPrismController::SendEnableCommand()
0x00, 0x00, 0x00, 0x00,
};
int actual;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 64);
}
void AMDWraithPrismController::SendApplyCommand()
{
unsigned char usb_buf[] =
{
0x00,
0x51, 0x28, 0x00, 0x00,
0xE0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@@ -255,10 +260,8 @@ void AMDWraithPrismController::SendApplyCommand()
0x00, 0x00, 0x00, 0x00,
};
int actual;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 64);
}
void AMDWraithPrismController::SendEffectChannelUpdate
@@ -276,6 +279,7 @@ void AMDWraithPrismController::SendEffectChannelUpdate
{
unsigned char usb_buf[] =
{
0x00,
0x51, 0x2C, 0x01, 0x00,
0x05, 0xFF, 0x00, 0x01,
0xFF, 0xFF, 0x00, 0xFF,
@@ -294,27 +298,26 @@ void AMDWraithPrismController::SendEffectChannelUpdate
0xFF, 0xFF, 0xFF, 0xFF
};
int actual;
usb_buf[0x05] = effect_channel;
usb_buf[0x06] = speed;
usb_buf[0x07] = (direction ? 0x01 : 0x00) | (random_color ? 0x80 : 0x00);
usb_buf[0x08] = mode;
usb_buf[0x04] = effect_channel;
usb_buf[0x05] = speed;
usb_buf[0x06] = (direction ? 0x01 : 0x00) | (random_color ? 0x80 : 0x00);
usb_buf[0x07] = mode;
usb_buf[0x0A] = brightness;
usb_buf[0x09] = brightness;
usb_buf[0x0B] = red;
usb_buf[0x0C] = green;
usb_buf[0x0D] = blue;
usb_buf[0x0A] = red;
usb_buf[0x0B] = green;
usb_buf[0x0C] = blue;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 64);
}
void AMDWraithPrismController::SendChannelRemap(unsigned char ring_channel, unsigned char logo_channel, unsigned char fan_channel)
{
unsigned char usb_buf[] =
{
0x00,
0x51, 0xA0, 0x01, 0x00,
0x00, 0x03, 0x00, 0x00,
0x05, 0x06, 0x07, 0x07,
@@ -333,16 +336,14 @@ void AMDWraithPrismController::SendChannelRemap(unsigned char ring_channel, unsi
0x00, 0x00, 0x00, 0x00,
};
int actual;
usb_buf[0x09] = logo_channel;
usb_buf[0x0A] = fan_channel;
usb_buf[0x08] = logo_channel;
usb_buf[0x09] = fan_channel;
for(int led = 0x0A; led <= 0x18; led++)
for(int led = 0x0B; led <= 0x19; led++)
{
usb_buf[led] = ring_channel;
}
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 64);
}
@@ -8,7 +8,7 @@
\*-----------------------------------------*/
#include <string>
#include <libusb-1.0/libusb.h>
#include <hidapi/hidapi.h>
#pragma once
@@ -109,13 +109,14 @@ enum
class AMDWraithPrismController
{
public:
AMDWraithPrismController(libusb_device_handle* 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);
@@ -130,7 +131,8 @@ public:
private:
char device_name[32];
libusb_device_handle* dev;
hid_device* dev;
std::string location;
unsigned char current_fan_mode;
unsigned char current_fan_speed;
@@ -1,9 +1,9 @@
#include "Detector.h"
#include "AMDWraithPrismController.h"
#include "RGBController.h"
#include "RGBController_AMDWraithPrism.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#include <hidapi/hidapi.h>
#define AMD_WRAITH_PRISM_VID 0x2516
#define AMD_WRAITH_PRISM_PID 0x0051
@@ -17,21 +17,38 @@
void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controllers)
{
libusb_context * ctx;
libusb_init(&ctx);
hid_device_info* info;
hid_device* dev = NULL;
hid_init();
info = hid_enumerate(AMD_WRAITH_PRISM_VID, AMD_WRAITH_PRISM_PID);
//Look for AMD Wraith Prism
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, AMD_WRAITH_PRISM_VID, AMD_WRAITH_PRISM_PID);
if( dev )
while(info)
{
libusb_detach_kernel_driver(dev, 1);
libusb_claim_interface(dev, 1);
if((info->vendor_id == AMD_WRAITH_PRISM_VID)
&&(info->product_id == AMD_WRAITH_PRISM_PID)
#if USE_HID_USAGE
&&(info->interface_number == 1)
&&(info->usage_page == 0xFF00))
#else
&&(info->interface_number == 1))
#endif
{
dev = hid_open_path(info->path);
if( dev )
{
AMDWraithPrismController* controller = new AMDWraithPrismController(dev, info->path);
AMDWraithPrismController* controller = new AMDWraithPrismController(dev);
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
rgb_controllers.push_back(rgb_controller);
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
}
}
REGISTER_DETECTOR("AMD Wraith Prism", DetectAMDWraithPrismControllers);
@@ -13,16 +13,18 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
{
wraith = wraith_ptr;
name = "AMD Wraith Prism";
type = DEVICE_TYPE_COOLER;
version = wraith->GetFirmwareVersionString();
name = "AMD Wraith Prism";
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";
@@ -84,44 +86,7 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
Swirl.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Swirl);
led logo_led;
logo_led.name = "Logo";
leds.push_back(logo_led);
colors.push_back(0x00000000);
zone logo_zone;
logo_zone.name = "Logo";
logo_zone.type = ZONE_TYPE_SINGLE;
std::vector<int> logo_zone_map;
logo_zone_map.push_back(0);
logo_zone.map.push_back(logo_zone_map);
zones.push_back(logo_zone);
led fan_led;
fan_led.name = "Fan";
leds.push_back(fan_led);
colors.push_back(0x00000000);
zone fan_zone;
fan_zone.name = "Fan";
fan_zone.type = ZONE_TYPE_SINGLE;
std::vector<int> fan_zone_map;
fan_zone_map.push_back(1);
fan_zone.map.push_back(fan_zone_map);
zones.push_back(fan_zone);
led ring_led;
ring_led.name = "Ring";
leds.push_back(ring_led);
colors.push_back(0x00000000);
zone ring_zone;
ring_zone.name = "Ring";
ring_zone.type = ZONE_TYPE_SINGLE;
std::vector<int> ring_zone_map;
ring_zone_map.push_back(2);
ring_zone.map.push_back(ring_zone_map);
zones.push_back(ring_zone);
SetupZones();
}
RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
@@ -129,7 +94,64 @@ RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
}
void RGBController_AMDWraithPrism::UpdateLEDs()
void RGBController_AMDWraithPrism::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
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);
zone fan_zone;
fan_zone.name = "Fan";
fan_zone.type = ZONE_TYPE_SINGLE;
fan_zone.leds_min = 1;
fan_zone.leds_max = 1;
fan_zone.leds_count = 1;
fan_zone.matrix_map = NULL;
zones.push_back(fan_zone);
zone ring_zone;
ring_zone.name = "Ring";
ring_zone.type = ZONE_TYPE_SINGLE;
ring_zone.leds_min = 1;
ring_zone.leds_max = 1;
ring_zone.leds_count = 1;
ring_zone.matrix_map = NULL;
zones.push_back(ring_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
led logo_led;
logo_led.name = "Logo LED";
leds.push_back(logo_led);
led fan_led;
fan_led.name = "Fan LED";
leds.push_back(fan_led);
led ring_led;
ring_led.name = "Ring LED";
leds.push_back(ring_led);
SetupColors();
}
void RGBController_AMDWraithPrism::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
@@ -178,7 +200,7 @@ void RGBController_AMDWraithPrism::SetCustomMode()
active_mode = 0;
}
void RGBController_AMDWraithPrism::UpdateMode()
void RGBController_AMDWraithPrism::DeviceUpdateMode()
{
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
@@ -212,5 +234,5 @@ void RGBController_AMDWraithPrism::UpdateMode()
break;
}
UpdateLEDs();
DeviceUpdateLEDs();
}
@@ -16,12 +16,17 @@ class RGBController_AMDWraithPrism : public RGBController
public:
RGBController_AMDWraithPrism(AMDWraithPrismController* wraith_ptr);
~RGBController_AMDWraithPrism();
void UpdateLEDs();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
void DeviceUpdateMode();
private:
AMDWraithPrismController* wraith;
@@ -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;
};
@@ -0,0 +1,125 @@
/*-----------------------------------------*\
| AuraCoreController.cpp |
| |
| Driver for ASUS ROG Aura Core RGB |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 4/13/2020 |
\*-----------------------------------------*/
#include "AuraCoreController.h"
#include <cstring>
AuraCoreController::AuraCoreController(hid_device* dev_handle)
{
dev = dev_handle;
}
AuraCoreController::~AuraCoreController()
{
}
void AuraCoreController::SendBrightness
(
unsigned char brightness
)
{
unsigned char usb_buf[17];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x5A;
usb_buf[0x01] = AURA_CORE_COMMAND_BRIGHTNESS;
usb_buf[0x02] = 0xC5;
usb_buf[0x03] = 0xC4;
usb_buf[0x04] = brightness;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, usb_buf, 17);
}
void AuraCoreController::SendUpdate
(
unsigned char zone,
unsigned char mode,
unsigned char speed,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[17];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x5D;
usb_buf[0x01] = AURA_CORE_COMMAND_UPDATE;
usb_buf[0x02] = zone;
usb_buf[0x03] = mode;
usb_buf[0x04] = red;
usb_buf[0x05] = green;
usb_buf[0x06] = blue;
usb_buf[0x07] = speed;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, usb_buf, 17);
}
void AuraCoreController::SendSet()
{
unsigned char usb_buf[17];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x5D;
usb_buf[0x01] = AURA_CORE_COMMAND_SET;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, usb_buf, 17);
}
void AuraCoreController::SendApply()
{
unsigned char usb_buf[17];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x5D;
usb_buf[0x01] = AURA_CORE_COMMAND_APPLY;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, usb_buf, 17);
}
@@ -0,0 +1,76 @@
/*-----------------------------------------*\
| AuraCoreController.h |
| |
| Definitions and types for ASUS ROG Aura |
| Core RGB lighting controller |
| |
| Adam Honse (CalcProgrammer1) 4/13/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AURA_CORE_MODE_STATIC = 0, /* Static color mode */
AURA_CORE_MODE_BREATHING = 1, /* Breathing effect mode */
AURA_CORE_MODE_SPECTRUM_CYCLE = 2, /* Spectrum Cycle mode */
};
enum
{
AURA_CORE_COMMAND_UPDATE = 0xB3, /* Update mode and color */
AURA_CORE_COMMAND_SET = 0xB5, /* Set command */
AURA_CORE_COMMAND_APPLY = 0xB4, /* Apply command */
AURA_CORE_COMMAND_BRIGHTNESS = 0xBA, /* Brightness command */
};
enum
{
AURA_CORE_ZONE_IDX_ALL = 0x00, /* Update all zones */
AURA_CORE_ZONE_IDX_1 = 0x01, /* Update zone 1 */
AURA_CORE_ZONE_IDX_2 = 0x02, /* Update zone 2 */
AURA_CORE_ZONE_IDX_3 = 0x03, /* Update zone 3 */
AURA_CORE_ZONE_IDX_4 = 0x04, /* Update zone 4 */
};
enum
{
AURA_CORE_SPEED_SLOW = 0xE1, /* Slowest speed */
AURA_CORE_SPEED_NORMAL = 0xEB, /* Normal speed */
AURA_CORE_SPEED_FAST = 0xF5, /* Fastest speed */
};
class AuraCoreController
{
public:
AuraCoreController(hid_device* dev_handle);
~AuraCoreController();
void SendBrightness
(
unsigned char brightness
);
void SendUpdate
(
unsigned char zone,
unsigned char mode,
unsigned char speed,
unsigned char red,
unsigned char green,
unsigned char blue
);
void SendSet();
void SendApply();
private:
hid_device* dev;
};
@@ -0,0 +1,48 @@
#include "Detector.h"
#include "AuraCoreController.h"
#include "RGBController.h"
#include "RGBController_AuraCore.h"
#include <vector>
#include <hidapi/hidapi.h>
#define AURA_CORE_VID 0x0B05
#define NUM_PIDS 3
static const unsigned short pid_table[] =
{
0x1854,
0x1869,
0x1866
};
/******************************************************************************************\
* *
* DetectAuraCoreControllers *
* *
* Tests the USB address to see if an Asus ROG Aura Core controller exists there *
* *
\******************************************************************************************/
void DetectAuraCoreControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device* dev;
//Look for Asus ROG Aura Core RGB controller
hid_init();
for(int pid_idx = 0; pid_idx < NUM_PIDS; pid_idx++)
{
dev = hid_open(AURA_CORE_VID, pid_table[pid_idx], 0);
if( dev )
{
AuraCoreController* controller = new AuraCoreController(dev);
RGBController_AuraCore* rgb_controller = new RGBController_AuraCore(controller);
rgb_controllers.push_back(rgb_controller);
}
}
}
REGISTER_DETECTOR("ASUS Aura Core", DetectAuraCoreControllers);
@@ -0,0 +1,108 @@
/*-----------------------------------------*\
| RGBController_AuraCore.cpp |
| |
| Generic RGB Interface for ROG Aura Core |
| |
| Adam Honse (CalcProgrammer1) 4/17/2020 |
\*-----------------------------------------*/
#include "RGBController_AuraCore.h"
RGBController_AuraCore::RGBController_AuraCore(AuraCoreController* aura_ptr)
{
aura = aura_ptr;
name = "ASUS Aura Core";
type = DEVICE_TYPE_KEYBOARD;
description = "ASUS Aura Core Device";
mode Static;
Static.name = "Static";
Static.value = AURA_CORE_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_CORE_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Color Cycle";
ColorCycle.value = AURA_CORE_MODE_SPECTRUM_CYCLE;
ColorCycle.flags = 0;
ColorCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(ColorCycle);
SetupZones();
}
void RGBController_AuraCore::SetupZones()
{
zone Keyboard;
Keyboard.name = "Keyboard";
Keyboard.type = ZONE_TYPE_SINGLE;
Keyboard.leds_min = 4;
Keyboard.leds_max = 4;
Keyboard.leds_count = 4;
Keyboard.matrix_map = NULL;
zones.push_back(Keyboard);
for(unsigned int led_idx = 0; led_idx < Keyboard.leds_count; led_idx++)
{
led KeyLED;
KeyLED.name = "Keyboard LED ";
KeyLED.name.append(std::to_string(led_idx + 1));
leds.push_back(KeyLED);
}
SetupColors();
}
void RGBController_AuraCore::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AuraCore::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
}
void RGBController_AuraCore::UpdateZoneLEDs(int /*zone*/)
{
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
{
UpdateSingleLED(led_idx);
}
}
void RGBController_AuraCore::UpdateSingleLED(int led)
{
aura->SendUpdate
(
led + 1,
modes[active_mode].value,
AURA_CORE_SPEED_NORMAL,
RGBGetRValue(colors[led]),
RGBGetGValue(colors[led]),
RGBGetBValue(colors[led])
);
aura->SendSet();
aura->SendApply();
}
void RGBController_AuraCore::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraCore::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| RGBController_AuraCore.h |
| |
| Generic RGB Interface for ROG Aura Core |
| |
| Adam Honse (CalcProgrammer1) 4/17/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AuraCoreController.h"
class RGBController_AuraCore : public RGBController
{
public:
RGBController_AuraCore(AuraCoreController* aura_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:
AuraCoreController* aura;
};
@@ -6,6 +6,7 @@
| Jan Rettig (Klapstuhl) 14.02.2020 |
\*-----------------------------------------*/
#include "Detector.h"
#include "AuraGPUController.h"
#include "RGBController.h"
#include "RGBController_AuraGPU.h"
@@ -14,16 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
using namespace std::chrono_literals;
/*-------------------------------------------------------------*\
| This list contains the available I2C addresses for Aura GPUs |
@@ -88,7 +80,9 @@ void DetectAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
rgb_controllers.push_back(new_controller);
}
Sleep(1);
std::this_thread::sleep_for(1ms);
}
}
} /* DetectAuraGPUControllers() */
} /* DetectAuraGPUControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura GPU", DetectAuraGPUControllers);
@@ -29,7 +29,7 @@ int RGBController_AuraGPU::GetDeviceMode()
break;
}
for(int mode = 0; mode < modes.size(); mode++)
for(std::size_t mode = 0; mode < modes.size(); mode++)
{
if(modes[mode].value == dev_mode)
{
@@ -41,44 +41,16 @@ int RGBController_AuraGPU::GetDeviceMode()
return(active_mode);
}
void RGBController_AuraGPU::UpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
if (GetMode() == 0)
{
aura_gpu->SetLEDColorsDirect(red, grn, blu);
}
else
{
aura_gpu->SetLEDColorsEffect(red, grn, blu);
}
}
}
void RGBController_AuraGPU::UpdateZoneLEDs(int zone)
{
UpdateLEDs();
}
void RGBController_AuraGPU::UpdateSingleLED(int led)
{
UpdateLEDs();
}
RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * aura_gpu_ptr)
{
aura_gpu = aura_gpu_ptr;
name = aura_gpu->GetDeviceName();
version = "0.00.1";
location = aura_gpu->GetDeviceLocation();
type = DEVICE_TYPE_GPU;
name = aura_gpu->GetDeviceName();
type = DEVICE_TYPE_GPU;
description = "ASUS Aura GPU Device";
version = "0.00.1";
location = aura_gpu->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
@@ -101,7 +73,7 @@ RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * aura_gpu_ptr)
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Breathing;
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_GPU_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
@@ -122,28 +94,78 @@ RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * aura_gpu_ptr)
Spectrum_Cycle.color_mode = MODE_COLORS_NONE;
modes.push_back(Spectrum_Cycle);
colors.resize(1);
SetupZones();
led aura_gpu_led;
active_mode = GetDeviceMode();
}
void RGBController_AuraGPU::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone aura_gpu_zone;
aura_gpu_zone.name = "GPU";
aura_gpu_zone.type = ZONE_TYPE_SINGLE;
aura_gpu_zone.leds_min = 1;
aura_gpu_zone.leds_max = 1;
aura_gpu_zone.leds_count = 1;
aura_gpu_zone.matrix_map = NULL;
zones.push_back(aura_gpu_zone);
/*---------------------------------------------------------*\
| Set up LED |
\*---------------------------------------------------------*/
led aura_gpu_led;
aura_gpu_led.name = "GPU";
leds.push_back(aura_gpu_led);
zone aura_gpu_zone;
aura_gpu_zone.name = "GPU";
aura_gpu_zone.type = ZONE_TYPE_SINGLE;
std::vector<int> aura_gpu_zone_map;
aura_gpu_zone_map.push_back(0);
aura_gpu_zone.map.push_back(aura_gpu_zone_map);
zones.push_back(aura_gpu_zone);
SetupColors();
/*---------------------------------------------------------*\
| Initialize color |
\*---------------------------------------------------------*/
unsigned char red = aura_gpu->GetLEDRed();
unsigned char grn = aura_gpu->GetLEDGreen();
unsigned char blu = aura_gpu->GetLEDBlue();
colors[0] = ToRGBColor(red, grn, blu);
active_mode = GetDeviceMode();
colors[0] = ToRGBColor(red, grn, blu);
}
void RGBController_AuraGPU::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AuraGPU::DeviceUpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
if (GetMode() == 0)
{
aura_gpu->SetLEDColorsDirect(red, grn, blu);
}
else
{
aura_gpu->SetLEDColorsEffect(red, grn, blu);
}
}
}
void RGBController_AuraGPU::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraGPU::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraGPU::SetCustomMode()
@@ -151,7 +173,7 @@ void RGBController_AuraGPU::SetCustomMode()
active_mode = 0;
}
void RGBController_AuraGPU::UpdateMode()
void RGBController_AuraGPU::DeviceUpdateMode()
{
int new_mode = modes[active_mode].value;
aura_gpu->direct = false;
@@ -173,4 +195,4 @@ void RGBController_AuraGPU::UpdateMode()
}
aura_gpu->SetMode(new_mode);
}
}
@@ -15,15 +15,20 @@ class RGBController_AuraGPU : public RGBController
{
public:
RGBController_AuraGPU(AuraGPUController* aura_gpu_ptr);
void UpdateLEDs();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
void DeviceUpdateMode();
private:
AuraGPUController* aura_gpu;
int GetDeviceMode();
};
};
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| AuraController.cpp |
| AuraSMBusController.cpp |
| |
| Driver for ASUS Aura RGB lighting |
| controller |
@@ -7,10 +7,25 @@
| Adam Honse (CalcProgrammer1) 8/19/2018 |
\*-----------------------------------------*/
#include "AuraController.h"
#include "AuraSMBusController.h"
#include <cstring>
AuraController::AuraController(i2c_smbus_interface* bus, aura_dev_id dev)
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;
this->dev = dev;
@@ -45,7 +60,7 @@ AuraController::AuraController(i2c_smbus_interface* bus, aura_dev_id dev)
{
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 @@ AuraController::AuraController(i2c_smbus_interface* bus, aura_dev_id dev)
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
{
@@ -77,32 +99,32 @@ AuraController::AuraController(i2c_smbus_interface* bus, aura_dev_id dev)
}
}
AuraController::~AuraController()
AuraSMBusController::~AuraSMBusController()
{
}
std::string AuraController::GetDeviceName()
std::string AuraSMBusController::GetDeviceName()
{
return(device_name);
}
std::string AuraController::GetDeviceLocation()
std::string AuraSMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
return("I2C: " + return_string);
}
unsigned char AuraController::GetChannel(unsigned int led)
unsigned char AuraSMBusController::GetChannel(unsigned int led)
{
return(config_table[channel_cfg + led]);
}
const char * AuraController::GetChannelName(unsigned int led)
const char * AuraSMBusController::GetChannelName(unsigned int led)
{
switch (config_table[channel_cfg + led])
{
@@ -152,27 +174,27 @@ const char * AuraController::GetChannelName(unsigned int led)
}
}
unsigned int AuraController::GetLEDCount()
unsigned int AuraSMBusController::GetLEDCount()
{
return(led_count);
}
unsigned char AuraController::GetLEDRed(unsigned int led)
unsigned char AuraSMBusController::GetLEDRed(unsigned int led)
{
return(AuraRegisterRead(direct_reg + ( 3 * led )));
}
unsigned char AuraController::GetLEDGreen(unsigned int led)
unsigned char AuraSMBusController::GetLEDGreen(unsigned int led)
{
return(AuraRegisterRead(direct_reg + ( 3 * led ) + 2));
}
unsigned char AuraController::GetLEDBlue(unsigned int led)
unsigned char AuraSMBusController::GetLEDBlue(unsigned int led)
{
return(AuraRegisterRead(direct_reg + ( 3 * led ) + 1));
}
void AuraController::SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue)
void AuraSMBusController::SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char* colors = new unsigned char[led_count * 3];
@@ -188,7 +210,7 @@ void AuraController::SetAllColorsDirect(unsigned char red, unsigned char green,
delete colors;
}
void AuraController::SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
void AuraSMBusController::SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char* colors = new unsigned char[led_count * 3];
@@ -206,20 +228,20 @@ void AuraController::SetAllColorsEffect(unsigned char red, unsigned char green,
delete[] colors;
}
void AuraController::SetDirect(unsigned char direct)
void AuraSMBusController::SetDirect(unsigned char direct)
{
AuraRegisterWrite(AURA_REG_DIRECT, direct);
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
}
void AuraController::SetLEDColorDirect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
void AuraSMBusController::SetLEDColorDirect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char colors[3] = { red, blue, green };
AuraRegisterWriteBlock(direct_reg + ( 3 * led ), colors, 3);
}
void AuraController::SetLEDColorEffect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
void AuraSMBusController::SetLEDColorEffect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char colors[3] = { red, blue, green };
@@ -228,13 +250,13 @@ void AuraController::SetLEDColorEffect(unsigned int led, unsigned char red, unsi
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
}
void AuraController::SetMode(unsigned char mode)
void AuraSMBusController::SetMode(unsigned char mode)
{
AuraRegisterWrite(AURA_REG_MODE, mode);
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
}
void AuraController::AuraUpdateDeviceName()
void AuraSMBusController::AuraUpdateDeviceName()
{
for (int i = 0; i < 16; i++)
{
@@ -242,7 +264,7 @@ void AuraController::AuraUpdateDeviceName()
}
}
unsigned char AuraController::AuraRegisterRead(aura_register reg)
unsigned char AuraSMBusController::AuraRegisterRead(aura_register reg)
{
//Write Aura register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
@@ -252,7 +274,7 @@ unsigned char AuraController::AuraRegisterRead(aura_register reg)
}
void AuraController::AuraRegisterWrite(aura_register reg, unsigned char val)
void AuraSMBusController::AuraRegisterWrite(aura_register reg, unsigned char val)
{
//Write Aura register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
@@ -262,7 +284,7 @@ void AuraController::AuraRegisterWrite(aura_register reg, unsigned char val)
}
void AuraController::AuraRegisterWriteBlock(aura_register reg, unsigned char * data, unsigned char sz)
void AuraSMBusController::AuraRegisterWriteBlock(aura_register reg, unsigned char * data, unsigned char sz)
{
//Write Aura register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| AuraController.h |
| AuraSMBusController.h |
| |
| Definitions and types for ASUS Aura RGB |
| lighting controller |
@@ -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 */
@@ -88,11 +73,11 @@ enum
AURA_CONFIG_CHANNEL_V2 = 0x1B, /* LED Channel V2 configuration offset */
};
class AuraController
class AuraSMBusController
{
public:
AuraController(i2c_smbus_interface* bus, aura_dev_id dev);
~AuraController();
AuraSMBusController(i2c_smbus_interface* bus, aura_dev_id dev);
~AuraSMBusController();
std::string GetDeviceName();
std::string GetDeviceLocation();
@@ -1,31 +1,25 @@
#include "AuraController.h"
#include "Detector.h"
#include "AuraSMBusController.h"
#include "RGBController.h"
#include "RGBController_Aura.h"
#include "RGBController_AuraSMBus.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
using namespace std::chrono_literals;
/*----------------------------------------------------------------------*\
| This list contains the available SMBus addresses for mapping Aura RAM |
\*----------------------------------------------------------------------*/
#define AURA_RAM_ADDRESS_COUNT 21
#define AURA_RAM_ADDRESS_COUNT 23
static const unsigned char aura_ram_addresses[] =
{
0x70,
0x71,
0x72,
0x73,
0x74,
0x75,
@@ -42,6 +36,7 @@ static const unsigned char aura_ram_addresses[] =
0x66,
0x67,
0x39,
0x3A,
0x3B,
0x3C,
0x3D
@@ -50,23 +45,22 @@ static const unsigned char aura_ram_addresses[] =
/*---------------------------------------------------------------------------------*\
| This list contains the available SMBus addresses for mapping Aura motherboards |
\*---------------------------------------------------------------------------------*/
#define AURA_MOBO_ADDRESS_COUNT 4
#define AURA_MOBO_ADDRESS_COUNT 3
static const unsigned char aura_mobo_addresses[] =
{
0x40,
0x4E,
0x4F,
0x66
0x4F
};
/******************************************************************************************\
* *
* AuraRegisterWrite *
* *
* A standalone version of the AuraController::AuraRegisterWrite function for access *
* to Aura devices without instancing the AuraController class or reading the config *
* table from the device. *
* A standalone version of the AuraSMBusController::AuraRegisterWrite function for *
* access to Aura devices without instancing the AuraSMBusController class or reading *
* the config table from the device. *
* *
\******************************************************************************************/
@@ -81,7 +75,7 @@ void AuraRegisterWrite(i2c_smbus_interface* bus, aura_dev_id dev, aura_register
/******************************************************************************************\
* *
* TestForAuraController *
* TestForAuraSMBusController *
* *
* Tests the given address to see if an Aura controller exists there. First does a *
* quick write to test for a response, and if so does a simple read at 0xA0 to test *
@@ -89,7 +83,7 @@ void AuraRegisterWrite(i2c_smbus_interface* bus, aura_dev_id dev, aura_register
* *
\******************************************************************************************/
bool TestForAuraController(i2c_smbus_interface* bus, unsigned char address)
bool TestForAuraSMBusController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
@@ -112,11 +106,11 @@ bool TestForAuraController(i2c_smbus_interface* bus, unsigned char address)
return(pass);
} /* TestForAuraController() */
} /* TestForAuraSMBusController() */
/******************************************************************************************\
* *
* DetectAuraControllers *
* DetectAuraSMBusControllers *
* *
* Detect Aura controllers on the enumerated I2C busses. Searches for Aura-enabled *
* RAM at 0x77 and tries to initialize their slot addresses, then searches for them *
@@ -128,67 +122,79 @@ bool TestForAuraController(i2c_smbus_interface* bus, unsigned char address)
* *
\******************************************************************************************/
void DetectAuraControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
{
AuraController* new_aura;
RGBController_Aura* new_controller;
AuraSMBusController* new_aura;
RGBController_AuraSMBus* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
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
{
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
{
address_list_idx++;
res = busses[bus]->i2c_smbus_write_quick(aura_ram_addresses[address_list_idx], I2C_SMBUS_WRITE);
}
else
if (res < 0)
{
break;
}
} while (res >= 0);
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 (TestForAuraController(busses[bus], aura_ram_addresses[address_list_idx]))
{
new_aura = new AuraController(busses[bus], aura_ram_addresses[address_list_idx]);
new_controller = new RGBController_Aura(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));
}
}
Sleep(1);
// 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 (TestForAuraController(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 AuraController(busses[bus], aura_mobo_addresses[address_list_idx]);
new_controller = new RGBController_Aura(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);
}
Sleep(1);
std::this_thread::sleep_for(1ms);
}
}
}
} /* DetectAuraControllers() */
} /* DetectAuraSMBusControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAuraSMBusControllers);
@@ -1,15 +1,15 @@
/*-----------------------------------------*\
| RGBController_Aura.cpp |
| RGBController_AuraSMBus.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| Asus Aura driver |
| Asus Aura SMBus driver |
| |
| Adam Honse (CalcProgrammer1) 6/13/2019 |
\*-----------------------------------------*/
#include "RGBController_Aura.h"
#include "RGBController_AuraSMBus.h"
int RGBController_Aura::GetDeviceMode()
int RGBController_AuraSMBus::GetDeviceMode()
{
int dev_mode = aura->AuraRegisterRead(AURA_REG_MODE);
int color_mode = MODE_COLORS_PER_LED;
@@ -44,7 +44,7 @@ int RGBController_Aura::GetDeviceMode()
break;
}
for(int mode = 0; mode < modes.size(); mode++)
for(std::size_t mode = 0; mode < modes.size(); mode++)
{
if(modes[mode].value == dev_mode)
{
@@ -56,7 +56,7 @@ int RGBController_Aura::GetDeviceMode()
return(active_mode);
}
void RGBController_Aura::UpdateLEDs()
void RGBController_AuraSMBus::DeviceUpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
{
@@ -75,31 +75,28 @@ void RGBController_Aura::UpdateLEDs()
}
}
void RGBController_Aura::UpdateZoneLEDs(int zone)
void RGBController_AuraSMBus::UpdateZoneLEDs(int zone)
{
for (std::size_t x = 0; x < zones[zone].map.size(); x++)
for (std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++)
{
for (std::size_t y = 0; y < zones[zone].map[x].size(); y++)
{
int led = zones[zone].map[x][y];
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
int led = zones[zone].leds[led_idx].value;
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if (GetMode() == 0)
{
aura->SetLEDColorDirect(led, red, grn, blu);
}
else
{
aura->SetLEDColorEffect(led, red, grn, blu);
}
if (GetMode() == 0)
{
aura->SetLEDColorDirect(led, red, grn, blu);
}
else
{
aura->SetLEDColorEffect(led, red, grn, blu);
}
}
}
void RGBController_Aura::UpdateSingleLED(int led)
void RGBController_AuraSMBus::UpdateSingleLED(int led)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
@@ -116,10 +113,8 @@ void RGBController_Aura::UpdateSingleLED(int led)
}
}
RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
RGBController_AuraSMBus::RGBController_AuraSMBus(AuraSMBusController * aura_ptr)
{
std::vector<unsigned char> aura_channels;
aura = aura_ptr;
version = aura->GetDeviceName();
@@ -134,6 +129,7 @@ RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
type = DEVICE_TYPE_MOTHERBOARD;
name = "ASUS Aura Motherboard";
}
description = "ASUS Aura SMBus Device";
mode Direct;
Direct.name = "Direct";
@@ -205,82 +201,141 @@ RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
RandomFlicker.color_mode = MODE_COLORS_NONE;
modes.push_back(RandomFlicker);
colors.resize(aura->GetLEDCount());
for (std::size_t i = 0; i < aura->GetLEDCount(); i++)
{
aura_channels.push_back(aura->GetChannel(i));
led* new_led = new led();
new_led->name = aura->GetChannelName(i);
new_led->name.append(std::to_string(i));
leds.push_back(*new_led);
unsigned char red = aura->GetLEDRed(i);
unsigned char grn = aura->GetLEDGreen(i);
unsigned char blu = aura->GetLEDBlue(i);
colors[i] = ToRGBColor(red, grn, blu);
}
std::vector<unsigned char> aura_zones;
// Search through all LEDs and create zones for each channel type
for (std::size_t i = 0; i < aura_channels.size(); i++)
{
bool matched = false;
// Search through existing zones to make sure we don't create a duplicate zone
for (std::size_t j = 0; j < aura_zones.size(); j++)
{
if (aura_channels[i] == aura_zones[j])
{
matched = true;
}
}
// If zone does not already exist, create it
if (matched == false)
{
zone* new_zone = new zone();
std::vector<int>* zone_row = new std::vector<int>();
// Set zone name to channel name
new_zone->name = aura->GetChannelName(i);
// Find all LEDs with this channel type and add them to zone
for (std::size_t j = 0; j < aura->GetLEDCount(); j++)
{
if (aura->GetChannel(j) == aura_channels[i])
{
zone_row->push_back(j);
}
}
// Aura devices can be either single or linear, never matrix
// That means only one row is needed
new_zone->map.push_back(*zone_row);
// Save channel to aura_zones so we know not to create another zone with this channel
aura_zones.push_back(aura_channels[i]);
// Push new zone to zones vector
zones.push_back(*new_zone);
}
}
SetupZones();
// Initialize active mode
active_mode = GetDeviceMode();
}
void RGBController_Aura::SetCustomMode()
RGBController_AuraSMBus::~RGBController_AuraSMBus()
{
delete aura;
}
void RGBController_AuraSMBus::SetupZones()
{
std::vector<int> aura_led_map;
/*---------------------------------------------------------*\
| Search through all LEDs and create zones for each channel |
| type |
\*---------------------------------------------------------*/
for (std::size_t led_idx = 0; led_idx < aura->GetLEDCount(); led_idx++)
{
bool matched = false;
/*---------------------------------------------------------*\
| Search through existing zones to make sure we don't |
| create a duplicate zone |
\*---------------------------------------------------------*/
for (std::size_t existing_zone_idx = 0; existing_zone_idx < zones.size(); existing_zone_idx++)
{
if (aura->GetChannelName(led_idx) == zones[existing_zone_idx].name)
{
matched = true;
}
}
/*---------------------------------------------------------*\
| If zone does not already exist, create it |
\*---------------------------------------------------------*/
if (matched == false)
{
zone* new_zone = new zone();
/*---------------------------------------------------------*\
| Set zone name to channel name |
\*---------------------------------------------------------*/
new_zone->name = aura->GetChannelName(led_idx);
new_zone->leds_count = 0;
/*---------------------------------------------------------*\
| Find all LEDs with this channel type and add them to zone |
\*---------------------------------------------------------*/
for (std::size_t zone_led_idx = 0; zone_led_idx < aura->GetLEDCount(); zone_led_idx++)
{
if (aura->GetChannelName(zone_led_idx) == new_zone->name)
{
new_zone->leds_count++;
aura_led_map.push_back(zone_led_idx);
}
}
/*---------------------------------------------------------*\
| Aura zones have fixed size, so set min and max to count |
\*---------------------------------------------------------*/
new_zone->leds_min = new_zone->leds_count;
new_zone->leds_max = new_zone->leds_count;
/*---------------------------------------------------------*\
| If this zone has more than one LED, mark it as linear type|
\*---------------------------------------------------------*/
if(new_zone->leds_count > 1)
{
new_zone->type = ZONE_TYPE_LINEAR;
}
else
{
new_zone->type = ZONE_TYPE_SINGLE;
}
new_zone->matrix_map = NULL;
/*---------------------------------------------------------*\
| Push new zone to zones vector |
\*---------------------------------------------------------*/
zones.push_back(*new_zone);
}
}
/*---------------------------------------------------------*\
| Create LED entries for each zone |
\*---------------------------------------------------------*/
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();
new_led->name = zones[zone_idx].name + " LED ";
new_led->name.append(std::to_string(led_idx + 1));
new_led->value = aura_led_map[led_idx];
leds.push_back(*new_led);
}
}
SetupColors();
/*---------------------------------------------------------*\
| Initialize colors for each LED |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
unsigned int led = leds[led_idx].value;
unsigned char red = aura->GetLEDRed(led);
unsigned char grn = aura->GetLEDGreen(led);
unsigned char blu = aura->GetLEDBlue(led);
colors[led_idx] = ToRGBColor(red, grn, blu);
}
}
void RGBController_AuraSMBus::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AuraSMBus::SetCustomMode()
{
active_mode = 0;
}
void RGBController_Aura::UpdateMode()
void RGBController_AuraSMBus::DeviceUpdateMode()
{
if (modes[active_mode].value == 0xFFFF)
{
@@ -1,8 +1,8 @@
/*-----------------------------------------*\
| RGBController_Aura.h |
| RGBController_AuraSMBus.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| Asus Aura driver |
| Asus Aura SMBus driver |
| |
| Adam Honse (CalcProgrammer1) 6/13/2019 |
\*-----------------------------------------*/
@@ -10,21 +10,27 @@
#pragma once
#include "RGBController.h"
#include "AuraController.h"
#include "AuraSMBusController.h"
class RGBController_Aura : public RGBController
class RGBController_AuraSMBus : public RGBController
{
public:
RGBController_Aura(AuraController* aura_ptr);
void UpdateLEDs();
RGBController_AuraSMBus(AuraSMBusController* aura_ptr);
~RGBController_AuraSMBus();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
void DeviceUpdateMode();
private:
AuraController* aura;
AuraSMBusController* aura;
int GetDeviceMode();
};
@@ -0,0 +1,144 @@
/*-----------------------------------------*\
| AuraAddressableController.cpp |
| |
| Driver for ASUS Aura RGB Addressable |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/18/2020 |
\*-----------------------------------------*/
#include "AuraAddressableController.h"
#include <cstring>
AuraAddressableController::AuraAddressableController(hid_device* dev_handle, const char* path) : AuraUSBController(dev_handle, path)
{
/*-----------------------------------------------------*\
| Add addressable devices |
\*-----------------------------------------------------*/
for(int i = 0; i < config_table[0x02]; ++i)
{
device_info.push_back({0x01, (unsigned char)i, 0x01, AuraDeviceType::ADDRESSABLE});
}
}
AuraAddressableController::~AuraAddressableController()
{
}
void AuraAddressableController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
{
unsigned char led_data[60];
unsigned int leds_sent = 0;
while(leds_sent < num_colors)
{
unsigned int leds_to_send = 20;
if((num_colors - leds_sent) < leds_to_send)
{
leds_to_send = num_colors - leds_sent;
}
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]);
led_data[(led_idx * 3) + 2] = RGBGetBValue(colors[led_idx + leds_sent]);
}
SendDirect
(
channel,
leds_sent,
leds_to_send,
led_data
);
leds_sent += leds_to_send;
}
SendDirectApply(channel);
}
void AuraAddressableController::SetMode
(
unsigned char channel,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
)
{
SendEffect
(
channel,
mode,
red,
grn,
blu
);
}
void AuraAddressableController::SendEffect
(
unsigned char channel,
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] = 0xEC;
usb_buf[0x01] = AURA_ADDRESSABLE_CONTROL_MODE_EFFECT;
usb_buf[0x02] = channel;
usb_buf[0x03] = 0x00;
usb_buf[0x04] = mode;
/*-----------------------------------------------------*\
| Copy in color data bytes |
\*-----------------------------------------------------*/
usb_buf[0x05] = red;
usb_buf[0x06] = grn;
usb_buf[0x07] = blu;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
void AuraAddressableController::SendDirectApply
(
unsigned char channel
)
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_CONTROL_MODE_DIRECT;
usb_buf[0x02] = 0x80 | channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
@@ -0,0 +1,60 @@
/*-----------------------------------------*\
| AuraAddressableController.h |
| |
| Definitions and types for ASUS Aura |
| Addressable RGB lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/18/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include "AuraUSBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AURA_ADDRESSABLE_CONTROL_MODE_EFFECT = 0x3B, /* Effect control mode */
};
class AuraAddressableController : public AuraUSBController
{
public:
AuraAddressableController(hid_device* dev_handle, const char* path);
~AuraAddressableController();
void SetChannelLEDs
(
unsigned char channel,
RGBColor * colors,
unsigned int num_colors
);
void SetMode
(
unsigned char channel,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
);
private:
void SendEffect
(
unsigned char channel,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
);
void SendDirectApply
(
unsigned char channel
);
};
@@ -0,0 +1,199 @@
/*-----------------------------------------*\
| AuraMainboardController.cpp |
| |
| Driver for ASUS Aura RGB USB mainboard |
| lighting controller |
| |
| Martin Hartl (inlart) 4/25/2020 |
\*-----------------------------------------*/
#include "AuraMainboardController.h"
#include <cstring>
AuraMainboardController::AuraMainboardController(hid_device* dev_handle, const char* path) : AuraUSBController(dev_handle, path), mode(AURA_MODE_DIRECT)
{
/*-----------------------------------------------------*\
| Add mainboard device |
\*-----------------------------------------------------*/
device_info.push_back({0x00, 0x04, config_table[0x1B], AuraDeviceType::FIXED});
/*-----------------------------------------------------*\
| Add addressable devices |
\*-----------------------------------------------------*/
for(int i = 0; i < config_table[0x02]; ++i)
{
device_info.push_back({0x01, (unsigned char)i, 0x01, AuraDeviceType::ADDRESSABLE});
}
}
AuraMainboardController::~AuraMainboardController()
{
}
void AuraMainboardController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
{
unsigned char led_data[60];
unsigned int leds_sent = 0;
while(leds_sent < num_colors)
{
unsigned int leds_to_send = 20;
if((num_colors - leds_sent) < leds_to_send)
{
leds_to_send = num_colors - leds_sent;
}
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]);
led_data[(led_idx * 3) + 2] = RGBGetBValue(colors[led_idx + leds_sent]);
}
SendDirect
(
device_info[channel].direct_channel,
leds_sent,
leds_to_send,
led_data,
leds_sent + leds_to_send >= num_colors
);
leds_sent += leds_to_send;
}
SendCommit();
}
void AuraMainboardController::SetMode
(
unsigned char channel,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
)
{
this->mode = mode;
RGBColor color = ToRGBColor(red, grn, blu);
SendEffect(device_info[channel].effect_channel, mode);
if(mode == AURA_MODE_DIRECT)
{
return;
}
unsigned char led_data[60];
unsigned char start_led = 0;
for(std::size_t i = 0; i < channel; ++i)
{
start_led += device_info[i].num_leds;
}
for(std::size_t led_idx = 0; led_idx < device_info[channel].num_leds; led_idx++)
{
led_data[(led_idx * 3) + 0] = RGBGetRValue(color);
led_data[(led_idx * 3) + 1] = RGBGetGValue(color);
led_data[(led_idx * 3) + 2] = RGBGetBValue(color);
}
SendColor
(
channel,
start_led,
device_info[channel].num_leds,
led_data,
device_info[channel].device_type == AuraDeviceType::FIXED
);
SendCommit();
}
void AuraMainboardController::SendEffect
(
unsigned char channel,
unsigned char mode
)
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_MAINBOARD_CONTROL_MODE_EFFECT;
usb_buf[0x02] = channel;
usb_buf[0x03] = 0x00;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = mode;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
void AuraMainboardController::SendColor
(
unsigned char channel,
unsigned char start_led,
unsigned char led_count,
unsigned char* led_data,
bool fixed
)
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_MAINBOARD_CONTROL_MODE_EFFECT_COLOR;
usb_buf[0x02] = channel;
usb_buf[0x03] = fixed ? 0xFF : 0x00;
usb_buf[0x04] = 0x00;
/*-----------------------------------------------------*\
| Copy in color data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x05 + 3 * start_led], led_data, led_count * 3);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
void AuraMainboardController::SendCommit()
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_MAINBOARD_CONTROL_MODE_COMMIT;
usb_buf[0x02] = 0x55;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
@@ -0,0 +1,66 @@
/*-----------------------------------------*\
| AuraMainboardController.h |
| |
| Definitions and types for ASUS Aura |
| USB Mainboard RGB lighting controller |
| |
| Martin Hartl (inlart) 4/25/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include "AuraUSBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AURA_MAINBOARD_CONTROL_MODE_EFFECT = 0x35, /* Effect control mode */
AURA_MAINBOARD_CONTROL_MODE_EFFECT_COLOR = 0x36, /* Effect color control mode */
AURA_MAINBOARD_CONTROL_MODE_COMMIT = 0x3F, /* Commit mode */
};
class AuraMainboardController : public AuraUSBController
{
public:
AuraMainboardController(hid_device* dev_handle, const char* path);
~AuraMainboardController();
void SetChannelLEDs
(
unsigned char channel,
RGBColor * colors,
unsigned int num_colors
);
void SetMode
(
unsigned char channel,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
);
private:
unsigned int mode;
void SendEffect
(
unsigned char channel,
unsigned char mode
);
void SendColor
(
unsigned char channel,
unsigned char start_led,
unsigned char led_count,
unsigned char* led_data,
bool fixed
);
void SendCommit();
};
@@ -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;
};
@@ -0,0 +1,161 @@
/*-----------------------------------------*\
| AuraUSBController.cpp |
| |
| Driver for ASUS Aura RGB USB |
| lighting controller |
| |
| Martin Hartl (inlart) 4/25/2020 |
\*-----------------------------------------*/
#include "AuraUSBController.h"
#include <cstring>
#include <stdexcept>
AuraUSBController::AuraUSBController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
GetFirmwareVersion();
GetConfigTable();
}
AuraUSBController::~AuraUSBController()
{
}
unsigned int AuraUSBController::GetChannelCount()
{
return(device_info.size());
}
std::string AuraUSBController::GetDeviceLocation()
{
return(location);
}
std::string AuraUSBController::GetDeviceName()
{
return(device_name);
}
const std::vector<AuraDeviceInfo>& AuraUSBController::GetAuraDevices() const
{
return(device_info);
}
void AuraUSBController::GetConfigTable()
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_REQUEST_CONFIG_TABLE;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 65);
/*-----------------------------------------------------*\
| Copy the firmware string if the reply ID is correct |
\*-----------------------------------------------------*/
if(usb_buf[1] == 0x30)
{
memcpy(config_table, &usb_buf[4], 60);
for(int i = 0; i < 60; i+=6)
{
printf("%02X %02X %02X %02X %02X %02X\r\n", config_table[i + 0],
config_table[i + 1],
config_table[i + 2],
config_table[i + 3],
config_table[i + 4],
config_table[i + 5]);
}
}
else
{
if(dev)
{
hid_close(dev);
}
throw std::runtime_error("Could not read config table");
}
}
void AuraUSBController::GetFirmwareVersion()
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up firmware version request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_REQUEST_FIRMWARE_VERSION;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 65);
/*-----------------------------------------------------*\
| Copy the firmware string if the reply ID is correct |
\*-----------------------------------------------------*/
if(usb_buf[1] == 0x02)
{
memcpy(device_name, &usb_buf[2], 16);
}
}
void AuraUSBController::SendDirect
(
unsigned char device,
unsigned char start_led,
unsigned char led_count,
unsigned char* led_data,
bool apply /* = false */
)
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_CONTROL_MODE_DIRECT;
usb_buf[0x02] = apply ? 0x80 : 0x00;
usb_buf[0x02] |= device;
usb_buf[0x03] = start_led;
usb_buf[0x04] = led_count;
/*-----------------------------------------------------*\
| Copy in color data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x05], led_data, led_count * 3);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
@@ -0,0 +1,109 @@
/*-----------------------------------------*\
| AuraUSBController.h |
| |
| Definitions and types for ASUS Aura |
| USB RGB lighting controller |
| |
| Martin Hartl (inlart) 4/25/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <vector>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AURA_MODE_OFF = 0, /* OFF mode */
AURA_MODE_STATIC = 1, /* Static color mode */
AURA_MODE_BREATHING = 2, /* Breathing effect mode */
AURA_MODE_FLASHING = 3, /* Flashing effect mode */
AURA_MODE_SPECTRUM_CYCLE = 4, /* Spectrum Cycle mode */
AURA_MODE_RAINBOW = 5, /* Rainbow effect mode */
AURA_MODE_SPECTRUM_CYCLE_BREATHING = 6, /* Rainbow Breathing effect mode */
AURA_MODE_CHASE_FADE = 7, /* Chase with Fade effect mode */
AURA_MODE_SPECTRUM_CYCLE_CHASE_FADE = 8, /* Chase with Fade, Rainbow effect mode */
AURA_MODE_CHASE = 9, /* Chase effect mode */
AURA_MODE_SPECTRUM_CYCLE_CHASE = 10, /* Chase with Rainbow effect mode */
AURA_MODE_SPECTRUM_CYCLE_WAVE = 11, /* Wave effect mode */
AURA_MODE_CHASE_RAINBOW_PULSE = 12, /* Chase with Rainbow Pulse effect mode*/
AURA_MODE_RANDOM_FLICKER = 13, /* Random flicker effect mode */
AURA_MODE_MUSIC = 14, /* Music effect mode */
AURA_MODE_DIRECT = 0xFF, /* Direct control mode */
};
enum
{
AURA_REQUEST_FIRMWARE_VERSION = 0x82, /* Request firmware string */
AURA_REQUEST_CONFIG_TABLE = 0xB0, /* Request configuration table */
AURA_CONTROL_MODE_DIRECT = 0x40, /* Direct control mode */
};
enum class AuraDeviceType
{
FIXED,
ADDRESSABLE,
};
struct AuraDeviceInfo
{
unsigned char effect_channel;
unsigned char direct_channel;
unsigned char num_leds;
AuraDeviceType device_type;
};
class AuraUSBController
{
public:
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;
virtual void SetChannelLEDs
(
unsigned char channel,
RGBColor * colors,
unsigned int num_colors
) = 0;
virtual void SetMode
(
unsigned char channel,
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu
) = 0;
protected:
hid_device* dev;
unsigned char config_table[60];
std::vector<AuraDeviceInfo> device_info;
std::string location;
void SendDirect
(
unsigned char device,
unsigned char start_led,
unsigned char led_count,
unsigned char* led_data,
bool apply = false
);
private:
char device_name[16];
unsigned int led_count;
void GetConfigTable();
void GetFirmwareVersion();
};
@@ -0,0 +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_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
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned short usb_interface;
const char * name;
} aura_device;
#define ADDRESSABLE_NUM_DEVICES (sizeof(addressable_device_list) / sizeof(addressable_device_list[ 0 ]))
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_info* info = NULL;
hid_init();
/*ASUS AURA Addressable*/
for(unsigned int pid_idx = 0; pid_idx < ADDRESSABLE_NUM_DEVICES; pid_idx++)
{
info = hid_enumerate(addressable_device_list[pid_idx].usb_vid, addressable_device_list[pid_idx].usb_pid);
while(info)
{
hid_device* dev = NULL;
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);
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;
}
}
info = NULL;
/*ASUS AURA Motherboard*/
for(unsigned int pid_idx = 0; pid_idx < MOTHERBOARD_NUM_DEVICES; pid_idx++)
{
info = hid_enumerate(motherboard_device_list[pid_idx].usb_vid, motherboard_device_list[pid_idx].usb_pid);
while(info)
{
hid_device* dev = NULL;
if((info->vendor_id == motherboard_device_list[pid_idx].usb_vid)
&&(info->product_id == motherboard_device_list[pid_idx].usb_pid))
{
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;
};
@@ -0,0 +1,237 @@
/*-----------------------------------------*\
| RGBController_AuraUSB.cpp |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Adam Honse (CalcProgrammer1) 1/18/2020 |
\*-----------------------------------------*/
#include "RGBController_AuraUSB.h"
RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr)
{
aura = aura_ptr;
name = "ASUS Aura USB";
version = aura->GetDeviceName();
type = DEVICE_TYPE_MOTHERBOARD;
description = "ASUS Aura USB Device";
location = aura->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = AURA_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = AURA_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = AURA_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AURA_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Flashing.colors_min = 1;
Flashing.colors_max = 1;
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Flashing.colors.resize(1);
modes.push_back(Flashing);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = AURA_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = 0;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = AURA_MODE_RAINBOW;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode ChaseFade;
ChaseFade.name = "Chase Fade";
ChaseFade.value = AURA_MODE_CHASE_FADE;
ChaseFade.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
ChaseFade.colors_min = 1;
ChaseFade.colors_max = 1;
ChaseFade.color_mode = MODE_COLORS_MODE_SPECIFIC;
ChaseFade.colors.resize(1);
modes.push_back(ChaseFade);
mode Chase;
Chase.name = "Chase";
Chase.value = AURA_MODE_CHASE;
Chase.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Chase.colors_min = 1;
Chase.colors_max = 1;
Chase.color_mode = MODE_COLORS_MODE_SPECIFIC;
Chase.colors.resize(1);
modes.push_back(Chase);
SetupZones();
}
RGBController_AuraUSB::~RGBController_AuraUSB()
{
}
void RGBController_AuraUSB::SetupZones()
{
/*-------------------------------------------------*\
| Only set LED count on the first run |
\*-------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(aura->GetChannelCount());
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
int addressableCounter = 1;
for (unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
{
AuraDeviceInfo device_info = aura->GetAuraDevices()[channel_idx];
zones[channel_idx].type = ZONE_TYPE_LINEAR;
if(device_info.device_type == AuraDeviceType::FIXED)
{
zones[channel_idx].name = "Aura Mainboard";
zones[channel_idx].leds_min = device_info.num_leds;
zones[channel_idx].leds_max = device_info.num_leds;
zones[channel_idx].leds_count = device_info.num_leds;
}
else
{
zones[channel_idx].name = "Aura Addressable ";
zones[channel_idx].name.append(std::to_string(addressableCounter));
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
addressableCounter++;
if(first_run)
{
zones[channel_idx].leds_count = 0;
}
}
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
led new_led;
new_led.name = zones[channel_idx].name;
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_ch_idx + 1));
new_led.value = channel_idx;
leds.push_back(new_led);
}
zones[channel_idx].matrix_map = NULL;
}
SetupColors();
}
void RGBController_AuraUSB::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_AuraUSB::DeviceUpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
aura->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
}
}
void RGBController_AuraUSB::UpdateZoneLEDs(int zone)
{
aura->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
}
void RGBController_AuraUSB::UpdateSingleLED(int led)
{
unsigned int channel = leds[led].value;
aura->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
}
void RGBController_AuraUSB::SetCustomMode()
{
}
void RGBController_AuraUSB::DeviceUpdateMode()
{
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
red = RGBGetRValue(modes[active_mode].colors[0]);
grn = RGBGetGValue(modes[active_mode].colors[0]);
blu = RGBGetBValue(modes[active_mode].colors[0]);
}
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
if(zones[zone_idx].leds_count > 0)
{
aura->SetMode(zone_idx, modes[active_mode].value, red, grn, blu);
}
}
}
@@ -0,0 +1,37 @@
/*-----------------------------------------*\
| RGBController_AuraUSB.h |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Adam Honse (CalcProgrammer1) 1/18/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AuraUSBController.h"
#define AURA_ADDRESSABLE_MAX_LEDS 120
class RGBController_AuraUSB : public RGBController
{
public:
RGBController_AuraUSB(AuraUSBController* aura_ptr);
~RGBController_AuraUSB();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AuraUSBController* aura;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> zones_channel;
};
@@ -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();
};
@@ -0,0 +1,167 @@
/*-------------------------------------------------------------------*\
| CMMP750Controller.cpp |
| |
| Driver for Coolermaster MP750 mousepad |
| |
| Chris M (Dr_No) 16th Apr 2020 |
| |
\*-------------------------------------------------------------------*/
#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)
{
std::size_t tmp_size = wcslen(_vendor);
dev = dev_handle;
location = _path;
for(std::size_t i = 0; (i < tmp_size) && (i < CM_DEVICE_NAME_SIZE); i++)
{
device_name[i] = (char)_vendor[i];
}
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
}
CMMP750Controller::~CMMP750Controller()
{
hid_close(dev);
}
void CMMP750Controller::GetStatus()
{
unsigned char buffer[0x40] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
buffer[0] = 0x07;
hid_write(dev, buffer, buffer_size);
hid_read(dev, buffer, buffer_size);
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++)
{
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_red = 0xFF;
current_green = 0xFF;
current_blue = 0xFF;
current_speed = MP750_SPEED_NORMAL;
}
}
char* CMMP750Controller::GetDeviceName()
{
return device_name;
}
char* CMMP750Controller::GetSerial()
{
return serial;
}
std::string CMMP750Controller::GetLocation()
{
return location;
}
unsigned char CMMP750Controller::GetMode()
{
return current_mode;
}
unsigned char CMMP750Controller::GetLedRed()
{
return current_red;
}
unsigned char CMMP750Controller::GetLedGreen()
{
return current_green;
}
unsigned char CMMP750Controller::GetLedBlue()
{
return current_blue;
}
unsigned char CMMP750Controller::GetLedSpeed()
{
return current_speed;
}
void CMMP750Controller::SetMode(unsigned char mode, unsigned char speed)
{
current_mode = mode;
current_speed = speed;
SendUpdate();
}
void CMMP750Controller::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
current_red = red;
current_green = green;
current_blue = blue;
SendUpdate();
}
void CMMP750Controller::SendUpdate()
{
unsigned char buffer[0x40] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
for(std::size_t i = 0; i < CM_COLOUR_MODE_DATA_SIZE; i++)
{
buffer[i] = colour_mode_data[current_mode][i];
}
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];
}
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];
}
hid_write(dev, buffer, buffer_size);
}
@@ -0,0 +1,93 @@
/*-------------------------------------------------------------------*\
| CMMP750Controller.h |
| |
| Driver for Coolermaster MP750 mousepad |
| |
| Chris M (Dr_No) 16th Apr 2020 |
| |
| Simple RGB device with 5 modes |
| BYTE0 = Mode (0x01 thru 0x05 |
| BYTE1 = ?? Must be set to 0x04 for colour modes otherwise ignored |
| BYTE2 = Colour Modes: RED else Cycle SPEED |
| BYTE3 = Colour Modes: GREEN else ignored |
| BYTE4 = Colour Modes: BLUE else ignored |
| BYTE5 = Colour Modes: SPEED else ignored |
\*-------------------------------------------------------------------*/
#include <string>
#include <array>
#include <hidapi/hidapi.h>
#pragma once
#define CM_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
#define CM_INTERRUPT_TIMEOUT 250
#define CM_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define CM_SERIAL_SIZE (sizeof(serial) / sizeof(serial[ 0 ]))
#define HID_MAX_STR 255
enum
{
CM_MODE_BYTE = 0,
CM_RED_BYTE = 2,
CM_GREEN_BYTE = 3,
CM_BLUE_BYTE = 4,
CM_SPEED_BYTE = 5
};
enum
{
MP750_MODE_STATIC = 0x00, //Static Mode
MP750_MODE_BLINK = 0x01, //Blinking Mode
MP750_MODE_BREATHING = 0x02, //Breathing Mode
MP750_MODE_COLOR_CYCLE = 0x03, //Color Cycle Mode
MP750_MODE_BREATH_CYCLE = 0x04 //Breathing Cycle Mode
};
enum
{
MP750_SPEED_SLOWEST = 0x00, /* Slowest speed */
MP750_SPEED_SLOWER = 0x01, /* Slower speed */
MP750_SPEED_SLOW = 0x02, /* Slow speed */
MP750_SPEED_SLOWISH = 0x03, /* Slowish speed */
MP750_SPEED_NORMAL = 0x04, /* Normal speed */
MP750_SPEED_FASTISH = 0x05, /* Fastish speed */
MP750_SPEED_FAST = 0x06, /* Fast speed */
MP750_SPEED_FASTER = 0x07, /* Faster speed */
MP750_SPEED_FASTEST = 0x08, /* Fastest speed */
};
class CMMP750Controller
{
public:
CMMP750Controller(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path);
~CMMP750Controller();
char* GetDeviceName();
char* GetSerial();
std::string GetLocation();
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);
private:
char device_name[32];
char serial[32];
std::string location;
hid_device* dev;
unsigned char current_mode;
unsigned char current_speed;
unsigned char current_red;
unsigned char current_green;
unsigned char current_blue;
void GetStatus();
void SendUpdate();
};
@@ -0,0 +1,97 @@
#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 ]))
struct coolermaster_device
{
unsigned int product_id;
unsigned short interface;
unsigned int usage_page;
unsigned int usage;
device_type type;
};
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
};
/******************************************************************************************\
* *
* DetectCoolerMasterControllers *
* *
* Tests the USB address to see if any CoolerMaster controllers exists there. *
* *
\******************************************************************************************/
void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
//Look for the passed in cm_pids
hid_init();
info = hid_enumerate(COOLERMASTER_VID, 0x0);
while(info)
{
hid_device* dev = NULL;
device_type dev_type;
if(info->vendor_id == COOLERMASTER_VID)
{
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].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_type = cm_pids[cm_pid_idx].type;
break;
}
}
}
if(dev)
{
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,167 @@
/*-------------------------------------------------------------------*\
| RGBController_CMMP750Controller.cpp |
| |
| Driver for Coolermaster MP750 mousepad |
| |
| Chris M (Dr_No) 18th Apr 2020 |
| |
\*-------------------------------------------------------------------*/
#include "RGBController_CMMP750Controller.h"
RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controller* cmmp_ptr)
{
cmmp750 = cmmp_ptr;
unsigned char speed = cmmp750->GetLedSpeed();
name = cmmp750->GetDeviceName();
type = DEVICE_TYPE_MOUSEMAT;
description = cmmp750->GetDeviceName();
version = "1.0";
serial = "";
location = cmmp750->GetLocation();
mode Static;
Static.name = "Static";
Static.value = MP750_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Blink;
Blink.name = "Blink";
Blink.value = MP750_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Blink.speed_min = MP750_SPEED_SLOWEST;
Blink.speed_max = MP750_SPEED_FASTEST;
Blink.color_mode = MODE_COLORS_PER_LED;
Blink.speed = speed;
modes.push_back(Blink);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = MP750_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.speed_min = MP750_SPEED_SLOWEST;
Breathing.speed_max = MP750_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed = speed;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Color Cycle";
ColorCycle.value = MP750_MODE_COLOR_CYCLE;
ColorCycle.flags = MODE_FLAG_HAS_SPEED;
ColorCycle.speed_min = MP750_SPEED_SLOWEST;
ColorCycle.speed_max = MP750_SPEED_FASTEST;
ColorCycle.color_mode = MODE_COLORS_NONE;
ColorCycle.speed = speed;
modes.push_back(ColorCycle);
mode BreathCycle;
BreathCycle.name = "Breath Cycle";
BreathCycle.value = MP750_MODE_BREATH_CYCLE;
BreathCycle.flags = MODE_FLAG_HAS_SPEED;
BreathCycle.speed_min = MP750_SPEED_SLOWEST;
BreathCycle.speed_max = MP750_SPEED_FASTEST;
BreathCycle.color_mode = MODE_COLORS_NONE;
BreathCycle.speed = speed;
modes.push_back(BreathCycle);
SetupZones();
active_mode = cmmp750->GetMode();
}
RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
{
}
void RGBController_CMMP750Controller::SetupZones()
{
zone MP_zone;
MP_zone.name = "Mousepad";
MP_zone.type = ZONE_TYPE_SINGLE;
MP_zone.leds_min = 1;
MP_zone.leds_max = 1;
MP_zone.leds_count = 1;
MP_zone.matrix_map = NULL;
zones.push_back(MP_zone);
led MP_led;
MP_led.name = "Mousepad LED";
leds.push_back(MP_led);
SetupColors();
/*---------------------------------------------------------*\
| Initialize colors for each LED |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
unsigned char red = cmmp750->GetLedRed();
unsigned char grn = cmmp750->GetLedGreen();
unsigned char blu = cmmp750->GetLedBlue();
colors[led_idx] = ToRGBColor(red, grn, blu);
}
}
void RGBController_CMMP750Controller::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CMMP750Controller::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
cmmp750->SetColor(red, grn, blu);
}
void RGBController_CMMP750Controller::UpdateZoneLEDs(int zone)
{
RGBColor color = colors[zone];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
cmmp750->SetColor(red, grn, blu);
}
void RGBController_CMMP750Controller::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_CMMP750Controller::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CMMP750Controller::DeviceUpdateMode()
{
switch(modes[active_mode].value)
{
case MP750_MODE_STATIC:
cmmp750->SetMode(MP750_MODE_STATIC, modes[active_mode].speed);
break;
case MP750_MODE_BLINK:
cmmp750->SetMode(MP750_MODE_BLINK, modes[active_mode].speed);
break;
case MP750_MODE_BREATHING:
cmmp750->SetMode(MP750_MODE_BREATHING, modes[active_mode].speed);
break;
case MP750_MODE_COLOR_CYCLE:
cmmp750->SetMode(MP750_MODE_COLOR_CYCLE, modes[active_mode].speed);
break;
case MP750_MODE_BREATH_CYCLE:
cmmp750->SetMode(MP750_MODE_BREATH_CYCLE, modes[active_mode].speed);
break;
default:
cmmp750->SetMode(MP750_MODE_BREATHING, modes[active_mode].speed);
break;
}
}
@@ -0,0 +1,33 @@
/*-------------------------------------------------------------------*\
| RGBController_CMMP750Controller.h |
| |
| Driver for Coolermaster MP750 mousepad |
| |
| Chris M (Dr_No) 18th Apr 2020 |
| |
\*-------------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CMMP750Controller.h"
class RGBController_CMMP750Controller : public RGBController
{
public:
RGBController_CMMP750Controller(CMMP750Controller* cmmp_ptr);
~RGBController_CMMP750Controller();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
CMMP750Controller* cmmp750;
int GetDeviceMode();
};
@@ -1,507 +0,0 @@
/*---------------------------------------------------------*\
| Processing Code for Corsair Commander Pro |
| |
| Adam Honse ([email protected]), 1/16/2020 |
\*---------------------------------------------------------*/
#include "CorsairCmdrProController.h"
#include <fstream>
#include <iostream>
#include <string>
#include <cstring>
//Include thread libraries for Windows or Linux
#ifdef WIN32
#include <process.h>
#else
#include "pthread.h"
#include "unistd.h"
#endif
//Thread functions have different types in Windows and Linux
#ifdef WIN32
#define THREAD static void
#define THREADRETURN
#else
#define THREAD static void*
#define THREADRETURN return(NULL);
#endif
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
THREAD keepalive_thread(void *param)
{
CorsairCmdrProController* corsair = static_cast<CorsairCmdrProController*>(param);
corsair->KeepaliveThread();
THREADRETURN
}
CorsairCmdrProController::CorsairCmdrProController(libusb_device_handle* dev_handle)
{
dev = dev_handle;
channel_leds[0] = 60;
channel_leds[1] = 60;
/*-----------------------------------------------------*\
| The Corsair Lighting Node Pro requires a packet within|
| 20 seconds of sending the lighting change in order |
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 5s |
\*-----------------------------------------------------*/
#ifdef WIN32
_beginthread(keepalive_thread, 0, this);
#else
pthread_t thread;
pthread_create(&thread, NULL, &keepalive_thread, this);
#endif
}
CorsairCmdrProController::~CorsairCmdrProController()
{
}
void CorsairCmdrProController::KeepaliveThread()
{
while(1)
{
SendCommit();
Sleep(5000);
}
}
void CorsairCmdrProController::SetChannelEffect(unsigned char channel,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2,
unsigned char red3,
unsigned char grn3,
unsigned char blu3
)
{
/*-----------------------------------------------------*\
| Send Reset packet |
\*-----------------------------------------------------*/
SendReset(channel);
/*-----------------------------------------------------*\
| Send Begin packet |
\*-----------------------------------------------------*/
SendBegin(channel);
/*-----------------------------------------------------*\
| Set Port State packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE);
/*-----------------------------------------------------*\
| Set Effect Configuration packet |
\*-----------------------------------------------------*/
SendEffectConfig
(
channel,
0,
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP,
mode,
speed,
direction,
random,
red1,
grn1,
blu1,
red2,
grn2,
blu2,
red3,
grn3,
blu3,
0,
0,
0
);
/*-----------------------------------------------------*\
| Send Commit packet |
\*-----------------------------------------------------*/
SendCommit();
}
void CorsairCmdrProController::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
{
unsigned char color_data[50];
unsigned char pkt_max;
/*-----------------------------------------------------*\
| Send Port State packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE);
/*-----------------------------------------------------*\
| Send red channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetRValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
/*-----------------------------------------------------*\
| Send red channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetRValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
}
/*-----------------------------------------------------*\
| Send green channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
/*-----------------------------------------------------*\
| Send green channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
}
/*-----------------------------------------------------*\
| Send blue channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
/*-----------------------------------------------------*\
| Send blue channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
}
/*-----------------------------------------------------*\
| Send Commit packet |
\*-----------------------------------------------------*/
SendCommit();
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairCmdrProController::SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_DIRECT;
usb_buf[0x01] = channel;
usb_buf[0x02] = start;
usb_buf[0x03] = count;
usb_buf[0x04] = color_channel;
/*-----------------------------------------------------*\
| Copy in color data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x05], color_data, count);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendCommit()
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Commit packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_COMMIT;
usb_buf[0x01] = 0xFF;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendBegin
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Begin packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_BEGIN;
usb_buf[0x01] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Effect Config packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG;
usb_buf[0x01] = channel;
usb_buf[0x02] = count * 10;
usb_buf[0x03] = led_type;
/*-----------------------------------------------------*\
| Set up mode parameters |
\*-----------------------------------------------------*/
usb_buf[0x04] = mode;
usb_buf[0x05] = speed;
usb_buf[0x06] = direction;
usb_buf[0x07] = change_style;
usb_buf[0x08] = 0;
/*-----------------------------------------------------*\
| Set up mode colors |
\*-----------------------------------------------------*/
usb_buf[0x09] = color_0_red;
usb_buf[0x10] = color_0_green;
usb_buf[0x11] = color_0_blue;
usb_buf[0x12] = color_1_red;
usb_buf[0x13] = color_1_green;
usb_buf[0x14] = color_1_blue;
usb_buf[0x15] = color_2_red;
usb_buf[0x16] = color_2_green;
usb_buf[0x17] = color_2_blue;
/*-----------------------------------------------------*\
| Set up temperatures |
\*-----------------------------------------------------*/
usb_buf[0x12] = (temperature_0 >> 8);
usb_buf[0x13] = (temperature_0 & 0xFF);
usb_buf[0x14] = (temperature_1 >> 8);
usb_buf[0x15] = (temperature_1 & 0xFF);
usb_buf[0x16] = (temperature_2 >> 8);
usb_buf[0x17] = (temperature_2 & 0xFF);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendTemperature()
{
}
void CorsairCmdrProController::SendReset
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Reset packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_RESET;
usb_buf[0x01] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendPortState
(
unsigned char channel,
unsigned char state
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Port State packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE;
usb_buf[0x01] = channel;
usb_buf[0x02] = state;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendBrightness()
{
}
void CorsairCmdrProController::SendLEDCount()
{
}
void CorsairCmdrProController::SendProtocol()
{
}
@@ -1,166 +0,0 @@
/*---------------------------------------------------------*\
| Definitions for Corsair Commander Pro |
| |
| Adam Honse ([email protected]), 1/16/2020 |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#pragma once
enum
{
CORSAIR_CMDR_PRO_PACKET_ID_DIRECT = 0x32, /* Direct mode LED update packet */
CORSAIR_CMDR_PRO_PACKET_ID_COMMIT = 0x33, /* Commit changes packet */
CORSAIR_CMDR_PRO_PACKET_ID_BEGIN = 0x34, /* Begin effect packet */
CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG = 0x35, /* Effect mode configuration packet */
CORSAIR_CMDR_PRO_PACKET_ID_TEMPERATURE = 0x36, /* Update temperature value packet */
CORSAIR_CMDR_PRO_PACKET_ID_RESET = 0x37, /* Reset channel packet */
CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE = 0x38, /* Set port state packet */
CORSAIR_CMDR_PRO_PACKET_ID_BRIGHTNESS = 0x39, /* Set brightness packet */
CORSAIR_CMDR_PRO_PACKET_ID_LED_COUNT = 0x3A, /* Set LED count packet */
CORSAIR_CMDR_PRO_PACKET_ID_PROTOCOL = 0x3B, /* Set protocol packet */
};
enum
{
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED = 0x00, /* Red channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN = 0x01, /* Green channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE = 0x02, /* Blue channel for direct update */
};
enum
{
CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE = 0x01, /* Effect hardware control of channel */
CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE = 0x02, /* Direct software control of channel */
};
enum
{
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP = 0x0A, /* Corsair LED Strip Type */
CORSAIR_CMDR_PRO_LED_TYPE_HD_FAN = 0x0C, /* Corsair HD-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_SP_FAN = 0x01, /* Corsair SP-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_ML_FAN = 0x02, /* Corsair ML-series Fan Type */
};
enum
{
CORSAIR_CMDR_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
CORSAIR_CMDR_PRO_CHANNEL_2 = 0x01, /* Channel 2 */
CORSAIR_CMDR_PRO_NUM_CHANNELS = 0x02, /* Number of channels */
};
enum
{
CORSAIR_CMDR_PRO_SPEED_FAST = 0x00, /* Fast speed */
CORSAIR_CMDR_PRO_SPEED_MEDIUM = 0x01, /* Medium speed */
CORSAIR_CMDR_PRO_SPEED_SLOW = 0x02, /* Slow speed */
};
enum
{
CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE = 0x00, /* Rainbow Wave mode */
CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT = 0x01, /* Color Shift mode */
CORSAIR_CMDR_PRO_MODE_COLOR_PULSE = 0x02, /* Color Pulse mode */
CORSAIR_CMDR_PRO_MODE_COLOR_WAVE = 0x03, /* Color Wave mode */
CORSAIR_CMDR_PRO_MODE_STATIC = 0x04, /* Static mode */
CORSAIR_CMDR_PRO_MODE_TEMPERATURE = 0x05, /* Temperature mode */
CORSAIR_CMDR_PRO_MODE_VISOR = 0x06, /* Visor mode */
CORSAIR_CMDR_PRO_MODE_MARQUEE = 0x07, /* Marquee mode */
CORSAIR_CMDR_PRO_MODE_BLINK = 0x08, /* Blink mode */
CORSAIR_CMDR_PRO_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
CORSAIR_CMDR_PRO_MODE_RAINBOW = 0x0A, /* Rainbow mode */
};
class CorsairCmdrProController
{
public:
CorsairCmdrProController(libusb_device_handle* dev_handle);
~CorsairCmdrProController();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned char channel,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2,
unsigned char red3,
unsigned char grn3,
unsigned char blu3
);
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
unsigned int channel_leds[CORSAIR_CMDR_PRO_NUM_CHANNELS];
void KeepaliveThread();
private:
libusb_device_handle* dev;
void SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
);
void SendCommit();
void SendBegin
(
unsigned char channel
);
void SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
);
void SendTemperature();
void SendReset
(
unsigned char channel
);
void SendPortState
(
unsigned char channel,
unsigned char state
);
void SendBrightness();
void SendLEDCount();
void SendProtocol();
};
@@ -1,37 +0,0 @@
#include "CorsairCmdrProController.h"
#include "RGBController.h"
#include "RGBController_CorsairCmdrPro.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#define CORSAIR_COMMANDER_PRO_VID 0x1B1C
#define CORSAIR_COMMANDER_PRO_PID 0x0C10
/******************************************************************************************\
* *
* DetectCorsairCmdrProControllers *
* *
* Detect devices supported by the Corsair Commander Pro driver *
* * *
\******************************************************************************************/
void DetectCorsairCmdrProControllers(std::vector<RGBController*> &rgb_controllers)
{
libusb_context * ctx;
libusb_init(&ctx);
//Look for Corsair Commander Pro
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, CORSAIR_COMMANDER_PRO_VID, CORSAIR_COMMANDER_PRO_PID);
if( dev )
{
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
CorsairCmdrProController* controller = new CorsairCmdrProController(dev);
RGBController_CorsairCmdrPro* rgb_controller = new RGBController_CorsairCmdrPro(controller);
rgb_controllers.push_back(rgb_controller);
}
} /* DetectCorsairCmdrProControllers() */
@@ -1,125 +0,0 @@
#include "CorsairController.h"
#include "RGBController.h"
#include "RGBController_Corsair.h"
#include "i2c_smbus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
/******************************************************************************************\
* *
* TestForCorsairController *
* *
* Tests the given address to see if a Corsair controller exists there. *
* *
\******************************************************************************************/
bool TestForCorsairController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
for (int i = 0xA0; i < 0xB0; i++)
{
res = bus->i2c_smbus_read_byte_data(address, i);
if (res != 0xBA)
{
pass = false;
}
}
}
return(pass);
} /* TestForCorsairController() */
/******************************************************************************************\
* *
* DetectCorsairControllers *
* *
* Detect Corsair controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where Aura device is connected *
* dev - I2C address of Aura device *
* *
\******************************************************************************************/
void DetectCorsairControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
{
CorsairController* new_corsair;
RGBController_Corsair* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Check for Corsair controller at 0x58
if (TestForCorsairController(busses[bus], 0x58))
{
new_corsair = new CorsairController(busses[bus], 0x58);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x59
if (TestForCorsairController(busses[bus], 0x59))
{
new_corsair = new CorsairController(busses[bus], 0x59);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5A
if (TestForCorsairController(busses[bus], 0x5A))
{
new_corsair = new CorsairController(busses[bus], 0x5A);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5B
if (TestForCorsairController(busses[bus], 0x5B))
{
new_corsair = new CorsairController(busses[bus], 0x5B);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5C
if (TestForCorsairController(busses[bus], 0x5C))
{
new_corsair = new CorsairController(busses[bus], 0x5C);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5D
if (TestForCorsairController(busses[bus], 0x5D))
{
new_corsair = new CorsairController(busses[bus], 0x5D);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairController(busses[bus], 0x5E))
{
new_corsair = new CorsairController(busses[bus], 0x5E);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5F
if (TestForCorsairController(busses[bus], 0x5F))
{
new_corsair = new CorsairController(busses[bus], 0x5F);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectCorsairControllers() */
@@ -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;
};
@@ -1,253 +0,0 @@
/*-----------------------------------------*\
| CorsairKeyboardController.cpp |
| |
| Driver for Corsair RGB keyboard lighting |
| controller |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "CorsairKeyboardController.h"
#include <cstring>
static unsigned int keys[] = {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};
static void send_usb_msg(hid_device* dev, char * data_pkt)
{
char usb_pkt[65];
usb_pkt[0] = 0x00;
for(int i = 1; i < 65; i++)
{
usb_pkt[i] = data_pkt[i-1];
}
int bytes = hid_send_feature_report(dev, (unsigned char *)usb_pkt, 65);
bytes++;
}
static void get_usb_msg(hid_device* dev, char* data_pkt)
{
char usb_pkt[65];
usb_pkt[0] = 0x00;
for(int i = 1; i < 65; i++)
{
usb_pkt[i] = data_pkt[i-1];
}
int bytes = hid_get_feature_report(dev, (unsigned char*)data_pkt, 64);
bytes++;
}
CorsairKeyboardController::CorsairKeyboardController(hid_device* dev_handle)
{
dev = dev_handle;
char data_pkt[64] = { 0 };
LightingControl();
}
CorsairKeyboardController::~CorsairKeyboardController()
{
}
void CorsairKeyboardController::SetLEDs(std::vector<RGBColor> colors)
{
unsigned char data_pkt[216];
unsigned char red_val[144];
unsigned char grn_val[144];
unsigned char blu_val[144];
/*-----------------------------------------------------*\
| Zero out buffers |
\*-----------------------------------------------------*/
memset(data_pkt, 0x00, sizeof( data_pkt ));
memset(red_val, 0x00, sizeof( red_val ));
memset(grn_val, 0x00, sizeof( grn_val ));
memset(blu_val, 0x00, sizeof( blu_val ));
/*-----------------------------------------------------*\
| Scale color values to 9-bit |
\*-----------------------------------------------------*/
for(int color_idx = 0; color_idx < colors.size(); color_idx++)
{
RGBColor color = colors[color_idx];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if( red > 7 ) red = 7;
if( grn > 7 ) grn = 7;
if( blu > 7 ) blu = 7;
red = 7 - red;
grn = 7 - grn;
blu = 7 - blu;
red_val[keys[color_idx]] = red;
grn_val[keys[color_idx]] = grn;
blu_val[keys[color_idx]] = blu;
}
/*-----------------------------------------------------*\
| Pack the color values, 2 values per byte |
\*-----------------------------------------------------*/
for(int red_idx = 0; red_idx < 72; red_idx++)
{
data_pkt[red_idx] = red_val[(red_idx * 2) + 1] << 4 | red_val[red_idx * 2];
}
for(int grn_idx = 0; grn_idx < 72; grn_idx++)
{
data_pkt[grn_idx + 72] = grn_val[(grn_idx * 2) + 1] << 4 | grn_val[grn_idx * 2];
}
for(int blu_idx = 0; blu_idx < 72; blu_idx++)
{
data_pkt[blu_idx + 144] = blu_val[(blu_idx * 2) + 1] << 4 | blu_val[blu_idx * 2];
}
/*-----------------------------------------------------*\
| Send the packets |
\*-----------------------------------------------------*/
StreamPacket(1, 60, &data_pkt[0]);
StreamPacket(2, 60, &data_pkt[60]);
StreamPacket(3, 60, &data_pkt[120]);
StreamPacket(4, 36, &data_pkt[180]);
SubmitLimitedColors(216);
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairKeyboardController::LightingControl()
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
usb_buf[0x01] = CORSAIR_PROPERTY_LIGHTING_CONTROL;
usb_buf[0x02] = CORSAIR_LIGHTING_CONTROL_SOFTWARE;
usb_buf[0x04] = 0x03;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::ReadFirmwareInfo()
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Read Firmware Info packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_READ;
usb_buf[0x01] = CORSAIR_PROPERTY_FIRMWARE_INFO;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
get_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::StreamPacket
(
unsigned char packet_id,
unsigned char data_sz,
unsigned char* data_ptr
)
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Stream packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_STREAM;
usb_buf[0x01] = packet_id;
usb_buf[0x02] = data_sz;
/*-----------------------------------------------------*\
| Copy in data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x04], data_ptr, data_sz);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::SubmitColors()
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Keyboard 24-Bit Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
usb_buf[0x01] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::SubmitLimitedColors
(
unsigned char byte_count
)
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Keyboard 9-Bit Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
usb_buf[0x01] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_9;
usb_buf[0x04] = byte_count;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
@@ -1,78 +0,0 @@
/*-----------------------------------------*\
| CorsairKeyboardController.h |
| |
| Definitions and types for Corsair RGB |
| keyboard lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
CORSAIR_COMMAND_WRITE = 0x07,
CORSAIR_COMMAND_READ = 0x0E,
CORSAIR_COMMAND_STREAM = 0x7F
};
enum
{
CORSAIR_PROPERTY_FIRMWARE_INFO = 0x01,
CORSAIR_PROPERTY_RESET = 0x02,
CORSAIR_PROPERTY_SPECIAL_FUNCTION = 0x04,
CORSAIR_PROPERTY_LIGHTING_CONTROL = 0x05,
CORSAIR_PROPERTY_HARDWARE_PROFILE = 0x13,
CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR = 0x22,
CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_9 = 0x27,
CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24 = 0x28,
};
enum
{
CORSAIR_LIGHTING_CONTROL_HARDWARE = 0x01,
CORSAIR_LIGHTING_CONTROL_SOFTWARE = 0x02
};
enum
{
CORSAIR_COLOR_CHANNEL_RED = 0x01,
CORSAIR_COLOR_CHANNEL_GREEN = 0x02,
CORSAIR_COLOR_CHANNEL_BLUE = 0x03
};
class CorsairKeyboardController
{
public:
CorsairKeyboardController(hid_device* dev_handle);
~CorsairKeyboardController();
void SetLEDsDirect(std::vector<RGBColor> colors);
void SetLEDs(std::vector<RGBColor> colors);
private:
hid_device* dev;
void LightingControl();
void ReadFirmwareInfo();
void StreamPacket
(
unsigned char packet_id,
unsigned char data_sz,
unsigned char* data_ptr
);
void SubmitColors();
void SubmitLimitedColors
(
unsigned char byte_count
);
};
@@ -1,52 +0,0 @@
#include "CorsairKeyboardController.h"
#include "RGBController.h"
#include "RGBController_CorsairKeyboard.h"
#include <vector>
#include <hidapi/hidapi.h>
#define CORSAIR_RGB_KEYBOARD_VID 0x1B1C
#define CORSAIR_RGB_KEYBOARD_K70_PID 0x1B13
#define CORSAIR_RGB_KEYBOARD_K95_PID 0x1B11
/******************************************************************************************\
* *
* DetectCorsairKeyboardControllers *
* *
* Tests the USB address to see if a Corsair RGB Keyboard controller exists there. *
* *
\******************************************************************************************/
void DetectCorsairKeyboardControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device* dev = NULL;
hid_init();
info = hid_enumerate(CORSAIR_RGB_KEYBOARD_VID, CORSAIR_RGB_KEYBOARD_K70_PID);
//Look for Corsair RGB Keyboard, interface 1
while(info)
{
if((info->vendor_id == CORSAIR_RGB_KEYBOARD_VID)
&&(info->product_id == CORSAIR_RGB_KEYBOARD_K70_PID)
&&(info->interface_number == 1))
{
dev = hid_open_path(info->path);
break;
}
else
{
info = info->next;
}
}
if( dev )
{
CorsairKeyboardController* controller = new CorsairKeyboardController(dev);
RGBController_CorsairKeyboard* rgb_controller = new RGBController_CorsairKeyboard(controller);
rgb_controllers.push_back(rgb_controller);
}
}
@@ -4,7 +4,7 @@
| Adam Honse (calcprogrammer1@gmail.com), 1/12/2020 |
\*---------------------------------------------------------*/
#include "CorsairNodeProController.h"
#include "CorsairLightingNodeController.h"
#include <fstream>
#include <iostream>
@@ -28,29 +28,21 @@
#define THREADRETURN return(NULL);
#endif
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
using namespace std::chrono_literals;
THREAD keepalive_thread(void *param)
{
CorsairNodeProController* corsair = static_cast<CorsairNodeProController*>(param);
CorsairLightingNodeController* corsair = static_cast<CorsairLightingNodeController*>(param);
corsair->KeepaliveThread();
THREADRETURN
}
CorsairNodeProController::CorsairNodeProController(libusb_device_handle* dev_handle)
CorsairLightingNodeController::CorsairLightingNodeController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
channel_leds[0] = 60;
channel_leds[1] = 60;
dev = dev_handle;
location = path;
SendFirmwareRequest();
/*-----------------------------------------------------*\
| The Corsair Lighting Node Pro requires a packet within|
@@ -66,20 +58,34 @@ CorsairNodeProController::CorsairNodeProController(libusb_device_handle* dev_han
#endif
}
CorsairNodeProController::~CorsairNodeProController()
CorsairLightingNodeController::~CorsairLightingNodeController()
{
}
void CorsairNodeProController::KeepaliveThread()
void CorsairLightingNodeController::KeepaliveThread()
{
while(1)
{
SendCommit();
Sleep(5000);
if((std::chrono::steady_clock::now() - last_commit_time) > std::chrono::seconds(5))
{
SendCommit();
}
std::this_thread::sleep_for(1s);
}
}
void CorsairNodeProController::SetChannelEffect(unsigned char channel,
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,
unsigned char speed,
unsigned char direction,
@@ -108,7 +114,7 @@ void CorsairNodeProController::SetChannelEffect(unsigned char channel,
/*-----------------------------------------------------*\
| Set Port State packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE);
SendPortState(channel, CORSAIR_LIGHTING_NODE_PORT_STATE_HARDWARE);
/*-----------------------------------------------------*\
| Set Effect Configuration packet |
@@ -117,7 +123,7 @@ void CorsairNodeProController::SetChannelEffect(unsigned char channel,
(
channel,
0,
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP,
num_leds,
mode,
speed,
direction,
@@ -142,125 +148,47 @@ void CorsairNodeProController::SetChannelEffect(unsigned char channel,
SendCommit();
}
void CorsairNodeProController::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
void CorsairLightingNodeController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
{
unsigned char color_data[50];
unsigned char pkt_max;
unsigned char red_color_data[50];
unsigned char grn_color_data[50];
unsigned char blu_color_data[50];
unsigned char pkt_offset = 0;
unsigned char pkt_size = 0;
unsigned int colors_remaining = num_colors;
/*-----------------------------------------------------*\
| Send Port State packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE);
SendPortState(channel, CORSAIR_LIGHTING_NODE_PORT_STATE_SOFTWARE);
/*-----------------------------------------------------*\
| Send red channel packet 1 |
| Loop through colors and send 50 at a time |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
while(colors_remaining > 0)
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetRValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
/*-----------------------------------------------------*\
| Send red channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
if(colors_remaining < 50)
{
color_data[idx] = RGBGetRValue(colors[idx+50]);
pkt_size = colors_remaining;
}
else
{
pkt_size = 50;
}
for(int color_idx = 0; color_idx < pkt_size; color_idx++)
{
red_color_data[color_idx] = RGBGetRValue(colors[pkt_offset + color_idx]);
grn_color_data[color_idx] = RGBGetGValue(colors[pkt_offset + color_idx]);
blu_color_data[color_idx] = RGBGetBValue(colors[pkt_offset + color_idx]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
}
SendDirect(channel, pkt_offset, pkt_size, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_RED, red_color_data);
SendDirect(channel, pkt_offset, pkt_size, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_GREEN, grn_color_data);
SendDirect(channel, pkt_offset, pkt_size, CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_BLUE, blu_color_data);
/*-----------------------------------------------------*\
| Send green channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
/*-----------------------------------------------------*\
| Send green channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
}
/*-----------------------------------------------------*\
| Send blue channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
/*-----------------------------------------------------*\
| Send blue channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
colors_remaining -= pkt_size;
pkt_offset += pkt_size;
}
/*-----------------------------------------------------*\
@@ -273,7 +201,35 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, std::vector
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairNodeProController::SendDirect
void CorsairLightingNodeController::SendFirmwareRequest()
{
int actual;
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Firmware Version Request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_FIRMWARE;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
actual = hid_read(dev, usb_buf, 17);
if(actual > 0)
{
firmware_version = std::to_string(usb_buf[0x01]) + "." + std::to_string(usb_buf[0x02]) + "." + std::to_string(usb_buf[0x03]);
}
}
void CorsairLightingNodeController::SendDirect
(
unsigned char channel,
unsigned char start,
@@ -282,8 +238,7 @@ void CorsairNodeProController::SendDirect
unsigned char* color_data
)
{
int actual;
unsigned char usb_buf[64];
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -293,52 +248,59 @@ void CorsairNodeProController::SendDirect
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_DIRECT;
usb_buf[0x01] = channel;
usb_buf[0x02] = start;
usb_buf[0x03] = count;
usb_buf[0x04] = color_channel;
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_DIRECT;
usb_buf[0x02] = channel;
usb_buf[0x03] = start;
usb_buf[0x04] = count;
usb_buf[0x05] = color_channel;
/*-----------------------------------------------------*\
| Copy in color data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x05], color_data, count);
memcpy(&usb_buf[0x06], color_data, count);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
}
void CorsairNodeProController::SendCommit()
void CorsairLightingNodeController::SendCommit()
{
int actual;
unsigned char usb_buf[64];
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Update last commit time |
\*-----------------------------------------------------*/
last_commit_time = std::chrono::steady_clock::now();
/*-----------------------------------------------------*\
| Set up Commit packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_COMMIT;
usb_buf[0x01] = 0xFF;
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_COMMIT;
usb_buf[0x02] = 0xFF;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
}
void CorsairNodeProController::SendBegin
void CorsairLightingNodeController::SendBegin
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -348,16 +310,18 @@ void CorsairNodeProController::SendBegin
/*-----------------------------------------------------*\
| Set up Begin packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_BEGIN;
usb_buf[0x01] = channel;
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_BEGIN;
usb_buf[0x02] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
}
void CorsairNodeProController::SendEffectConfig
void CorsairLightingNodeController::SendEffectConfig
(
unsigned char channel,
unsigned char count,
@@ -380,8 +344,7 @@ void CorsairNodeProController::SendEffectConfig
unsigned short temperature_2
)
{
int actual;
unsigned char usb_buf[64];
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -391,61 +354,62 @@ void CorsairNodeProController::SendEffectConfig
/*-----------------------------------------------------*\
| Set up Effect Config packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG;
usb_buf[0x01] = channel;
usb_buf[0x02] = count * 10;
usb_buf[0x03] = led_type;
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_EFFECT_CONFIG;
usb_buf[0x02] = channel;
usb_buf[0x03] = count;
usb_buf[0x04] = led_type;
/*-----------------------------------------------------*\
| Set up mode parameters |
\*-----------------------------------------------------*/
usb_buf[0x04] = mode;
usb_buf[0x05] = speed;
usb_buf[0x06] = direction;
usb_buf[0x07] = change_style;
usb_buf[0x08] = 0;
usb_buf[0x05] = mode;
usb_buf[0x06] = speed;
usb_buf[0x07] = direction;
usb_buf[0x08] = change_style;
usb_buf[0x09] = 0;
/*-----------------------------------------------------*\
| Set up mode colors |
\*-----------------------------------------------------*/
usb_buf[0x09] = color_0_red;
usb_buf[0x10] = color_0_green;
usb_buf[0x11] = color_0_blue;
usb_buf[0x12] = color_1_red;
usb_buf[0x13] = color_1_green;
usb_buf[0x14] = color_1_blue;
usb_buf[0x15] = color_2_red;
usb_buf[0x16] = color_2_green;
usb_buf[0x17] = color_2_blue;
usb_buf[0x0A] = color_0_red;
usb_buf[0x0B] = color_0_green;
usb_buf[0x0C] = color_0_blue;
usb_buf[0x0D] = color_1_red;
usb_buf[0x0E] = color_1_green;
usb_buf[0x0F] = color_1_blue;
usb_buf[0x10] = color_2_red;
usb_buf[0x11] = color_2_green;
usb_buf[0x12] = color_2_blue;
/*-----------------------------------------------------*\
| Set up temperatures |
\*-----------------------------------------------------*/
usb_buf[0x12] = (temperature_0 >> 8);
usb_buf[0x13] = (temperature_0 & 0xFF);
usb_buf[0x14] = (temperature_1 >> 8);
usb_buf[0x15] = (temperature_1 & 0xFF);
usb_buf[0x16] = (temperature_2 >> 8);
usb_buf[0x17] = (temperature_2 & 0xFF);
usb_buf[0x13] = (temperature_0 >> 8);
usb_buf[0x14] = (temperature_0 & 0xFF);
usb_buf[0x15] = (temperature_1 >> 8);
usb_buf[0x16] = (temperature_1 & 0xFF);
usb_buf[0x17] = (temperature_2 >> 8);
usb_buf[0x18] = (temperature_2 & 0xFF);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
}
void CorsairNodeProController::SendTemperature()
void CorsairLightingNodeController::SendTemperature()
{
}
void CorsairNodeProController::SendReset
void CorsairLightingNodeController::SendReset
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -455,23 +419,24 @@ void CorsairNodeProController::SendReset
/*-----------------------------------------------------*\
| Set up Reset packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_RESET;
usb_buf[0x01] = channel;
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_RESET;
usb_buf[0x02] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
}
void CorsairNodeProController::SendPortState
void CorsairLightingNodeController::SendPortState
(
unsigned char channel,
unsigned char state
)
{
int actual;
unsigned char usb_buf[64];
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -481,27 +446,29 @@ void CorsairNodeProController::SendPortState
/*-----------------------------------------------------*\
| Set up Port State packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE;
usb_buf[0x01] = channel;
usb_buf[0x02] = state;
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_PORT_STATE;
usb_buf[0x02] = channel;
usb_buf[0x03] = state;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
}
void CorsairNodeProController::SendBrightness()
void CorsairLightingNodeController::SendBrightness()
{
}
void CorsairNodeProController::SendLEDCount()
void CorsairLightingNodeController::SendLEDCount()
{
}
void CorsairNodeProController::SendProtocol()
void CorsairLightingNodeController::SendProtocol()
{
}
@@ -0,0 +1,176 @@
/*---------------------------------------------------------*\
| Definitions for Corsair Lighting Node Pro |
| |
| Adam Honse ([email protected]), 1/12/2020 |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include <chrono>
#include <vector>
#include <hidapi/hidapi.h>
#pragma once
enum
{
CORSAIR_LIGHTING_NODE_PACKET_ID_FIRMWARE = 0x02, /* Get firmware version */
CORSAIR_LIGHTING_NODE_PACKET_ID_DIRECT = 0x32, /* Direct mode LED update packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_COMMIT = 0x33, /* Commit changes packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_BEGIN = 0x34, /* Begin effect packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_EFFECT_CONFIG = 0x35, /* Effect mode configuration packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_TEMPERATURE = 0x36, /* Update temperature value packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_RESET = 0x37, /* Reset channel packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_PORT_STATE = 0x38, /* Set port state packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_BRIGHTNESS = 0x39, /* Set brightness packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_LED_COUNT = 0x3A, /* Set LED count packet */
CORSAIR_LIGHTING_NODE_PACKET_ID_PROTOCOL = 0x3B, /* Set protocol packet */
};
enum
{
CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_RED = 0x00, /* Red channel for direct update */
CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_GREEN = 0x01, /* Green channel for direct update */
CORSAIR_LIGHTING_NODE_DIRECT_CHANNEL_BLUE = 0x02, /* Blue channel for direct update */
};
enum
{
CORSAIR_LIGHTING_NODE_PORT_STATE_HARDWARE = 0x01, /* Effect hardware control of channel */
CORSAIR_LIGHTING_NODE_PORT_STATE_SOFTWARE = 0x02, /* Direct software control of channel */
};
enum
{
CORSAIR_LIGHTING_NODE_LED_TYPE_LED_STRIP = 0x0A, /* Corsair LED Strip Type */
CORSAIR_LIGHTING_NODE_LED_TYPE_HD_FAN = 0x0C, /* Corsair HD-series Fan Type */
CORSAIR_LIGHTING_NODE_LED_TYPE_SP_FAN = 0x01, /* Corsair SP-series Fan Type */
CORSAIR_LIGHTING_NODE_LED_TYPE_ML_FAN = 0x02, /* Corsair ML-series Fan Type */
};
enum
{
CORSAIR_LIGHTING_NODE_CHANNEL_1 = 0x00, /* Channel 1 */
CORSAIR_LIGHTING_NODE_CHANNEL_2 = 0x01, /* Channel 2 */
CORSAIR_LIGHTING_NODE_NUM_CHANNELS = 0x02, /* Number of channels */
};
enum
{
CORSAIR_LIGHTING_NODE_SPEED_FAST = 0x00, /* Fast speed */
CORSAIR_LIGHTING_NODE_SPEED_MEDIUM = 0x01, /* Medium speed */
CORSAIR_LIGHTING_NODE_SPEED_SLOW = 0x02, /* Slow speed */
};
enum
{
CORSAIR_LIGHTING_NODE_MODE_RAINBOW_WAVE = 0x00, /* Rainbow Wave mode */
CORSAIR_LIGHTING_NODE_MODE_COLOR_SHIFT = 0x01, /* Color Shift mode */
CORSAIR_LIGHTING_NODE_MODE_COLOR_PULSE = 0x02, /* Color Pulse mode */
CORSAIR_LIGHTING_NODE_MODE_COLOR_WAVE = 0x03, /* Color Wave mode */
CORSAIR_LIGHTING_NODE_MODE_STATIC = 0x04, /* Static mode */
CORSAIR_LIGHTING_NODE_MODE_TEMPERATURE = 0x05, /* Temperature mode */
CORSAIR_LIGHTING_NODE_MODE_VISOR = 0x06, /* Visor mode */
CORSAIR_LIGHTING_NODE_MODE_MARQUEE = 0x07, /* Marquee mode */
CORSAIR_LIGHTING_NODE_MODE_BLINK = 0x08, /* Blink mode */
CORSAIR_LIGHTING_NODE_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
CORSAIR_LIGHTING_NODE_MODE_RAINBOW = 0x0A, /* Rainbow mode */
};
class CorsairLightingNodeController
{
public:
CorsairLightingNodeController(hid_device* dev_handle, const char* path);
~CorsairLightingNodeController();
std::string GetFirmwareString();
std::string GetLocationString();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned char channel,
unsigned char num_leds,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2,
unsigned char red3,
unsigned char grn3,
unsigned char blu3
);
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
void KeepaliveThread();
private:
hid_device* dev;
std::string firmware_version;
std::string location;
std::chrono::time_point<std::chrono::steady_clock> last_commit_time;
void SendFirmwareRequest();
void SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
);
void SendCommit();
void SendBegin
(
unsigned char channel
);
void SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
);
void SendTemperature();
void SendReset
(
unsigned char channel
);
void SendPortState
(
unsigned char channel,
unsigned char state
);
void SendBrightness();
void SendLEDCount();
void SendProtocol();
};
@@ -0,0 +1,82 @@
#include "Detector.h"
#include "CorsairLightingNodeController.h"
#include "RGBController.h"
#include "RGBController_CorsairLightingNode.h"
#include <vector>
#include <hidapi/hidapi.h>
#define CORSAIR_VID 0x1B1C
#define CORSAIR_LIGHTING_NODE_CORE_PID 0x0C1A
#define CORSAIR_LIGHTING_NODE_PRO_PID 0x0C0B
#define CORSAIR_COMMANDER_PRO_PID 0x0C10
#define CORSAIR_LS100_PID 0x0C1E
#define CORSAIR_1000D_OBSIDIAN_PID 0x1D00
#define CORSAIR_SPEC_OMEGA_RGB_PID 0x1D04
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned char channel_count;
const char * name;
} corsair_node_device;
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const corsair_node_device device_list[] =
{
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_CORE_PID, 1, "Corsair Lighting Node Core" },
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_PRO_PID, 2, "Corsair Lighting Node Pro" },
{ CORSAIR_VID, CORSAIR_COMMANDER_PRO_PID, 2, "Corsair Commander Pro" },
{ CORSAIR_VID, CORSAIR_LS100_PID, 1, "Corsair LS100 Lighting Kit" },
{ CORSAIR_VID, CORSAIR_1000D_OBSIDIAN_PID, 2, "Corsair 1000D Obsidian" },
{ CORSAIR_VID, CORSAIR_SPEC_OMEGA_RGB_PID, 2, "Corsair SPEC OMEGA RGB" }
};
/******************************************************************************************\
* *
* DetectCorsairLightingNodeControllers *
* *
* Detect devices supported by the Corsair Lighting Node Pro driver *
* *
\******************************************************************************************/
void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_controllers)
{
hid_device_info* info;
hid_device* dev;
hid_init();
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
{
dev = NULL;
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
//Look for Corsair Lighting Node Devices
while(info)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid))
{
dev = hid_open_path(info->path);
if( dev )
{
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev, info->path);
RGBController_CorsairLightingNode* rgb_controller = new RGBController_CorsairLightingNode(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
}
}
} /* DetectCorsairLightingNodeControllers() */
REGISTER_DETECTOR("Corsair Lighting Node", DetectCorsairLightingNodeControllers);
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| RGBController_CorsairNodePro.cpp |
| RGBController_CorsairLightingNode.cpp |
| |
| Generic RGB Interface for Corsair |
| Lighting Node Pro |
@@ -7,16 +7,18 @@
| Adam Honse (CalcProgrammer1) 1/12/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairNodePro.h"
#include "RGBController_CorsairLightingNode.h"
RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProController* corsair_ptr)
RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLightingNodeController* corsair_ptr)
{
corsair = corsair_ptr;
name = "Corsair Lighting Node Pro";
type = DEVICE_TYPE_LEDSTRIP;
name = "Corsair Lighting Node Device";
description = "Corsair Lighting Node Device";
type = DEVICE_TYPE_LEDSTRIP;
version = corsair->GetFirmwareString();
location = corsair->GetLocationString();
mode Direct;
Direct.name = "Direct";
@@ -27,50 +29,50 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
mode RainbowWave;
RainbowWave.name = "Rainbow Wave";
RainbowWave.value = CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE;
RainbowWave.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW_WAVE;
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
RainbowWave.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
RainbowWave.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
RainbowWave.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
RainbowWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
RainbowWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
RainbowWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
RainbowWave.direction = MODE_DIRECTION_RIGHT;
RainbowWave.color_mode = MODE_COLORS_NONE;
modes.push_back(RainbowWave);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT;
ColorShift.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_SHIFT;
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
ColorShift.colors_min = 2;
ColorShift.colors_max = 2;
ColorShift.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorShift.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorShift.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
ColorShift.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
ColorShift.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
ColorShift.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorShift.colors.resize(2);
modes.push_back(ColorShift);
mode ColorPulse;
ColorPulse.name = "Color Pulse";
ColorPulse.value = CORSAIR_CMDR_PRO_MODE_COLOR_PULSE;
ColorPulse.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_PULSE;
ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
ColorPulse.colors_min = 2;
ColorPulse.colors_max = 2;
ColorPulse.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorPulse.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorPulse.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
ColorPulse.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
ColorPulse.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
ColorPulse.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
ColorPulse.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorPulse.colors.resize(2);
modes.push_back(ColorPulse);
mode ColorWave;
ColorWave.name = "Color Wave";
ColorWave.value = CORSAIR_CMDR_PRO_MODE_COLOR_WAVE;
ColorWave.value = CORSAIR_LIGHTING_NODE_MODE_COLOR_WAVE;
ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
ColorWave.colors_min = 2;
ColorWave.colors_max = 2;
ColorWave.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorWave.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorWave.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
ColorWave.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
ColorWave.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
ColorWave.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
ColorWave.direction = MODE_DIRECTION_RIGHT;
ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorWave.colors.resize(2);
@@ -78,7 +80,7 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
mode Static;
Static.name = "Static";
Static.value = CORSAIR_CMDR_PRO_MODE_STATIC;
Static.value = CORSAIR_LIGHTING_NODE_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
@@ -88,7 +90,7 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
mode Temperature;
Temperature.name = "Temperature";
Temperature.value = CORSAIR_CMDR_PRO_MODE_TEMPERATURE;
Temperature.value = CORSAIR_LIGHTING_NODE_MODE_TEMPERATURE;
Temperature.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Temperature.colors_min = 3;
Temperature.colors_max = 3;
@@ -98,26 +100,26 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
mode Visor;
Visor.name = "Visor";
Visor.value = CORSAIR_CMDR_PRO_MODE_VISOR;
Visor.value = CORSAIR_LIGHTING_NODE_MODE_VISOR;
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Visor.colors_min = 2;
Visor.colors_max = 2;
Visor.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Visor.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Visor.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Visor.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Visor.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Visor.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Visor.color_mode = MODE_COLORS_MODE_SPECIFIC;
Visor.colors.resize(2);
modes.push_back(Visor);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = CORSAIR_CMDR_PRO_MODE_MARQUEE;
Marquee.value = CORSAIR_LIGHTING_NODE_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Marquee.colors_min = 1;
Marquee.colors_max = 1;
Marquee.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Marquee.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Marquee.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Marquee.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Marquee.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Marquee.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Marquee.direction = MODE_DIRECTION_RIGHT;
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
Marquee.colors.resize(1);
@@ -125,26 +127,26 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
mode Blink;
Blink.name = "Blink";
Blink.value = CORSAIR_CMDR_PRO_MODE_BLINK;
Blink.value = CORSAIR_LIGHTING_NODE_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Blink.colors_min = 2;
Blink.colors_max = 2;
Blink.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Blink.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Blink.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Blink.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Blink.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Blink.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Blink.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blink.colors.resize(2);
modes.push_back(Blink);
mode Sequential;
Sequential.name = "Sequential";
Sequential.value = CORSAIR_CMDR_PRO_MODE_SEQUENTIAL;
Sequential.value = CORSAIR_LIGHTING_NODE_MODE_SEQUENTIAL;
Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
Sequential.colors_min = 1;
Sequential.colors_max = 1;
Sequential.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Sequential.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Sequential.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Sequential.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Sequential.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Sequential.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Sequential.direction = MODE_DIRECTION_RIGHT;
Sequential.color_mode = MODE_COLORS_MODE_SPECIFIC;
Sequential.colors.resize(1);
@@ -152,145 +154,131 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CORSAIR_CMDR_PRO_MODE_RAINBOW;
Rainbow.value = CORSAIR_LIGHTING_NODE_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Rainbow.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Rainbow.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Rainbow.speed_min = CORSAIR_LIGHTING_NODE_SPEED_SLOW;
Rainbow.speed_max = CORSAIR_LIGHTING_NODE_SPEED_FAST;
Rainbow.speed = CORSAIR_LIGHTING_NODE_SPEED_MEDIUM;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
SetupZones();
}
void RGBController_CorsairLightingNode::SetupZones()
{
/*-------------------------------------------------*\
| Set size of colors array |
| Only set LED count on the first run |
\*-------------------------------------------------*/
unsigned int led_count = 0;
for (unsigned int channel_idx = 0; channel_idx < CORSAIR_NODE_PRO_NUM_CHANNELS; channel_idx++)
bool first_run = false;
if(zones.size() == 0)
{
led_count += corsair->channel_leds[channel_idx];
first_run = true;
}
colors.resize(led_count);
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(CORSAIR_LIGHTING_NODE_NUM_CHANNELS);
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
unsigned int led_idx = 0;
for (unsigned int channel_idx = 0; channel_idx < CORSAIR_NODE_PRO_NUM_CHANNELS; channel_idx++)
for (unsigned int channel_idx = 0; channel_idx < CORSAIR_LIGHTING_NODE_NUM_CHANNELS; channel_idx++)
{
if(corsair->channel_leds[channel_idx] > 0)
char ch_idx_string[2];
sprintf(ch_idx_string, "%d", channel_idx + 1);
zones[channel_idx].name = "Corsair Channel ";
zones[channel_idx].name.append(ch_idx_string);
zones[channel_idx].type = ZONE_TYPE_LINEAR;
/*-------------------------------------------------*\
| I did some experimenting and determined that the |
| maximum number of LEDs the Corsair Commander Pro |
| can support is 200. |
\*-------------------------------------------------*/
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = 204;
if(first_run)
{
zone* new_zone = new zone;
char ch_idx_string[2];
sprintf(ch_idx_string, "%d", channel_idx + 1);
new_zone->name = "Corsair Channel ";
new_zone->name.append(ch_idx_string);
new_zone->type = ZONE_TYPE_LINEAR;
std::vector<int> *new_zone_map = new std::vector<int>();
for (unsigned int led_ch_idx = 0; led_ch_idx < corsair->channel_leds[channel_idx]; led_ch_idx++)
{
char led_idx_string[3];
sprintf(led_idx_string, "%d", led_ch_idx + 1);
led new_led;
new_led.name = "Corsair Channel ";
new_led.name.append(ch_idx_string);
new_led.name.append(", LED ");
new_led.name.append(led_idx_string);
leds.push_back(new_led);
leds_channel.push_back(channel_idx);
new_zone_map->push_back(led_idx);
led_idx++;
}
new_zone->map.push_back(*new_zone_map);
zones.push_back(*new_zone);
zones_channel.push_back(channel_idx);
zones[channel_idx].leds_count = 0;
}
zones[channel_idx].matrix_map = NULL;
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
char led_idx_string[4];
sprintf(led_idx_string, "%d", led_ch_idx + 1);
led new_led;
new_led.name = "Corsair Channel ";
new_led.name.append(ch_idx_string);
new_led.name.append(", LED ");
new_led.name.append(led_idx_string);
leds.push_back(new_led);
leds_channel.push_back(channel_idx);
}
}
SetupColors();
}
void RGBController_CorsairLightingNode::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_CorsairNodePro::UpdateLEDs()
void RGBController_CorsairLightingNode::DeviceUpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
corsair->SetChannelLEDs(channel, channel_colors);
}
corsair->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
}
}
void RGBController_CorsairNodePro::UpdateZoneLEDs(int zone)
void RGBController_CorsairLightingNode::UpdateZoneLEDs(int zone)
{
unsigned int channel = zones_channel[zone];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
corsair->SetChannelLEDs(channel, channel_colors);
}
corsair->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
}
void RGBController_CorsairNodePro::UpdateSingleLED(int led)
void RGBController_CorsairLightingNode::UpdateSingleLED(int led)
{
unsigned int channel = leds_channel[led];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
corsair->SetChannelLEDs(channel, channel_colors);
}
corsair->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
}
void RGBController_CorsairNodePro::SetCustomMode()
void RGBController_CorsairLightingNode::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairNodePro::UpdateMode()
void RGBController_CorsairLightingNode::DeviceUpdateMode()
{
if(modes[active_mode].value == 0xFFFF)
{
UpdateLEDs();
DeviceUpdateLEDs();
}
else
{
for(int channel = 0; channel < CORSAIR_CMDR_PRO_NUM_CHANNELS; channel++)
for(int channel = 0; channel < CORSAIR_LIGHTING_NODE_NUM_CHANNELS; channel++)
{
unsigned int direction = 0;
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
@@ -304,7 +292,7 @@ void RGBController_CorsairNodePro::UpdateMode()
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
for(int i = 0; i < modes[active_mode].colors.size(); i++)
for(std::size_t i = 0; i < modes[active_mode].colors.size(); i++)
{
mode_colors[(3 * i) + 0] = RGBGetRValue(modes[active_mode].colors[i]);
mode_colors[(3 * i) + 1] = RGBGetGValue(modes[active_mode].colors[i]);
@@ -313,6 +301,7 @@ void RGBController_CorsairNodePro::UpdateMode()
}
corsair->SetChannelEffect(channel,
zones[channel].leds_count,
modes[active_mode].value,
modes[active_mode].speed,
direction,
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| RGBController_CorsairNodePro.h |
| RGBController_CorsairLightingNode.h |
| |
| Generic RGB Interface for Corsair |
| Lighting Node Pro |
@@ -9,21 +9,26 @@
#pragma once
#include "RGBController.h"
#include "CorsairNodeProController.h"
#include "CorsairLightingNodeController.h"
class RGBController_CorsairNodePro : public RGBController
class RGBController_CorsairLightingNode : public RGBController
{
public:
RGBController_CorsairNodePro(CorsairNodeProController* corsair_ptr);
void UpdateLEDs();
RGBController_CorsairLightingNode(CorsairLightingNodeController* corsair_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
void DeviceUpdateMode();
private:
CorsairNodeProController* corsair;
CorsairLightingNodeController* corsair;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> zones_channel;
};
@@ -1,173 +0,0 @@
/*---------------------------------------------------------*\
| Definitions for Corsair Lighting Node Pro |
| |
| Adam Honse ([email protected]), 1/12/2020 |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#pragma once
enum
{
CORSAIR_CMDR_PRO_PACKET_ID_DIRECT = 0x32, /* Direct mode LED update packet */
CORSAIR_CMDR_PRO_PACKET_ID_COMMIT = 0x33, /* Commit changes packet */
CORSAIR_CMDR_PRO_PACKET_ID_BEGIN = 0x34, /* Begin effect packet */
CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG = 0x35, /* Effect mode configuration packet */
CORSAIR_CMDR_PRO_PACKET_ID_TEMPERATURE = 0x36, /* Update temperature value packet */
CORSAIR_CMDR_PRO_PACKET_ID_RESET = 0x37, /* Reset channel packet */
CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE = 0x38, /* Set port state packet */
CORSAIR_CMDR_PRO_PACKET_ID_BRIGHTNESS = 0x39, /* Set brightness packet */
CORSAIR_CMDR_PRO_PACKET_ID_LED_COUNT = 0x3A, /* Set LED count packet */
CORSAIR_CMDR_PRO_PACKET_ID_PROTOCOL = 0x3B, /* Set protocol packet */
};
enum
{
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED = 0x00, /* Red channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN = 0x01, /* Green channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE = 0x02, /* Blue channel for direct update */
};
enum
{
CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE = 0x01, /* Effect hardware control of channel */
CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE = 0x02, /* Direct software control of channel */
};
enum
{
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP = 0x0A, /* Corsair LED Strip Type */
CORSAIR_CMDR_PRO_LED_TYPE_HD_FAN = 0x0C, /* Corsair HD-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_SP_FAN = 0x01, /* Corsair SP-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_ML_FAN = 0x02, /* Corsair ML-series Fan Type */
};
enum
{
CORSAIR_CMDR_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
CORSAIR_CMDR_PRO_CHANNEL_2 = 0x01, /* Channel 2 */
CORSAIR_CMDR_PRO_NUM_CHANNELS = 0x02, /* Number of channels */
};
enum
{
CORSAIR_CMDR_PRO_SPEED_FAST = 0x00, /* Fast speed */
CORSAIR_CMDR_PRO_SPEED_MEDIUM = 0x01, /* Medium speed */
CORSAIR_CMDR_PRO_SPEED_SLOW = 0x02, /* Slow speed */
};
enum
{
CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE = 0x00, /* Rainbow Wave mode */
CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT = 0x01, /* Color Shift mode */
CORSAIR_CMDR_PRO_MODE_COLOR_PULSE = 0x02, /* Color Pulse mode */
CORSAIR_CMDR_PRO_MODE_COLOR_WAVE = 0x03, /* Color Wave mode */
CORSAIR_CMDR_PRO_MODE_STATIC = 0x04, /* Static mode */
CORSAIR_CMDR_PRO_MODE_TEMPERATURE = 0x05, /* Temperature mode */
CORSAIR_CMDR_PRO_MODE_VISOR = 0x06, /* Visor mode */
CORSAIR_CMDR_PRO_MODE_MARQUEE = 0x07, /* Marquee mode */
CORSAIR_CMDR_PRO_MODE_BLINK = 0x08, /* Blink mode */
CORSAIR_CMDR_PRO_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
CORSAIR_CMDR_PRO_MODE_RAINBOW = 0x0A, /* Rainbow mode */
};
enum
{
CORSAIR_NODE_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
CORSAIR_NODE_PRO_CHANNEL_2 = 0x01, /* Channel 2 */
CORSAIR_NODE_PRO_NUM_CHANNELS = 0x02 /* Number of channels */
};
class CorsairNodeProController
{
public:
CorsairNodeProController(libusb_device_handle* dev_handle);
~CorsairNodeProController();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned char channel,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2,
unsigned char red3,
unsigned char grn3,
unsigned char blu3
);
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
unsigned int channel_leds[CORSAIR_NODE_PRO_NUM_CHANNELS];
void KeepaliveThread();
private:
libusb_device_handle* dev;
void SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
);
void SendCommit();
void SendBegin
(
unsigned char channel
);
void SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
);
void SendTemperature();
void SendReset
(
unsigned char channel
);
void SendPortState
(
unsigned char channel,
unsigned char state
);
void SendBrightness();
void SendLEDCount();
void SendProtocol();
};
@@ -1,37 +0,0 @@
#include "CorsairNodeProController.h"
#include "RGBController.h"
#include "RGBController_CorsairNodePro.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#define CORSAIR_LIGHTING_NODE_PRO_VID 0x1B1C
#define CORSAIR_LIGHTING_NODE_PRO_PID 0x0C0B
/******************************************************************************************\
* *
* DetectCorsairNodeProControllers *
* *
* Detect devices supported by the Corsair Lighting Node Pro driver *
* * *
\******************************************************************************************/
void DetectCorsairNodeProControllers(std::vector<RGBController*> &rgb_controllers)
{
libusb_context * ctx;
libusb_init(&ctx);
//Look for Corsair Lighting Node Pro
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, CORSAIR_LIGHTING_NODE_PRO_VID, CORSAIR_LIGHTING_NODE_PRO_PID);
if( dev )
{
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
CorsairNodeProController* controller = new CorsairNodeProController(dev);
RGBController_CorsairNodePro* rgb_controller = new RGBController_CorsairNodePro(controller);
rgb_controllers.push_back(rgb_controller);
}
} /* DetectCorsairNodeProControllers() */
@@ -0,0 +1,637 @@
/*-----------------------------------------*\
| CorsairPeripheralController.cpp |
| |
| Driver for Corsair RGB keyboard, mouse, |
| and mousemat lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "CorsairPeripheralController.h"
#include <cstring>
using namespace std::chrono_literals;
static unsigned int keys[] = {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};
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, const char* path)
{
dev = dev_handle;
location = path;
ReadFirmwareInfo();
LightingControl();
}
CorsairPeripheralController::~CorsairPeripheralController()
{
}
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;
}
void CorsairPeripheralController::SetLEDs(std::vector<RGBColor>colors)
{
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
SetLEDsKeyboardFull(colors);
break;
case DEVICE_TYPE_MOUSE:
SetLEDsMouse(colors);
break;
case DEVICE_TYPE_MOUSEMAT:
SetLEDsMousemat(colors);
break;
case DEVICE_TYPE_HEADSET_STAND:
/*-----------------------------------------------------*\
| The logo zone of the ST100 is in the middle of the |
| base LED strip, so remap the colors so that the logo |
| is the last LED in the sequence. |
\*-----------------------------------------------------*/
std::vector<RGBColor> remap_colors;
remap_colors.resize(colors.size());
for(int i = 0; i < 9; i++)
{
remap_colors[st100[i]] = colors[i];
}
/*-----------------------------------------------------*\
| The ST100 uses the mousemat protocol |
\*-----------------------------------------------------*/
SetLEDsMousemat(remap_colors);
break;
}
}
void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colors)
{
unsigned char red_val[168];
unsigned char grn_val[168];
unsigned char blu_val[168];
/*-----------------------------------------------------*\
| Zero out buffers |
\*-----------------------------------------------------*/
memset(red_val, 0x00, sizeof( red_val ));
memset(grn_val, 0x00, sizeof( grn_val ));
memset(blu_val, 0x00, sizeof( blu_val ));
/*-----------------------------------------------------*\
| Copy red, green, and blue components into buffers |
\*-----------------------------------------------------*/
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
RGBColor color = colors[color_idx];
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);
}
}
/*-----------------------------------------------------*\
| Send red bytes |
\*-----------------------------------------------------*/
StreamPacket(1, 60, &red_val[0]);
StreamPacket(2, 60, &red_val[60]);
StreamPacket(3, 48, &red_val[120]);
SubmitKeyboardFullColors(1, 3, 1);
/*-----------------------------------------------------*\
| Send green bytes |
\*-----------------------------------------------------*/
StreamPacket(1, 60, &grn_val[0]);
StreamPacket(2, 60, &grn_val[60]);
StreamPacket(3, 48, &grn_val[120]);
SubmitKeyboardFullColors(2, 3, 1);
/*-----------------------------------------------------*\
| Send blue bytes |
\*-----------------------------------------------------*/
StreamPacket(1, 60, &blu_val[0]);
StreamPacket(2, 60, &blu_val[60]);
StreamPacket(3, 48, &blu_val[120]);
SubmitKeyboardFullColors(3, 3, 2);
}
void CorsairPeripheralController::SetLEDsMouse(std::vector<RGBColor> colors)
{
SubmitMouseColors(colors.size(), &colors[0]);
}
void CorsairPeripheralController::SetLEDsMousemat(std::vector<RGBColor> colors)
{
SubmitMousematColors(colors.size(), &colors[0]);
}
void CorsairPeripheralController::SetLEDsKeyboardLimited(std::vector<RGBColor> colors)
{
unsigned char data_pkt[216];
unsigned char red_val[144];
unsigned char grn_val[144];
unsigned char blu_val[144];
/*-----------------------------------------------------*\
| Zero out buffers |
\*-----------------------------------------------------*/
memset(data_pkt, 0x00, sizeof( data_pkt ));
memset(red_val, 0x00, sizeof( red_val ));
memset(grn_val, 0x00, sizeof( grn_val ));
memset(blu_val, 0x00, sizeof( blu_val ));
/*-----------------------------------------------------*\
| Scale color values to 9-bit |
\*-----------------------------------------------------*/
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
RGBColor color = colors[color_idx];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if( red > 7 ) red = 7;
if( grn > 7 ) grn = 7;
if( blu > 7 ) blu = 7;
red = 7 - red;
grn = 7 - grn;
blu = 7 - blu;
red_val[keys[color_idx]] = red;
grn_val[keys[color_idx]] = grn;
blu_val[keys[color_idx]] = blu;
}
/*-----------------------------------------------------*\
| Pack the color values, 2 values per byte |
\*-----------------------------------------------------*/
for(int red_idx = 0; red_idx < 72; red_idx++)
{
data_pkt[red_idx] = red_val[(red_idx * 2) + 1] << 4 | red_val[red_idx * 2];
}
for(int grn_idx = 0; grn_idx < 72; grn_idx++)
{
data_pkt[grn_idx + 72] = grn_val[(grn_idx * 2) + 1] << 4 | grn_val[grn_idx * 2];
}
for(int blu_idx = 0; blu_idx < 72; blu_idx++)
{
data_pkt[blu_idx + 144] = blu_val[(blu_idx * 2) + 1] << 4 | blu_val[blu_idx * 2];
}
/*-----------------------------------------------------*\
| Send the packets |
\*-----------------------------------------------------*/
StreamPacket(1, 60, &data_pkt[0]);
StreamPacket(2, 60, &data_pkt[60]);
StreamPacket(3, 60, &data_pkt[120]);
StreamPacket(4, 36, &data_pkt[180]);
SubmitKeyboardLimitedColors(216);
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairPeripheralController::LightingControl()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
usb_buf[0x02] = CORSAIR_PROPERTY_LIGHTING_CONTROL;
usb_buf[0x03] = CORSAIR_LIGHTING_CONTROL_SOFTWARE;
/*-----------------------------------------------------*\
| Lighting control byte needs to be 3 for keyboards and |
| headset stand, 1 for mice and mousepads |
\*-----------------------------------------------------*/
switch(type)
{
default:
case DEVICE_TYPE_KEYBOARD:
usb_buf[0x05] = 0x03;
break;
case DEVICE_TYPE_MOUSE:
usb_buf[0x05] = 0x01;
break;
case DEVICE_TYPE_MOUSEMAT:
usb_buf[0x05] = 0x04;
break;
case DEVICE_TYPE_HEADSET_STAND:
usb_buf[0x05] = 0x03;
break;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::SpecialFunctionControl()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
usb_buf[0x02] = CORSAIR_PROPERTY_SPECIAL_FUNCTION;
usb_buf[0x03] = CORSAIR_LIGHTING_CONTROL_SOFTWARE;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::ReadFirmwareInfo()
{
int actual;
char usb_buf[65];
char offset = 0;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Read Firmware Info packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_READ;
usb_buf[0x02] = CORSAIR_PROPERTY_FIRMWARE_INFO;
/*-----------------------------------------------------*\
| Send packet and try reading it using an HID read |
| If that fails, repeat the send and read the reply as |
| a feature report. |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char*)usb_buf, 65);
actual = hid_read_timeout(dev, (unsigned char*)usb_buf, 65, 1000);
if(actual == 0)
{
/*-------------------------------------------------*\
| Zero out buffer |
\*-------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-------------------------------------------------*\
| Set up Read Firmware Info packet |
\*-------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_READ;
usb_buf[0x02] = CORSAIR_PROPERTY_FIRMWARE_INFO;
hid_send_feature_report(dev, (unsigned char*)usb_buf, 65);
actual = hid_get_feature_report(dev, (unsigned char*)usb_buf, 65);
offset = 1;
}
/*-----------------------------------------------------*\
| Get device type |
| 0xC0 Device is a keyboard |
| 0xC1 Device is a mouse |
| 0xC2 Device is a mousepad or headset stand |
\*-----------------------------------------------------*/
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;
case 0xC1:
type = DEVICE_TYPE_MOUSE;
SpecialFunctionControl();
break;
case 0xC2:
{
unsigned short pid = (unsigned short)(usb_buf[0x0F] << 8) + (unsigned char)(usb_buf[0x0E]);
switch(pid)
{
case 0x0A34:
type = DEVICE_TYPE_HEADSET_STAND;
SpecialFunctionControl();
break;
default:
type = DEVICE_TYPE_MOUSEMAT;
SpecialFunctionControl();
break;
}
}
break;
default:
type = DEVICE_TYPE_UNKNOWN;
break;
}
/*-----------------------------------------------------*\
| Format firmware version string if device type is valid|
\*-----------------------------------------------------*/
if(type != DEVICE_TYPE_UNKNOWN)
{
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
(
unsigned char packet_id,
unsigned char data_sz,
unsigned char* data_ptr
)
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Stream packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_STREAM;
usb_buf[0x02] = packet_id;
usb_buf[0x03] = data_sz;
/*-----------------------------------------------------*\
| Copy in data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x05], data_ptr, data_sz);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::SubmitKeyboardFullColors
(
unsigned char color_channel,
unsigned char packet_count,
unsigned char finish_val
)
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Keyboard 24-Bit Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24;
usb_buf[0x03] = color_channel;
usb_buf[0x04] = packet_count;
usb_buf[0x05] = finish_val;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::SubmitKeyboardLimitedColors
(
unsigned char byte_count
)
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Keyboard 9-Bit Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_9;
usb_buf[0x05] = byte_count;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::SubmitMouseColors
(
unsigned char num_zones,
RGBColor * color_data
)
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Mouse Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR;
usb_buf[0x03] = num_zones;
usb_buf[0x04] = 0x00;
/*-----------------------------------------------------*\
| Copy in colors in <ZONE> <RED> <GREEN> <BLUE> order |
\*-----------------------------------------------------*/
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
{
usb_buf[(zone_idx * 4) + 5] = zone_idx;
usb_buf[(zone_idx * 4) + 6] = RGBGetRValue(color_data[zone_idx]);
usb_buf[(zone_idx * 4) + 7] = RGBGetGValue(color_data[zone_idx]);
usb_buf[(zone_idx * 4) + 8] = RGBGetBValue(color_data[zone_idx]);
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::SubmitMousematColors
(
unsigned char num_zones,
RGBColor * color_data
)
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Mouse Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR;
usb_buf[0x03] = num_zones;
usb_buf[0x04] = 0x00;
/*-----------------------------------------------------*\
| Copy in colors in <RED> <GREEN> <BLUE> order |
\*-----------------------------------------------------*/
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
{
usb_buf[(zone_idx * 3) + 5] = RGBGetRValue(color_data[zone_idx]);
usb_buf[(zone_idx * 3) + 6] = RGBGetGValue(color_data[zone_idx]);
usb_buf[(zone_idx * 3) + 7] = RGBGetBValue(color_data[zone_idx]);
}
/*-----------------------------------------------------*\
| Send packet using feature reports, as headset stand |
| seems to not update completely using HID writes |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
@@ -0,0 +1,128 @@
/*-----------------------------------------*\
| CorsairPeripheralController.h |
| |
| Definitions and types for Corsair RGB |
| keyboard, mouse, and mousemat lighting |
| controller |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
CORSAIR_COMMAND_WRITE = 0x07,
CORSAIR_COMMAND_READ = 0x0E,
CORSAIR_COMMAND_STREAM = 0x7F
};
enum
{
CORSAIR_PROPERTY_FIRMWARE_INFO = 0x01,
CORSAIR_PROPERTY_RESET = 0x02,
CORSAIR_PROPERTY_SPECIAL_FUNCTION = 0x04,
CORSAIR_PROPERTY_LIGHTING_CONTROL = 0x05,
CORSAIR_PROPERTY_HARDWARE_PROFILE = 0x13,
CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR = 0x22,
CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_9 = 0x27,
CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24 = 0x28,
};
enum
{
CORSAIR_LIGHTING_CONTROL_HARDWARE = 0x01,
CORSAIR_LIGHTING_CONTROL_SOFTWARE = 0x02
};
enum
{
CORSAIR_COLOR_CHANNEL_RED = 0x01,
CORSAIR_COLOR_CHANNEL_GREEN = 0x02,
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, const char* path);
~CorsairPeripheralController();
int GetLogicalLayout();
int GetPhysicalLayout();
device_type GetDeviceType();
std::string GetDeviceLocation();
std::string GetFirmwareString();
void SetLEDs(std::vector<RGBColor> colors);
void SetLEDsKeyboardFull(std::vector<RGBColor> colors);
void SetLEDsKeyboardLimited(std::vector<RGBColor> colors);
void SetLEDsMouse(std::vector<RGBColor> colors);
void SetLEDsMousemat(std::vector<RGBColor> colors);
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();
void ReadFirmwareInfo();
void StreamPacket
(
unsigned char packet_id,
unsigned char data_sz,
unsigned char* data_ptr
);
void SubmitKeyboardFullColors
(
unsigned char color_channel,
unsigned char packet_count,
unsigned char finish_val
);
void SubmitKeyboardLimitedColors
(
unsigned char byte_count
);
void SubmitMouseColors
(
unsigned char num_zones,
RGBColor * color_data
);
void SubmitMousematColors
(
unsigned char num_zones,
RGBColor * color_data
);
};
@@ -0,0 +1,167 @@
#include "Detector.h"
#include "CorsairPeripheralController.h"
#include "RGBController.h"
#include "RGBController_CorsairPeripheral.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Corsair vendor ID |
\*-----------------------------------------------------*/
#define CORSAIR_VID 0x1B1C
/*-----------------------------------------------------*\
| Keyboard product IDs |
| List taken from ckb-next |
| Non-RGB keyboards were omitted from this list |
\*-----------------------------------------------------*/
#define CORSAIR_K55_RGB_PID 0x1B3D
#define CORSAIR_K65_RGB_PID 0x1B17
#define CORSAIR_K65_LUX_RGB_PID 0x1B37
#define CORSAIR_K65_RGB_RAPIDFIRE_PID 0x1B39
#define CORSAIR_K68_RGB 0x1B4F
#define CORSAIR_K70_RGB_PID 0x1B13
#define CORSAIR_K70_LUX_RGB_PID 0x1B33
#define CORSAIR_K70_RGB_RAPIDFIRE_PID 0x1B38
#define CORSAIR_K70_RGB_MK2_PID 0x1B49
#define CORSAIR_K70_RGB_MK2_SE_PID 0x1B6B
#define CORSAIR_K70_RGB_MK2_LP_PID 0x1B55
#define CORSAIR_K95_RGB_PID 0x1B11
#define CORSAIR_K95_PLATINUM_PID 0x1B2D
#define CORSAIR_STRAFE_PID 0x1B20
#define CORSAIR_STRAFE_MK2_PID 0x1B48
/*-----------------------------------------------------*\
| Mouse product IDs |
| List taken from ckb-next |
\*-----------------------------------------------------*/
#define CORSAIR_GLAIVE_RGB_PRO_PID 0x1B74
#define CORSAIR_HARPOON_RGB_PID 0x1B3C
#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 |
| List taken from ckb-next |
\*-----------------------------------------------------*/
#define CORSAIR_MM800_RGB_POLARIS_PID 0x1B3B
/*-----------------------------------------------------*\
| Headset Stand product IDs |
| List taken from ckb-next |
\*-----------------------------------------------------*/
#define CORSAIR_ST100_PID 0x0A34
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned char usb_interface;
const char * name;
} corsair_node_device;
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const corsair_node_device device_list[] =
{
/*-----------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-----------------------------------------------------------------------------------------------------*/
// { CORSAIR_VID, CORSAIR_K55_RGB_PID, 1, "Corsair K55 RGB" }, //Not per-key, disabled for now
{ CORSAIR_VID, CORSAIR_K65_RGB_PID, 1, "Corsair K65 RGB" },
{ CORSAIR_VID, CORSAIR_K65_LUX_RGB_PID, 1, "Corsair K65 LUX RGB" },
{ CORSAIR_VID, CORSAIR_K65_RGB_RAPIDFIRE_PID, 1, "Corsair K65 RGB RAPIDFIRE" },
{ CORSAIR_VID, CORSAIR_K68_RGB, 1, "Corsair K68 RGB" },
{ CORSAIR_VID, CORSAIR_K70_RGB_PID, 1, "Corsair K70 RGB" },
{ CORSAIR_VID, CORSAIR_K70_LUX_RGB_PID, 1, "Corsair K70 LUX RGB" },
{ CORSAIR_VID, CORSAIR_K70_RGB_RAPIDFIRE_PID, 1, "Corsair K70 RGB RAPIDFIRE" },
{ CORSAIR_VID, CORSAIR_K70_RGB_MK2_PID, 1, "Corsair K70 RGB MK.2" },
{ CORSAIR_VID, CORSAIR_K70_RGB_MK2_SE_PID, 1, "Corsair K70 RGB MK.2 SE" },
{ CORSAIR_VID, CORSAIR_K70_RGB_MK2_LP_PID, 1, "Corsair K70 RGB MK.2 Low Profile" },
{ CORSAIR_VID, CORSAIR_K95_RGB_PID, 1, "Corsair K95 RGB" },
{ CORSAIR_VID, CORSAIR_K95_PLATINUM_PID, 1, "Corsair K95 RGB PLATINUM" },
{ CORSAIR_VID, CORSAIR_STRAFE_PID, 1, "Corsair Strafe" },
{ CORSAIR_VID, CORSAIR_STRAFE_MK2_PID, 1, "Corsair Strafe MK.2" },
/*-----------------------------------------------------------------------------------------------------*\
| Mice |
\*-----------------------------------------------------------------------------------------------------*/
{ CORSAIR_VID, CORSAIR_GLAIVE_RGB_PRO_PID, 1, "Corsair Glaive RGB PRO" },
{ CORSAIR_VID, CORSAIR_HARPOON_RGB_PID, 1, "Corsair Harpoon RGB" },
{ 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 |
\*-----------------------------------------------------------------------------------------------------*/
{ CORSAIR_VID, CORSAIR_MM800_RGB_POLARIS_PID, 0, "Corsair MM800 RGB Polaris" },
/*-----------------------------------------------------------------------------------------------------*\
| Headset Stands |
\*-----------------------------------------------------------------------------------------------------*/
{ CORSAIR_VID, CORSAIR_ST100_PID, 0, "Corsair ST100 RGB" }
};
/******************************************************************************************\
* *
* DetectCorsairPeripheralControllers *
* *
* Tests the USB address to see if a Corsair RGB Keyboard controller exists there. *
* *
\******************************************************************************************/
void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device* dev;
hid_init();
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
{
dev = NULL;
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
//Look for Corsair RGB Peripheral
while(info)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
#ifdef USE_HID_USAGE
&&(info->product_id == device_list[device_idx].usb_pid)
&&(info->usage_page == 0xFFC2))
#else
&&(info->product_id == device_list[device_idx].usb_pid)
&&(info->interface_number == device_list[device_idx].usb_interface))
#endif
{
dev = hid_open_path(info->path);
if( dev )
{
CorsairPeripheralController* controller = new CorsairPeripheralController(dev, info->path);
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
{
RGBController_CorsairPeripheral* rgb_controller = new RGBController_CorsairPeripheral(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
}
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()
{
}
@@ -0,0 +1,36 @@
/*-----------------------------------------*\
| RGBController_CorsairPeripheral.h |
| |
| Generic RGB Interface for Corsair RGB |
| keyboard, mouse, and mousemat devices |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CorsairPeripheralController.h"
class RGBController_CorsairPeripheral : public RGBController
{
public:
RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr);
~RGBController_CorsairPeripheral();
int physical_layout;
int logical_layout;
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
CorsairPeripheralController* corsair;
};
@@ -1,142 +0,0 @@
#include "CorsairProController.h"
#include "RGBController.h"
#include "RGBController_CorsairPro.h"
#include "i2c_smbus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
/******************************************************************************************\
* *
* TestForCorsairProController *
* *
* Tests the given address to see if a Corsair Pro controller exists there. *
* *
\******************************************************************************************/
bool TestForCorsairProController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
res = bus->i2c_smbus_read_byte_data(address, 0x43);
if (res != 0x1C)
{
pass = false;
}
res = bus->i2c_smbus_read_byte_data(address, 0x44);
if (res != 0x03)
{
pass = false;
}
}
Sleep(10);
return(pass);
} /* TestForCorsairProController() */
/******************************************************************************************\
* *
* DetectCorsairProControllers *
* *
* Detect Corsair Pro controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where Aura device is connected *
* dev - I2C address of Aura device *
* *
\******************************************************************************************/
void DetectCorsairProControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
{
CorsairProController* new_corsair_pro;
RGBController_CorsairPro* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Check for Corsair controller at 0x58
if (TestForCorsairProController(busses[bus], 0x58))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x58);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x59
if (TestForCorsairProController(busses[bus], 0x59))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x59);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5A
if (TestForCorsairProController(busses[bus], 0x5A))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5A);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5B
if (TestForCorsairProController(busses[bus], 0x5B))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5B);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5C
if (TestForCorsairProController(busses[bus], 0x5C))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5C);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5D
if (TestForCorsairProController(busses[bus], 0x5D))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5D);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairProController(busses[bus], 0x5E))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5E);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5F
if (TestForCorsairProController(busses[bus], 0x5F))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5F);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectCorsairProControllers() */
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| CorsairController.h |
| CorsairVengeanceController.h |
| |
| Driver for Corsair Vengeance RGB RAM |
| lighting controller |
@@ -7,10 +7,10 @@
| Adam Honse (CalcProgrammer1) 3/8/2019 |
\*-----------------------------------------*/
#include "CorsairController.h"
#include "CorsairVengeanceController.h"
#include <cstring>
CorsairController::CorsairController(i2c_smbus_interface* bus, corsair_dev_id dev)
CorsairVengeanceController::CorsairVengeanceController(i2c_smbus_interface* bus, corsair_dev_id dev)
{
this->bus = bus;
this->dev = dev;
@@ -19,32 +19,32 @@ CorsairController::CorsairController(i2c_smbus_interface* bus, corsair_dev_id de
led_count = 1;
}
CorsairController::~CorsairController()
CorsairVengeanceController::~CorsairVengeanceController()
{
}
std::string CorsairController::GetDeviceName()
std::string CorsairVengeanceController::GetDeviceName()
{
return(device_name);
}
std::string CorsairController::GetDeviceLocation()
std::string CorsairVengeanceController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
return("I2C: " + return_string);
}
unsigned int CorsairController::GetLEDCount()
unsigned int CorsairVengeanceController::GetLEDCount()
{
return(led_count);
}
void CorsairController::SetLEDColor(unsigned char red, unsigned char green, unsigned char blue)
void CorsairVengeanceController::SetLEDColor(unsigned char red, unsigned char green, unsigned char blue)
{
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_FADE_TIME, 0x00);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_RED_VAL, red);
@@ -53,7 +53,7 @@ void CorsairController::SetLEDColor(unsigned char red, unsigned char green, unsi
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_MODE, CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
}
void CorsairController::SetMode(unsigned char /*mode*/)
void CorsairVengeanceController::SetMode(unsigned char /*mode*/)
{
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_MODE, CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
}
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| CorsairController.h |
| CorsairVengeanceController.h |
| |
| Definitions and types for Corsair |
| Vengeance RGB RAM lighting controller |
@@ -33,11 +33,11 @@ enum
CORSAIR_NUMBER_MODES /* Number of Corsair modes */
};
class CorsairController
class CorsairVengeanceController
{
public:
CorsairController(i2c_smbus_interface* bus, corsair_dev_id dev);
~CorsairController();
CorsairVengeanceController(i2c_smbus_interface* bus, corsair_dev_id dev);
~CorsairVengeanceController();
std::string GetDeviceName();
std::string GetDeviceLocation();
@@ -0,0 +1,132 @@
#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>
/******************************************************************************************\
* *
* TestForCorsairVengeanceController *
* *
* Tests the given address to see if a Corsair controller exists there. *
* *
\******************************************************************************************/
bool TestForCorsairVengeanceController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
for (int i = 0xA0; i < 0xB0; i++)
{
res = bus->i2c_smbus_read_byte_data(address, i);
if (res != 0xBA)
{
pass = false;
}
}
}
return(pass);
} /* TestForCorsairVengeanceController() */
/******************************************************************************************\
* *
* DetectCorsairVengeanceControllers *
* *
* Detect Corsair controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where Aura device is connected *
* dev - I2C address of Aura device *
* *
\******************************************************************************************/
void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
{
CorsairVengeanceController* new_corsair;
RGBController_CorsairVengeance* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
// 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 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 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 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);
}
}
}
} /* DetectCorsairVengeanceControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance", DetectCorsairVengeanceControllers);
@@ -0,0 +1,107 @@
/*-----------------------------------------*\
| RGBController_CorsairVengeance.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| Corsair Vengeance RGB driver |
| |
| Adam Honse (CalcProgrammer1) 6/13/2019 |
\*-----------------------------------------*/
#include "RGBController_CorsairVengeance.h"
RGBController_CorsairVengeance::RGBController_CorsairVengeance(CorsairVengeanceController* corsair_ptr)
{
corsair = corsair_ptr;
name = corsair->GetDeviceName();
type = DEVICE_TYPE_DRAM;
description = "Corsair Vengeance RGB Device";
location = corsair->GetDeviceLocation();
mode Static;
Static.name = "Static";
Static.value = CORSAIR_VENGEANCE_RGB_MODE_SINGLE;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Fade;
Fade.name = "Fade";
Fade.value = CORSAIR_VENGEANCE_RGB_MODE_FADE;
Fade.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Fade.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Fade);
mode Pulse;
Pulse.name = "Pulse";
Pulse.value = CORSAIR_VENGEANCE_RGB_MODE_PULSE;
Pulse.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Pulse.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Pulse);
SetupZones();
}
void RGBController_CorsairVengeance::SetupZones()
{
/*---------------------------------------------------------*\
| Create a single zone |
\*---------------------------------------------------------*/
zone new_zone;
new_zone.name = "Corsair Zone";
new_zone.type = ZONE_TYPE_SINGLE;
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 LED";
leds.push_back(*new_led);
}
SetupColors();
}
void RGBController_CorsairVengeance::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CorsairVengeance::DeviceUpdateLEDs()
{
RGBColor color = colors[0];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
corsair->SetLEDColor(red, grn, blu);
}
void RGBController_CorsairVengeance::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairVengeance::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairVengeance::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairVengeance::DeviceUpdateMode()
{
corsair->SetMode(modes[active_mode].value);
}
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| RGBController_Corsair.h |
| RGBController_CorsairVengeance.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| Corsair Vengeance RGB driver |
@@ -10,19 +10,24 @@
#pragma once
#include "RGBController.h"
#include "CorsairController.h"
#include "CorsairVengeanceController.h"
class RGBController_Corsair : public RGBController
class RGBController_CorsairVengeance : public RGBController
{
public:
RGBController_Corsair(CorsairController* corsair_ptr);
void UpdateLEDs();
RGBController_CorsairVengeance(CorsairVengeanceController* corsair_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
void DeviceUpdateMode();
private:
CorsairController* corsair;
CorsairVengeanceController* corsair;
};
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| CorsairProController.cpp |
| CorsairVengeanceProController.cpp |
| |
| Definitions and types for Corsair |
| Vengeance Pro RGB RAM lighting controller|
@@ -7,21 +7,12 @@
| Adam Honse (CalcProgrammer1) 6/30/2019 |
\*-----------------------------------------*/
#include "CorsairProController.h"
#include "CorsairVengeanceProController.h"
#include <cstring>
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
using namespace std::chrono_literals;
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
CorsairProController::CorsairProController(i2c_smbus_interface* bus, corsair_dev_id dev)
CorsairVengeanceProController::CorsairVengeanceProController(i2c_smbus_interface* bus, corsair_dev_id dev)
{
this->bus = bus;
this->dev = dev;
@@ -39,37 +30,37 @@ CorsairProController::CorsairProController(i2c_smbus_interface* bus, corsair_dev
}
}
CorsairProController::~CorsairProController()
CorsairVengeanceProController::~CorsairVengeanceProController()
{
}
std::string CorsairProController::GetDeviceName()
std::string CorsairVengeanceProController::GetDeviceName()
{
return(device_name);
}
std::string CorsairProController::GetDeviceLocation()
std::string CorsairVengeanceProController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
return("I2C: " + return_string);
}
unsigned int CorsairProController::GetLEDCount()
unsigned int CorsairVengeanceProController::GetLEDCount()
{
return(led_count);
}
unsigned char CorsairProController::GetEffect()
unsigned char CorsairVengeanceProController::GetEffect()
{
return(effect_mode);
}
void CorsairProController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
void CorsairVengeanceProController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
{
for (unsigned int i = 0; i < led_count; i++)
{
@@ -79,19 +70,19 @@ void CorsairProController::SetAllColors(unsigned char red, unsigned char green,
}
}
void CorsairProController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
void CorsairVengeanceProController::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
led_red[led] = red;
led_green[led] = green;
led_blue[led] = blue;
}
void CorsairProController::ApplyColors()
void CorsairVengeanceProController::ApplyColors()
{
bus->i2c_smbus_write_byte_data(dev, 0x26, 0x02);
Sleep(1);
std::this_thread::sleep_for(1ms);
bus->i2c_smbus_write_byte_data(dev, 0x21, 0x00);
Sleep(1);
std::this_thread::sleep_for(1ms);
for (int i = 0; i < 10; i++)
{
@@ -104,7 +95,7 @@ void CorsairProController::ApplyColors()
bus->i2c_smbus_write_byte_data(dev, 0x82, 0x02);
}
void CorsairProController::SetEffect(unsigned char mode,
void CorsairVengeanceProController::SetEffect(unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
@@ -119,9 +110,9 @@ void CorsairProController::SetEffect(unsigned char mode,
effect_mode = mode;
bus->i2c_smbus_write_byte_data(dev, 0x26, 0x01);
Sleep(1);
std::this_thread::sleep_for(1ms);
bus->i2c_smbus_write_byte_data(dev, 0x21, 0x00);
Sleep(1);
std::this_thread::sleep_for(1ms);
unsigned char random_byte;
@@ -159,13 +150,13 @@ void CorsairProController::SetEffect(unsigned char mode,
WaitReady();
}
bool CorsairProController::WaitReady()
bool CorsairVengeanceProController::WaitReady()
{
int i = 0;
while (bus->i2c_smbus_read_byte_data(dev, 0x41) != 0x00)
{
i++;
Sleep(1);
std::this_thread::sleep_for(1ms);
}
return false;
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| CorsairProController.h |
| CorsairVengeanceProController.h |
| |
| Definitions and types for Corsair |
| Vengeance Pro RGB RAM lighting controller|
@@ -60,11 +60,11 @@ enum
CORSAIR_PRO_DIRECTION_HORIZONTAL = 0x03, /* Horizontal direction */
};
class CorsairProController
class CorsairVengeanceProController
{
public:
CorsairProController(i2c_smbus_interface* bus, corsair_dev_id dev);
~CorsairProController();
CorsairVengeanceProController(i2c_smbus_interface* bus, corsair_dev_id dev);
~CorsairVengeanceProController();
std::string GetDeviceName();
std::string GetDeviceLocation();
@@ -0,0 +1,140 @@
#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>
using namespace std::chrono_literals;
/******************************************************************************************\
* *
* TestForCorsairVengeanceProController *
* *
* Tests the given address to see if a Corsair Pro controller exists there. *
* *
\******************************************************************************************/
bool TestForCorsairVengeanceProController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
res = bus->i2c_smbus_read_byte_data(address, 0x43);
if (res != 0x1C)
{
pass = false;
}
res = bus->i2c_smbus_read_byte_data(address, 0x44);
if (!((res == 0x03) || (res == 0x04)))
{
pass = false;
}
}
std::this_thread::sleep_for(10ms);
return(pass);
} /* TestForCorsairVengeanceProController() */
/******************************************************************************************\
* *
* DetectCorsairVengeanceProControllers *
* *
* Detect Corsair Vengeance Pro controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where Aura device is connected *
* dev - I2C address of Aura device *
* *
\******************************************************************************************/
void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
{
CorsairVengeanceProController* new_corsair_pro;
RGBController_CorsairVengeancePro* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
// 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 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 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 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);
}
}
}
} /* DetectCorsairVengeanceProControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance Pro", DetectCorsairVengeanceProControllers);
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| RGBController_CorsairPro.cpp |
| RGBController_CorsairVengeancePro.cpp |
| |
| Generic RGB Interface for OpenAuraSDK |
| Corsair Vengeance Pro RGB driver |
@@ -7,46 +7,26 @@
| Adam Honse (CalcProgrammer1) 6/30/2019 |
\*-----------------------------------------*/
#include "RGBController_CorsairPro.h"
#include "RGBController_CorsairVengeancePro.h"
void RGBController_CorsairPro::UpdateLEDs()
{
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_CorsairPro::UpdateZoneLEDs(int zone)
{
UpdateLEDs();
}
void RGBController_CorsairPro::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();
}
RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair_ptr)
RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVengeanceProController* corsair_ptr)
{
corsair = corsair_ptr;
name = corsair->GetDeviceName();
location = corsair->GetDeviceLocation();
name = corsair->GetDeviceName();
type = DEVICE_TYPE_DRAM;
description = "Corsair Vengeance Pro RGB Device";
location = corsair->GetDeviceLocation();
type = DEVICE_TYPE_DRAM;
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";
@@ -97,8 +77,8 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
ColorWave.direction = MODE_DIRECTION_DOWN;
ColorWave.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorWave.colors.resize(2);
modes.push_back(ColorWave);
modes.push_back(ColorWave);
mode Visor;
Visor.name = "Visor";
Visor.value = CORSAIR_PRO_MODE_VISOR;
@@ -139,7 +119,7 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
Marquee.colors.resize(1);
modes.push_back(Marquee);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CORSAIR_PRO_MODE_RAINBOW;
@@ -149,7 +129,7 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
Rainbow.speed = CORSAIR_PRO_SPEED_SLOW;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Sequential;
Sequential.name = "Sequential";
Sequential.value = CORSAIR_PRO_MODE_SEQUENTIAL;
@@ -164,54 +144,84 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
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;
}
colors.resize(corsair->GetLEDCount());
void RGBController_CorsairVengeancePro::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone new_zone;
new_zone.name = "Corsair Pro 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);
for (unsigned int i = 0; i < corsair->GetLEDCount(); i++)
/*---------------------------------------------------------*\
| 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 Pro LED";
new_led->name = "Corsair Pro LED ";
new_led->name.append(std::to_string(led_idx));
leds.push_back(*new_led);
}
zone new_zone;
SetupColors();
}
new_zone.name = "Corsair Pro Zone";
new_zone.type = ZONE_TYPE_LINEAR;
void RGBController_CorsairVengeancePro::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
std::vector<int> zone_row;
for (unsigned int i = 0; i < corsair->GetLEDCount(); i++)
void RGBController_CorsairVengeancePro::DeviceUpdateLEDs()
{
for (std::size_t led = 0; led < colors.size(); led++)
{
zone_row.push_back(i);
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);
}
new_zone.map.push_back(zone_row);
zones.push_back(new_zone);
corsair->ApplyColors();
}
void RGBController_CorsairPro::SetCustomMode()
void RGBController_CorsairVengeancePro::UpdateZoneLEDs(int /*zone*/)
{
active_mode = 9;
DeviceUpdateLEDs();
}
void RGBController_CorsairPro::UpdateMode()
void RGBController_CorsairVengeancePro::UpdateSingleLED(int led)
{
unsigned int corsair_direction;
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_CorsairVengeancePro::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairVengeancePro::DeviceUpdateMode()
{
unsigned int corsair_direction = 0;
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
unsigned char mode_colors[6];
@@ -237,6 +247,13 @@ void RGBController_CorsairPro::UpdateMode()
break;
}
mode_colors[0] = 0;
mode_colors[1] = 0;
mode_colors[2] = 0;
mode_colors[3] = 0;
mode_colors[4] = 0;
mode_colors[5] = 0;
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
mode_colors[0] = RGBGetRValue(modes[active_mode].colors[0]);
@@ -248,7 +265,7 @@ void RGBController_CorsairPro::UpdateMode()
mode_colors[3] = RGBGetRValue(modes[active_mode].colors[1]);
mode_colors[4] = RGBGetGValue(modes[active_mode].colors[1]);
mode_colors[5] = RGBGetBValue(modes[active_mode].colors[1]);
}
}
}
corsair->SetEffect(modes[active_mode].value,
@@ -1,5 +1,5 @@
/*-----------------------------------------*\
| RGBController_CorsairPro.h |
| RGBController_CorsairVengeancePro.h |
| |
| Generic RGB Interface for OpenAuraSDK |
| Corsair Vengeance Pro RGB driver |
@@ -10,19 +10,24 @@
#pragma once
#include "RGBController.h"
#include "CorsairProController.h"
#include "CorsairVengeanceProController.h"
class RGBController_CorsairPro : public RGBController
class RGBController_CorsairVengeancePro : public RGBController
{
public:
RGBController_CorsairPro(CorsairProController* corsair_ptr);
void UpdateLEDs();
RGBController_CorsairVengeancePro(CorsairVengeanceProController* corsair_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
void DeviceUpdateMode();
private:
CorsairProController* corsair;
CorsairVengeanceProController* corsair;
};
@@ -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()
@@ -52,16 +52,15 @@ void CrucialController::SetAllColorsDirect(RGBColor* colors)
SendDirectColors(colors);
}
void CrucialController::SendEffectColors(unsigned char red, unsigned char green, unsigned char blue)
void CrucialController::SetAllColorsEffect(RGBColor* colors)
{
CrucialRegisterWrite(0x82E9, 0xFF);
CrucialRegisterWrite(0x82EA, 0x00);
CrucialRegisterWrite(0x82EB, 0x00);
CrucialRegisterWrite(0x82EC, 0x00);
CrucialRegisterWrite(0x82ED, red);
CrucialRegisterWrite(0x82EE, green);
CrucialRegisterWrite(0x82EF, blue);
CrucialRegisterWrite(0x82F0, 0x01);
for(int led_idx = 0; led_idx < 8; led_idx++)
{
unsigned char red = RGBGetRValue(colors[led_idx]);
unsigned char grn = RGBGetGValue(colors[led_idx]);
unsigned char blu = RGBGetBValue(colors[led_idx]);
SendEffectColor(led_idx, red, grn, blu);
}
}
void CrucialController::SendBrightness(unsigned char brightness)
@@ -131,3 +130,21 @@ void CrucialController::CrucialRegisterWrite(crucial_register reg, unsigned char
bus->i2c_smbus_write_byte_data(dev, 0x01, val);
}
void CrucialController::SendEffectColor
(
unsigned int led_idx,
unsigned int red,
unsigned int green,
unsigned int blue
)
{
CrucialRegisterWrite(0x82E9, (1 << led_idx));
CrucialRegisterWrite(0x82EA, 0x00);
CrucialRegisterWrite(0x82EB, 0x00);
CrucialRegisterWrite(0x82EC, 0x00);
CrucialRegisterWrite(0x82ED, red);
CrucialRegisterWrite(0x82EE, green);
CrucialRegisterWrite(0x82EF, blue);
CrucialRegisterWrite(0x82F0, 0x01);
}
@@ -42,6 +42,7 @@ public:
std::string GetDeviceLocation();
unsigned int GetLEDCount();
void SetAllColorsDirect(RGBColor* colors);
void SetAllColorsEffect(RGBColor* colors);
void SetMode(unsigned char mode);
unsigned char CrucialRegisterRead(crucial_register reg);
@@ -55,8 +56,15 @@ private:
i2c_smbus_interface * bus;
crucial_dev_id dev;
void SendEffectColor
(
unsigned int led_idx,
unsigned int red,
unsigned int green,
unsigned int blue
);
void SendDirectColors(RGBColor* color_buf);
void SendEffectColors(unsigned char red, unsigned char green, unsigned char blue);
void SendBrightness(unsigned char brightness);
void SendEffectMode(unsigned char mode, unsigned char speed);
};
@@ -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,183 @@
/*-----------------------------------------*\
| RGBController_Crucial.cpp |
| |
| Generic RGB Interface for Crucial |
| Ballistix RGB controller |
| |
| Adam Honse (CalcProgrammer1) 1/19/2020 |
\*-----------------------------------------*/
#include "RGBController_Crucial.h"
RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr)
{
crucial = crucial_ptr;
name = "Crucial DRAM";
type = DEVICE_TYPE_DRAM;
description = "Crucial DRAM Device";
location = crucial->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);
mode Shift;
Shift.name = "Shift";
Shift.value = CRUCIAL_MODE_SHIFT;
Shift.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Shift.colors_min = 1;
Shift.colors_max = 1;
Shift.color_mode = MODE_COLORS_MODE_SPECIFIC;
Shift.colors.resize(1);
modes.push_back(Shift);
mode GradientShift;
GradientShift.name = "Gradient Shift";
GradientShift.value = CRUCIAL_MODE_GRADIENT_SHIFT;
GradientShift.flags = 0;
GradientShift.color_mode = MODE_COLORS_NONE;
modes.push_back(GradientShift);
mode Fill;
Fill.name = "Fill";
Fill.value = CRUCIAL_MODE_FILL;
Fill.flags = 0;
Fill.color_mode = MODE_COLORS_NONE;
modes.push_back(Fill);
mode Stack;
Stack.name = "Stack";
Stack.value = CRUCIAL_MODE_STACK;
Stack.flags = 0;
Stack.color_mode = MODE_COLORS_NONE;
modes.push_back(Stack);
mode DoubleStack;
DoubleStack.name = "Double Stack";
DoubleStack.value = CRUCIAL_MODE_DOUBLE_STACK;
DoubleStack.flags = 0;
DoubleStack.color_mode = MODE_COLORS_NONE;
modes.push_back(DoubleStack);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CRUCIAL_MODE_BREATHING;
Breathing.flags = 0;
Breathing.color_mode = MODE_COLORS_NONE;
modes.push_back(Breathing);
mode MotionPoint;
MotionPoint.name = "Motion Point";
MotionPoint.value = CRUCIAL_MODE_MOTION_POINT;
MotionPoint.flags = 0;
MotionPoint.color_mode = MODE_COLORS_NONE;
modes.push_back(MotionPoint);
mode InsideOut;
InsideOut.name = "Inside Out";
InsideOut.value = CRUCIAL_MODE_INSIDE_OUT;
InsideOut.flags = 0;
InsideOut.color_mode = MODE_COLORS_NONE;
modes.push_back(InsideOut);
mode ColorStep;
ColorStep.name = "Color Step";
ColorStep.value = CRUCIAL_MODE_COLOR_STEP;
ColorStep.flags = 0;
ColorStep.color_mode = MODE_COLORS_NONE;
modes.push_back(ColorStep);
mode WaterWave;
WaterWave.name = "Water Wave (Color Blending)";
WaterWave.value = CRUCIAL_MODE_WATER_WAVE;
WaterWave.flags = 0;
WaterWave.color_mode = MODE_COLORS_NONE;
modes.push_back(WaterWave);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = CRUCIAL_MODE_FLASHING;
Flashing.flags = 0;
Flashing.color_mode = MODE_COLORS_NONE;
modes.push_back(Flashing);
mode Static;
Static.name = "Static";
Static.value = CRUCIAL_MODE_STATIC;
Static.flags = 0;
Static.color_mode = MODE_COLORS_NONE;
modes.push_back(Static);
SetupZones();
}
void RGBController_Crucial::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zone |
\*---------------------------------------------------------*/
zone new_zone;
new_zone.name = "DRAM";
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;
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.name = "DRAM LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_Crucial::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_Crucial::DeviceUpdateLEDs()
{
if(modes[active_mode].value == 0xFFFF)
{
crucial->SetAllColorsDirect(&colors[0]);
}
else
{
crucial->SetAllColorsEffect(&colors[0]);
}
}
void RGBController_Crucial::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_Crucial::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_Crucial::SetCustomMode()
{
active_mode = 0;
}
void RGBController_Crucial::DeviceUpdateMode()
{
crucial->SetMode(modes[active_mode].value);
}
@@ -16,12 +16,17 @@ class RGBController_Crucial : public RGBController
{
public:
RGBController_Crucial(CrucialController* crucial_ptr);
void UpdateLEDs();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
void DeviceUpdateMode();
private:
CrucialController* crucial;
@@ -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);
@@ -0,0 +1,193 @@
/*-----------------------------------------*\
| DuckyKeyboardController.cpp |
| |
| Driver for Ducky RGB keyboardlighting |
| controller |
| |
| Adam Honse (CalcProgrammer1) 7/4/2020 |
\*-----------------------------------------*/
#include <cstring>
#include "DuckyKeyboardController.h"
DuckyKeyboardController::DuckyKeyboardController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
SendInitialize();
}
DuckyKeyboardController::~DuckyKeyboardController()
{
}
std::string DuckyKeyboardController::GetDeviceLocation()
{
return(location);
}
void DuckyKeyboardController::SendColors
(
unsigned char* color_data,
unsigned int color_data_size
)
{
unsigned int bytes_sent;
unsigned char* color_data_ptr = color_data;
SendInitializeColorPacket();
for(int i = 0; i < 8; i++)
{
bytes_sent = SendColorDataPacket(i, color_data_ptr, color_data_size);
color_data_ptr += bytes_sent;
color_data_size -= bytes_sent;
}
SendTerminateColorPacket();
}
void DuckyKeyboardController::SendInitialize()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Initialize Direct Mode packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x41;
usb_buf[0x02] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void DuckyKeyboardController::SendInitializeColorPacket()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Initialize Color packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x56;
usb_buf[0x02] = 0x81;
usb_buf[0x05] = 0x01;
usb_buf[0x09] = 0x08;
usb_buf[0x0D] = 0xAA;
usb_buf[0x0E] = 0xAA;
usb_buf[0x0F] = 0xAA;
usb_buf[0x10] = 0xAA;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
unsigned int DuckyKeyboardController::SendColorDataPacket
(
unsigned char packet_id,
unsigned char* color_data,
unsigned int color_size
)
{
unsigned int bytes_sent;
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Color Data packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x56;
usb_buf[0x02] = 0x83;
usb_buf[0x03] = packet_id;
if(packet_id == 0x00)
{
usb_buf[0x05] = 0x01;
usb_buf[0x09] = 0x80;
usb_buf[0x0A] = 0x01;
usb_buf[0x0C] = 0xC1;
usb_buf[0x11] = 0xFF;
usb_buf[0x12] = 0xFF;
usb_buf[0x13] = 0xFF;
usb_buf[0x14] = 0xFF;
}
/*-----------------------------------------------------*\
| Copy in color data |
\*-----------------------------------------------------*/
if(packet_id == 0x00)
{
bytes_sent = 65 - 0x19;
if(color_size < bytes_sent)
{
bytes_sent = color_size;
}
memcpy(&usb_buf[0x19], color_data, bytes_sent);
}
else
{
bytes_sent = 65 - 0x05;
if(color_size < bytes_sent)
{
bytes_sent = color_size;
}
memcpy(&usb_buf[0x05], color_data, bytes_sent);
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
return(bytes_sent);
}
void DuckyKeyboardController::SendTerminateColorPacket()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Terminate Color packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x51;
usb_buf[0x02] = 0x28;
usb_buf[0x05] = 0xFF;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
@@ -0,0 +1,44 @@
/*-----------------------------------------*\
| DuckyKeyboardController.h |
| |
| Definitions and types for Ducky RGB |
| keyboard lighting controller |
| |
| Adam Honse (CalcProgrammer1) 7/4/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
class DuckyKeyboardController
{
public:
DuckyKeyboardController(hid_device* dev_handle, const char* path);
~DuckyKeyboardController();
std::string GetDeviceLocation();
void SendColors
(
unsigned char* color_data,
unsigned int color_data_size
);
private:
hid_device* dev;
std::string location;
void SendInitialize();
void SendInitializeColorPacket();
unsigned int SendColorDataPacket
(
unsigned char packet_id,
unsigned char* color_data,
unsigned int color_size
);
void SendTerminateColorPacket();
};

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