Compare commits

..
Author SHA1 Message Date
Adam Honse b86be6b75d Use RGBControllerInterface for plugin API 2026-05-23 15:17:05 -05:00
Adam Honse c11090a4cf Add another thread in NetworkClient for handling ProfileManager requests outside of the main listener thread, to avoid deadlocking the waiting receivers 2026-05-20 08:13:17 -05:00
Adam Honse a69390e5a8 Update translation files and fix some translation related issues 2026-05-14 23:21:10 -05:00
Adam Honse a900d5c402 NetworkClient cleanup and internal API standardization 2026-05-14 17:26:12 -05:00
Adam Honse f870dcdc3a NetworkServer cleanup and internal API standardization 2026-05-14 17:26:12 -05:00
Adam Honse 9a105ccdaf Add indication of standalone or local client mode to about page 2026-05-14 17:26:12 -05:00
Adam Honse 1faa2b1d31 Implement network request to get list of I2C buses so that the Get Hardware IDs dialog works in local client mode 2026-05-14 17:26:12 -05:00
Adam Honse 91923f3a82 Add option to force compact tabs and option to move tabs from left to top 2026-05-14 17:26:12 -05:00
Adam Honse fcb594cb0e More LogManager cleanup, default to a log file count of 10, fix bug in log rotation 2026-05-14 17:26:12 -05:00
Adam Honse 32f0f1a9a2 Log manager SDK protocol 2026-05-14 17:26:12 -05:00
Adam Honse 4d379b97c6 Log Console Updates 2026-05-14 17:26:12 -05:00
Adam Honse a3e5296bf2 LogManager cleanup 2026-05-14 17:26:12 -05:00
Adam Honse 072d27d9dd Settings Rework
* Add JSON string configuration field to RGBController to store device-specific configurations
    * This JSON string holds both configuration and schema
    * Add settings schema tracking to SettingsManager
    * Implement dynamic settings widget that generates a settings UI based on a JSON schema
    * Implement SettingsManager callback for notifying of settings changes and settings schema updates
    * Always enable Entire Device zone option and use it to enable Edit Device
    * Rename SaveSizes to SaveConfiguration in ProfileManager and Sizes.json to Configuration.json
    * Add zone flag for indicating that a zone's geometry may change, informing profile manager to ignore this check
    * Remove Theme setting and Theme Manager, as this didn't work on most setups anyways and Qt6 has proper Windows dark theming
2026-05-14 17:25:35 -05:00
Dmitry Kychanov 201f2d7aba Fix losing software info upon changing language [next] 2026-05-07 17:24:47 -05:00
Dmitry Kychanov 28cd45b8c0 Fix device tabs not applying compact mode when hotplugging 2026-05-07 17:24:46 -05:00
Adam Honse 7a9aab5a37 Close SDK connection if magic value is not correctly received 2026-05-07 17:24:46 -05:00
Adam Honse 24ea50df71 Implement size verification on RGBController set description functions 2026-05-07 17:24:46 -05:00
Adam Honse 75df39252b Clean up zone initialization dialog 2026-05-07 17:24:46 -05:00
Adam Honse 385f123816 Require local client permission for DeleteProfile, SaveProfile, UploadProfile, SetSettings, and SaveSettings operations, some general cleanup 2026-05-07 17:24:46 -05:00
Adam Honse e1fc54de85 Sanitize profile filenames 2026-05-07 17:24:46 -05:00
Adam Honse e22e88d97d Add RescanDevices to plugin API 2026-05-07 17:24:46 -05:00
Adam Honse 0ba254e38f Implement segment groups in zone editor 2026-05-07 17:24:46 -05:00
Adam Honse 9d35d28a6a Rework server initialization
* Only create server instance if server is actually needed
    * Pass initial server host and port through ResourceManager
    * Allow setting default server host and port in Server settings
2026-05-07 17:24:46 -05:00
stephen iacovelli b4b4f3b891 Sort profiles list alphabetically 2026-05-07 17:24:46 -05:00
Adam Honse e1086712ad Organize OpenRGBSettingsPage with Group Boxes 2026-05-07 17:24:46 -05:00
Kasslim fd7ccad1e6 Correct spelling Busses -> Buses
Commits merged by Adam Honse <[email protected]>
2026-05-07 17:24:46 -05:00
诺诺 8bc1a0cb8f Add Nollie controller OS2.1 2026-05-07 17:24:46 -05:00
Adam Honse 5112224240 Initial implementation of OpenRGB SDK protocol Wireshark dissector 2026-05-07 17:24:46 -05:00
Adam Honse 5e2cc42290 Add ACK to network packets processed by NetworkServer 2026-05-07 17:24:46 -05:00
Adam Honse b1436a8435 Only update device view when RGBController::UpdateLEDs signal is sent to OpenRGBDevicePage, fix device view not refreshing if multiple LEDs are selected 2026-05-07 17:24:46 -05:00
Adam Honse a8d4e25642 Don't emit selection update on mouse click event to avoid sending unnecessary events, also only send one type of event per mouse release event. Fix LED box not being updated 2026-05-07 17:24:46 -05:00
Adam Honse 2b3638ba57 Have dummy controller shut down its background thread immediately during constructor to save resources 2026-05-07 17:24:46 -05:00
Adam Honse 78369c2a92 DeviceView code cleanup, formatting, commenting 2026-05-07 17:24:46 -05:00
Adam Honse 03ce513254 Fix selecting LEDs in device view 2026-05-07 17:24:46 -05:00
Adam Honse 18503cccc6 TabLabel sets its own tooltip so all tabs have a tooltip rather than just devices 2026-05-07 17:24:46 -05:00
Adam Honse e1d46d3bb3 Resize tabs when width is small 2026-05-07 17:24:46 -05:00
Adam Honse 0466996970 Rework adding segments with ConfigureZone 2026-05-07 17:24:46 -05:00
Adam Honse 56bd7580ba Zone and Segment type updates
* Add zone flags to indicate if fields are manually configurable and if they have been manually configured
  * Add flags field to segment type
  * Add segment flags for group start and group member
  * Add color mode support flags to zone (RGB, RBG, GRB, GBR, BRG, BGR)
  * Add color mode enum to zone
  * Update zone and segment description functions to support new fields
  * Rename the effects-only configurable size flag
  * Remove zone type and matrix map configuration from E1.31 manual configuration, use zone editor instead
  * Rework DeviceResizeZone to DeviceConfigureZone
  * Rework most ARGB controllers to allow zone customizations
  * Rework DRGBController to define devices in DRGBDevices list (similar to RazerDevices)
  * Rework NollieController to define devices in NollieDevices list (similar to RazerDevices)
2026-05-07 17:24:46 -05:00
Adam Honse ca47047bf8 Add matrix map automatic generation to matrix map editor 2026-05-07 17:24:46 -05:00
Adam Honse cc00690dd4 RGBController API changes and segment configuration updates
* Make the Get/Set RGBControler descriptor functions static
  * Add functions for getting the matrix_map_type for zone and segment matrix maps
  * Rename zone resize dialog to zone editor dialog
  * Add additional segment types
  * Add option to import segments configuration from JSON file in zone editor dialog
  * Update device view to be able to display matrix segment types
  * Add matrix map editor dialog for creating/editing segment matrix maps
  * Add option to export segments configuration to JSON file in zone editor dialog
2026-05-07 17:24:46 -05:00
Adam Honse 973311aa48 When updating existing profile without profile editor dialog, keep saved states for unavailable controllers, base color, and only update plugins already part of the existing profile 2026-05-07 17:24:46 -05:00
Adam Honse 747afdf553 When saving sizes/manual configuration, keep any existing controllers that are not currently available 2026-05-07 17:24:46 -05:00
Adam Honse 8f11f8fd97 Rework how manual configuration (previously sizes) are loaded to newly detected controllers, load active profile to newly detected controllers 2026-05-07 17:24:45 -05:00
Adam Honse 2b11f6fe07 Profile editor dialog 2026-05-07 17:24:45 -05:00
Adam Honse 94981f107b Rework API interface passed into plugins from ResourceManagerInterface to OpenRGBPluginAPIInterface 2026-05-07 17:24:45 -05:00
Adam Honse 0144a6a150 [next] Active profile tracking 2026-05-07 17:24:45 -05:00
Adam Honse 6ec8b80e65 Apply profiles server-side rather than client-side, signal active profile update, forward loaded profile to local client for plugins 2026-05-07 17:24:45 -05:00
Adam Honse ddae1ed20a Split HID and wrapped HID detector lists into specific detectors (with exact VID/PID matching) and generic detectors (with only IPU matching) and prioritize specific detectors when detecting HID devices 2026-05-07 17:24:45 -05:00
Adam Honse 70f79e97b4 Move RGBController base destructor functionality into RGBController::Shutdown() so that update thread can be stopped before deleting the controller. Shutdown() must be called in every RGBController implementation before deleting the controller. Also some fixes to the NetworkServer to avoid deadlocking and disconnect issues 2026-05-07 17:24:45 -05:00
Adam Honse d05fe1bdf1 Add detectors for filtering on IPU only (no VID/PID) 2026-05-07 17:24:45 -05:00
Adam Honse e9e99a029d Drop support for old hidapi versions that don't support usage information 2026-05-07 17:24:45 -05:00
Adam Honse 98dd494f75 Add some validity checks to mode setters and getters in RGBController 2026-05-07 17:24:45 -05:00
Adam Honse 7b7f0aa0fe [next] SDK v6: Implement client and server flags to indicate capabilities and... 2026-05-07 17:24:45 -05:00
Adam Honse 70876193cf SDK documentation updates 2026-05-07 17:24:45 -05:00
Adam Honse f47a22fb2f Expose LogManager in ResourceManager so that plugins can use it 2026-05-07 17:24:45 -05:00
Adam Honse f24b56b64f Update NetworkClient to use log manager and use common name constant in server logs 2026-05-07 17:24:45 -05:00
Adam Honse 4e70949aec Use std::string.assign when setting strings in the SDK protocol and description handlers so that string size limit is enforced, then strip out null terminators 2026-05-07 17:24:45 -05:00
Adam Honse 5133887632 Add optional HID device hotplug support (requires https://gitlab.com/OpenRGBDevelopers/hidapi-hotplug) 2026-05-07 17:24:45 -05:00
Adam Honse 45950047cb SDK v6: Use unique IDs for identifying RGBControllers in SDK protocol 2026-05-07 17:24:45 -05:00
Adam Honse a56a08411f Rework list handling in ResourceManager by having NetworkClient own its own list rather than sharing ResourceManager's list 2026-05-07 17:24:45 -05:00
Adam Honse 52f0049025 Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions 2026-05-07 17:24:45 -05:00
Adam Honse f6f317d487 Detection progress SDK integration, NetworkClient callback rework 2026-05-07 17:24:45 -05:00
Adam Honse ad364871c6 Split out detection system from ResourceManager into DetectionManager
* Split detection system out into its own class, DetectionManager
    * Clean up ResourceManger's many callbacks into just two, one for detection and one general purpose
2026-05-07 17:24:45 -05:00
Adam Honse 58582202cf SDK Version 6 Updates
* SDK Protocol
    * Server sends its name to client
    * ProfileManager
      * Rename existing profile commands
      * Add Upload Profile, Download Profile, and Get Active Profile commands
    * SettingsManager
      * Add Get, Set, and Save Settings commands
    * Add zone::active_mode, zone::mode fields for zone-specific modes
    * Add NET_PACKET_ID_RGBCONTROLLER_UPDATEZONEMODE packet for updating zone modes
    * Add segment::matrix_map to segment packet
    * Add NET_PACKET_ID_RGBCONTROLLER_SIGNALUPDATE packet for passing SignalUpdate signal from server to clients
  * NetworkServer
    * Formatting cleanup
    * Use per-controller threads for handling NetworkServer controller-specific packets to avoid delays from controller mutexes
  * NetworkClient
    * Formatting cleanup
  * RGBController
    * Clean up and modularize descriptor functions
2026-05-07 17:24:44 -05:00
Adam Honse 57cde755c1 Rework Profiles to use JSON format
* Update OpenRGB Plugin Interface to include functions for loading/saving profile JSON data into OpenRGB profiles
    * Update ProfileManager to handle auto-load profiles (Exit, Open, Resume, Suspend) and move their settings to ProfileManager section
    * Update ProfileManager to store profiles in "profiles" folder in .json format
    * Update ProfileManager to store size profile in sizes.json
    * Update ProfileManager to perform device UpdateMode/UpdateColors when loading profile
    * Code cleanup of ProfileManager and profile-related code
2026-05-07 17:24:44 -05:00
Adam Honse b0c7dba441 RGBController API Overhaul
* Reorganize and clean up RGBController API functions
    * Add functions to get protected RGBController member values
    * Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
    * Protected previously-public RGBController members
        * Information strings (name, vendor, description, version, serial location)
        * Device type
        * Active mode
        * Flags
        * LEDs vector
        * LED alternate names vector
        * Modes vector
        * Colors vector
        * Zones vector
    * Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
    * Add update reason codes to RGBController update callback and signal updates on more RGBController events
    * Add loop zone types and segmented zone type
    * Add matrix map field to segments
    * Rework matrix_map_type from using pointers to vector to prevent memory leaks
    * Rework KeyboardLayoutManager to return new matrix_map_type
    * Add access mutex to RGBController API
    * Add per-zone modes ot RGBController API
    * Add JSON description functions to RGBController API
2026-05-07 17:24:44 -05:00
Adam Honse d763f7ecc7 Move plugin SDK integration from callback into plugin API and PluginManager 2026-05-07 17:24:44 -05:00
Adam Honse 4ec4df8741 Update Plugin API to 5 and SDK Protocol to 6 2026-05-07 17:24:44 -05:00
Adam Honse 5d055d30a3 Update default builds to Qt6
* Update Debian packages to use Qt6
  * Update Fedora packages to use Qt6
  * Update default AppImage builds to use Qt6
  * Update default Windows builds to use Qt6
  * Update default MacOS builds to use Qt6
2026-05-07 17:24:44 -05:00
Adam Honse fc73fe0b4c Revert "Nollie 2.1 firmware for Master"
This reverts commit 07e7feca56.
2026-05-07 17:24:44 -05:00
Adam Honse dd22150cfe Add vertical spacer to OpenRGBDeviceInfoPage 2026-05-07 16:17:46 -05:00
Barry H 07e7feca56 Nollie 2.1 firmware for Master 2026-05-04 14:16:29 -05:00
Sha_425 a93eec8f50 Add ASUS ROG STRIX RTX 3060 Ti V2 LHR (subsystem 1043:8835) 2026-05-03 12:15:13 -05:00
w43322 88bad762e5 add MSI MEG Z890 UNIFY-X (MS-7E20) support 2026-05-02 19:19:10 -05:00
w43322 18dfe6ca8b add ASUS TUF GeForce RTX 5060 Gaming OC support 2026-05-02 19:15:16 -05:00
mangobiche 96dfa7009f Add support for Corsair Vengeance RGB DDR5 CMH32GX5M2E6000C36 2026-05-02 15:06:09 -05:00
NaifuKishi 92a9d8ad11 Initial commit for ASUS TUF Radeon RX 7900 GRE Gaming OC 2026-05-01 11:09:31 -05:00
Francesco P 2ab9094b41 Add support for MSI MAG B850 TOMAHAWK WiFi7 2026-04-29 21:54:51 -05:00
M1dDler Official f6154ccbc4 Add msi rtx 5070 gaming trio 2026-04-28 20:04:53 -05:00
Illustrious-Net-8110 0be01dde19 Add Asus Ryujin AIO Gen1 support 2026-04-24 07:35:53 -05:00
Adam Honse e113e91423 Deploy QOpenGL and QtCore5Compat frameworks used by the OpenRGB Effects Plugin 2026-04-23 23:42:36 -05:00
Adam Honse 28c63b8b9d Call macdeployqt a second time on Qt6 builds to ensure frameworks depended on by default plugins are deployed 2026-04-23 12:37:49 -05:00
Adam Honse c5aac4c44f Fix libsharpyuv macdeployqt error for Qt5 builds 2026-04-23 10:52:54 -05:00
Adam Honse 42e7f2a5c3 Ignore SDK version in Mac build 2026-04-23 03:56:07 -05:00
Adam Honse ae9ae18d31 Add build-macos.sh script for easier MacOS builds 2026-04-23 00:37:45 -05:00
ricarim f89cdac198 Initial commit for HyperX Origins 2 65 2026-04-20 23:32:49 -05:00
acehighdan e8f345ff77 Sync autostart system configuration with OpenRGB settings on startup
If the autostart system configuration is deleted (e.g. by a reinstall or
package manager) but the JSON config still has enabled=true, OpenRGB
would silently fail to start at login. Fix by calling ConfigureAutoStart()
in the settings page constructor so the system configuration is always
reconciled with the stored JSON state every time OpenRGB starts.

Commit amended to make wording more generic by Adam Honse <[email protected]>
2026-04-20 23:32:49 -05:00
Dmitry Kychanov aff0610df9 Fix default language load on start 2026-04-20 23:32:49 -05:00
JAO1988 9199d062d1 Add Support for MSI GeForce RTX 5080 SUPRIM LIQUID SOC 2026-04-20 23:32:49 -05:00
Dmitry Kychanov 0ec4aaa629 Fix losing software info upon changing language 2026-04-20 23:32:49 -05:00
Adam Honse 9fca99b4ef Reduce i2c_smbus_linux PCI log messages from warning to info, they are expected in many cases 2026-04-20 23:32:31 -05:00
Vasily Galkin 14853895f3 Add support for Gigabyte GTX 1050 G1 Gaming 2GB (1458:372B) 2026-04-20 23:32:31 -05:00
Adam Honse d79a400c8c Fix corrupted text in TabLabels when translation occurs after the constructor 2026-04-20 23:32:31 -05:00
Adam Honse f741385e43 Fix bug introduced in MSI controller merge 2026-04-20 23:32:31 -05:00
Adam Honse 840bd92afb Add AI guidelines section to CONTRIBUTING.md 2026-04-20 23:32:31 -05:00
Nameless Monarch 96e1fb0b10 Add support for MSI PRO B850M-VC WIFI6E 2026-04-20 23:32:31 -05:00
Adam Honse 388557e5f9 Ensure device view is initialized if there are no LEDs to avoid accessing out of bounds 2026-04-20 23:32:17 -05:00
Slim Amamou 3f32817272 Added support for PNY GeForce RTX 5060Ti ARGB Epic-X OC 2026-04-20 23:32:10 -05:00
Adam Honse 056b383536 Add SMBus Sleep Mode settings page 2026-04-15 00:29:54 -05:00
Adam Honse 0691f40588 Update PawnIO modules to release 0.2.4 and implement SMBus sleep mode setting 2026-04-15 00:03:38 -05:00
Adam Honse 800ca0aa7c Fix same heap buffer overflow in RGBController_MSIMysticLight761.cpp 2026-04-13 11:42:03 -05:00
kuroki-kael a91679609b Fix heap-buffer-overflow in RGBController_MSIMysticLight185::GetDeviceConfig() 2026-04-13 11:40:46 -05:00
Adam Honse 19f9408990 Fix remaining warning 2026-04-13 11:34:28 -05:00
Adam Honse 0eea0c9aca Fix warnings 2026-04-13 10:54:34 -05:00
Stella 9f95aa8271 Add support for colorful igame rtx 5070 ultraw ocv 2 2026-04-11 02:24:15 -05:00
Adam Honse 0ee04c497b Revert "Change test in ENE SMBus controller to fix a conflict where it locks up Corsair DDR5 Light Enhancement Kit sticks"
This reverts commit c4e0164479.
2026-04-11 01:29:05 -05:00
Adam Honse 2847270c97 Remove out-of-range addresses from ENE RAM address list 2026-04-10 11:52:50 -05:00
Adam Honse b98174afba Fix off-by-one error in CorsairDRAMController 2026-04-10 11:03:34 -05:00
MissingDLL 3416980849 Add MSI MPG B850 EDGE TI WIFI (MS-7E62) to 761 controller 2026-04-09 20:49:35 -05:00
Joseph E c171bfbf3b Apex Pro Gen 3 TKL wired, add media light and regional layout support 2026-04-09 18:11:52 -05:00
Eder Sánchez 583a737cb5 Fix Windows build in ZOTAC Blackwell GPU controller 2026-04-09 15:03:21 -05:00
rjc862003 d2af6289dd Roccat vulcan ii max support 2026-04-09 13:28:33 -05:00
Moh'd Khier Abualruz 44e6f455e9 Fix Apex Pro TKL 2023 Wireless (PIDs 0x1630/0x1632) RGB control 2026-04-09 13:18:38 -05:00
Eder Sánchez b3a50d669e Add support for ZOTAC GAMING GeForce RTX 5080 AMP Extreme INFINITY 2026-04-09 12:21:52 -05:00
ricarim 0092ea22e2 Fix name assignment for HyperXAlloyOrigins60and65 2026-04-09 10:14:06 -05:00
Jérôme Bauer 58fb35a9bb Fix MSI Mystic Light 185 for Common PID boards (0x0DB0:0x0076) 2026-04-09 10:09:55 -05:00
Adam Honse 9a6ff77545 Combine Corsair RAM controllers, Corsair RAM identification packet testing 2026-04-09 00:47:06 -05:00
Adam Honse c4e0164479 Change test in ENE SMBus controller to fix a conflict where it locks up Corsair DDR5 Light Enhancement Kit sticks 2026-04-08 22:24:56 -05:00
Adam Honse f872f1c591 Ignore modes out of range in VialRGB controller 2026-04-08 18:50:47 -05:00
kuroki-kael 03e64da845 Fix heap corruption in i2c_smbus_linux when sysfs files are empty 2026-04-08 15:54:38 -05:00
Frans Meulenbroeks 3150f64895 Mountain Everest 60: fix led index 2026-04-08 09:33:56 -05:00
Hugo Chabert 8b36e9c317 Add razer blackwidow v4 tenkeyless hyperspeed 2026-04-07 07:30:59 -05:00
Stella c5c5fc6c02 Add support for Colorful iGAME RTX 5060Ti 16GB Ultra W DUO V 2026-04-05 03:46:51 -05:00
Artemis Tomaras c7d9992a3d Fix SL V2 SendStartAction/SendCommitAction packet size 2026-04-05 01:52:56 -05:00
InterStella0 0d8f2c6b14 add colorful rtx 5070 ultra w ocv support 2026-04-03 18:22:49 -05:00
vitutu1 c1800f2a6f Add support for MSI RTX 4070 SUPER Gaming X Slim MLG 2026-04-03 16:46:23 +00:00
Micael Pereira d41a115a07 Add support for MSI PRO A620M-B (MS-7E28) 2026-04-03 01:31:28 -05:00
Elijah Mock 2640a3b93f Update docstring detector to match registered detector 2026-03-26 21:50:02 -05:00
Adam Honse 984c18cb11 Add Gigabyte 9070XT GAMING OC ICE 2026-03-23 16:44:30 -05:00
Adam Honse 23db15dfb9 Add support for E6K5-1114 ENE device 2026-03-23 11:46:04 -05:00
Org van Rensburg 9426f954b0 Add support for MSI MAG Z890 Tomahawk WIFI (MS-7E32) - Resolves #5438 2026-03-23 07:24:22 -05:00
asheriif 133b64778b Add support for Apex Pro TKL Gen 3 Wireless 2026-03-22 22:19:37 +01:00
Aakrisht Sharma Paudel a8a97fa38d Legion 5 gen10 2026-03-17 07:50:23 -05:00
Roy Biggins da6061bbde Add X570 AORUS XTREME zone mapping for IT8297BX 2026-03-16 10:29:38 -05:00
asheriif dfad607697 Add support for Steel Series CS2 Dragon Lore Edition 2026-03-10 21:58:47 +01:00
Yaroslav Syrytsia 5d7565bc59 Controllers/Razer: add initial support for Razer Basilisk V3 Pro 35K Phantom Green Edition 2026-03-08 23:28:27 -05:00
Anton Klimanov ab962ca98f Add support for Gigabyte Radeon RX 7900 XTX GAMING OC 24G (1458:240e) 2026-03-09 01:36:27 +03:00
Adam Honse dbbf9858f8 Fix warnings in CMARGBController 2026-03-04 22:23:20 -06:00
Adam Honse 51edb35e3f Rework CoolerMaster ARGB controller so that it doesn't create multiple devices and prepare it for per-zone mode support 2026-03-04 11:45:48 -06:00
Adam Honse 81c6ee6270 Replace usages of sprintf with snprintf 2026-03-03 11:29:19 -06:00
Adam Honse 9ad37cc98f Fix logical error from changing type to unsigned 2026-03-03 11:25:22 -06:00
Adam Honse c76864dd4b Warning fixes and cleanups 2026-03-03 11:05:11 -06:00
Marco Martinez e3889508c0 Add support for another Airgoo Fan + DRGB Controller variant 2026-03-03 07:37:45 -06:00
Adam Honse 22d908b9a3 Fix warnings in ClevoLightbarController.cpp 2026-03-02 23:18:40 -06:00
Adam Honse 13d3e09f1a Fix warnings in ClevoKeyboardController.cpp 2026-03-02 23:17:23 -06:00
Adam Honse 9ec15673d1 Fix warnings in AsusMonitorController.cpp 2026-03-02 23:15:36 -06:00
Adam Honse 3a00a803e9 Fix warnings in LianLiUniHubSLController 2026-03-02 23:08:51 -06:00
Adam Honse 4a12a0db90 Fix warnings in LianLiUniversalScreenController 2026-03-02 23:07:12 -06:00
Adam Honse b4940e3a75 Fix warning in QMKVialRGBController 2026-03-02 23:04:40 -06:00
Adam Honse ffe07bbe3b Fix warning in RazerKrakenV3Controller 2026-03-02 23:03:00 -06:00
Adam Honse 7fdb006465 Fix warning in WootingV1KeyboardController 2026-03-02 23:01:29 -06:00
Adam Honse 99da577c41 Fix warning in SPDAccessor.cpp 2026-03-02 22:54:22 -06:00
Adam Honse 0f6fdd6c3b Fix warnings in HPOmenLaptopWMI_Windows 2026-03-02 22:52:12 -06:00
Adam Honse 52ec58d67f Fix warnings in NVFC nvapi.cpp 2026-03-02 22:44:19 -06:00
Adam Honse c55fc59d18 Clean up and fix warning in SteelSeriesApexController 2026-03-02 18:07:52 -06:00
Adam Honse b68b63e8c9 Fix warning in LianLiUniHubSLController 2026-03-02 16:16:10 -06:00
Kevin Ferrare 84bb05d504 Add support for MSI PRO B850M-P WIFI (MS-7E71) 2026-02-26 22:50:46 +01:00
Frans Meulenbroeks f33a7ba870 Mountain Everest 60: fix initialisation 2026-02-22 17:19:18 -06:00
chetrez911 93830c12ee Add support for MSI MAG B850 TOMAHAWK MAX WIFI (MS-7E62) 2026-02-22 11:56:23 -06:00
Arno b8b50f6651 Initial commit for MSI PRO Z790-S WIFI 2026-02-22 11:40:25 -06:00
sebastien ayanouglou 8f331090f9 Added support to RTX 5070Ti MSI Vanguard 16G 2026-02-16 07:21:32 -06:00
gozzarda 7ec1e8ddfa PowerColor GPU: Accept V1 magic from V2 controller. 2026-02-15 14:05:32 -06:00
Adam Honse 880dc1450d PNY ARGB Epic-X GPU: Add additional modes 2026-02-13 16:27:30 -06:00
Daenney 801e655c09 Add support for MSI MPG X870E EDGE TI WiFi 2026-02-13 13:36:54 -06:00
Adam Honse 5e269dd089 Add support for the PNY Epic-X ARGB 5070, 5080, and 5090 variants 2026-02-13 11:25:42 -06:00
John360Boxer 476f81d5e8 Initial commit for Redragon K686 Eisa Pro 2026-02-09 07:39:40 -06:00
storto 66dfb5f6fd Add/Fix support for the Gigabyte AORUS 5080 MASTER GPU 2026-02-08 12:45:02 -06:00
Michał Przytarski a2f2991192 feat: support MSI GeForce RTX 4060 GAMING X NV Edition 8G 2026-02-07 14:42:15 -06:00
Adam Honse cfedcd2180 Add Razer Blackwidow V4 Pro 75% wireless mode and add missing underglow LEDs to the matrix 2026-02-07 00:14:36 -06:00
Arthur de Groot cc06c62164 Rename Setting RunZoneChecks -> run_zone_checks 2026-02-05 17:20:14 -06:00
bernibaer b4ca000402 Initial support for Corsair K70 CORE TKL Keyboard ID 1b1c:2b01. Volume knob... 2026-01-30 13:49:48 -06:00
eriosgamer b78a6f4418 Fixed incorrect PID and device name. 2026-01-29 20:18:55 -06:00
Kirill Khakimov d5693b7a08 Add PCI device ID for Palit GeForce RTX 5070 Ti GamingPro-S 2026-01-29 16:54:41 -06:00
Werner Sembach cae0670065 Add new keynames 2026-01-29 16:18:13 -06:00
Adam Honse f2d1188fdd Fix swatches not resizing properly when maximized 2026-01-28 18:35:22 -06:00
Yohan 70be81c92d Merge: Add CDC Check in JGINYUE Usb Controller #5128 2026-01-27 10:54:51 -06:00
rszyma 5d5af93401 Add support for MSI PRO X870-P WIFI (MS-7E47) motherboard 2026-01-27 01:30:11 -06:00
superstrom 74cbdcce55 New Device: Razer Kraken Kitty V2 Pro 2026-01-25 17:40:54 -06:00
John Smith 96d19a76cc Add support for Sapphire Radeon RX 9060 XT Pure 2026-01-25 12:01:23 +03:00
710 changed files with 57976 additions and 21780 deletions
+4 -16
View File
@@ -536,10 +536,7 @@ before_script:
- macos
stage: build
script:
- eval $(/opt/homebrew/bin/brew shellenv)
- qmake OpenRGB.pro
- make -j16
- macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt6 arm
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_ARM64_${CI_COMMIT_SHORT_SHA}"
@@ -555,10 +552,7 @@ before_script:
- macos
stage: build
script:
- eval $(/opt/homebrew/bin/brew shellenv)
- /opt/homebrew/opt/qt@5/bin/qmake OpenRGB.pro
- make -j16
- /opt/homebrew/opt/qt@5/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt5 arm
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_Qt5_ARM64_${CI_COMMIT_SHORT_SHA}"
@@ -574,10 +568,7 @@ before_script:
- macos
stage: build
script:
- eval $(/usr/local/bin/brew shellenv)
- arch -x86_64 /usr/local/bin/qmake OpenRGB.pro
- arch -x86_64 make -j16
- arch -x86_64 /usr/local/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt6 intel
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_Intel_${CI_COMMIT_SHORT_SHA}"
@@ -593,10 +584,7 @@ before_script:
- macos
stage: build
script:
- eval $(/usr/local/bin/brew shellenv)
- arch -x86_64 /usr/local/opt/qt@5/bin/qmake OpenRGB.pro
- arch -x86_64 make -j16
- arch -x86_64 /usr/local/opt/qt@5/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt5 intel
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_Intel_Qt5_${CI_COMMIT_SHORT_SHA}"
+1 -2
View File
@@ -22,13 +22,12 @@ CODEOWNERS @Calcprogrammer1
/Controllers/BlinkyTapeController/
/Controllers/CoolerMasterController/ @Dr_No
/Controllers/CorsairCommanderCoreController/
/Controllers/CorsairDominatorPlatinumController/
/Controllers/CorsairDRAMController/
/Controllers/CorsairHydroController/
/Controllers/CorsairHydroPlatinumController/
/Controllers/CorsairLightingNodeController/
/Controllers/CorsairPeripheralController/
/Controllers/CorsairVengeanceController/
/Controllers/CorsairVengeanceProController/
/Controllers/CorsairWirelessController/
/Controllers/CreativeController/
/Controllers/CrucialController/
+4
View File
@@ -69,3 +69,7 @@ OpenRGB is written in C++, uses the Qt framework for UI, and uses the QMake buil
Translation files are located in [`OpenRGB/qt/i18n/`](https://gitlab.com/CalcProgrammer1/OpenRGB/-/tree/master/qt/i18n), where languages are formatted using ISO 639-1 format: `OpenRGB_xx_XX.ts` — `xx_XX` representing the language code.
In order to translate a file, you need to [fork](https://gitlab.com/CalcProgrammer1/OpenRGB/-/forks/new) the project, create a new file for your language with `lupdate` (or edit an exisiting one), edit the file with `qtlinguist`, commit, push, and create a merge request.
## AI Guidelines
OpenRGB is an open source project developed by humans for humans. As a general rule, AI generated submissions are not permitted. The licensing behind AI generated code is problematic. If you choose to use AI for assistance in your development process, we can't stop you, but do not credit the AI in commits (no AI authorship/co-authorship). Ultimately, you as a human developer are responsible for the code you submit and it is expected that any code you submit you fully understand and have manually vetted before submission. Merge requests that appear to be straight from an AI output, commits with AI tool authorship or co-authorship tags, or otherwise AI generated submissions are subject to closure.
@@ -173,6 +173,8 @@ RGBController_BloodyB820R::RGBController_BloodyB820R(BloodyB820RController *cont
RGBController_BloodyB820R::~RGBController_BloodyB820R()
{
Shutdown();
delete controller;
}
@@ -89,6 +89,8 @@ RGBController_BloodyMouse::RGBController_BloodyMouse(BloodyMouseController *cont
RGBController_BloodyMouse::~RGBController_BloodyMouse()
{
Shutdown();
delete controller;
}
@@ -44,6 +44,8 @@ RGBController_AMBX::RGBController_AMBX(AMBXController* controller_ptr)
RGBController_AMBX::~RGBController_AMBX()
{
Shutdown();
delete controller;
}
@@ -132,6 +132,8 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
{
Shutdown();
delete controller;
}
@@ -31,7 +31,7 @@ AOCKeyboardController::~AOCKeyboardController()
std::string AOCKeyboardController::GetDeviceLocation()
{
return("HID " + location);
return("HID: " + location);
}
std::string AOCKeyboardController::GetDeviceName()
@@ -257,6 +257,8 @@ RGBController_AOCKeyboard::RGBController_AOCKeyboard(AOCKeyboardController* cont
RGBController_AOCKeyboard::~RGBController_AOCKeyboard()
{
Shutdown();
delete controller;
}
@@ -27,7 +27,7 @@ AOCMouseController::~AOCMouseController()
std::string AOCMouseController::GetDeviceLocation()
{
return("HID " + location);
return("HID: " + location);
}
std::string AOCMouseController::GetDeviceName()
@@ -123,6 +123,8 @@ RGBController_AOCMouse::RGBController_AOCMouse(AOCMouseController* controller_pt
RGBController_AOCMouse::~RGBController_AOCMouse()
{
Shutdown();
delete controller;
}
@@ -27,7 +27,7 @@ AOCMousematController::~AOCMousematController()
std::string AOCMousematController::GetDeviceLocation()
{
return("HID " + location);
return("HID: " + location);
}
std::string AOCMousematController::GetDeviceName()
@@ -113,6 +113,8 @@ RGBController_AOCMousemat::RGBController_AOCMousemat(AOCMousematController* cont
RGBController_AOCMousemat::~RGBController_AOCMousemat()
{
Shutdown();
delete controller;
}
@@ -191,7 +191,7 @@ void PolychromeUSBController::SetDeviceInfo()
WriteRGSwap(rgswap_final[0], rgswap_final[1], rgswap_final[2], rgswap_final[3], rgswap_final[4], rgswap_final[5], rgswap_final[6], rgswap_final[7]);
}
void PolychromeUSBController::DeviceResizeZone(int zone, int new_size)
void PolychromeUSBController::SetZoneSize(int zone, int new_size)
{
unsigned char zonecfg[POLYCHROME_USB_ZONE_MAX_NUM];
@@ -135,7 +135,7 @@ public:
unsigned int configsize
);
void DeviceResizeZone(int zone, int new_size);
void SetZoneSize(int zone, int new_size);
void SetRGSwap(bool reset);
protected:
@@ -185,8 +185,25 @@ RGBController_PolychromeUSB::RGBController_PolychromeUSB(PolychromeUSBController
SetupZones();
}
RGBController_PolychromeUSB::~RGBController_PolychromeUSB()
{
Shutdown();
delete controller;
}
void RGBController_PolychromeUSB::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 |
\*-------------------------------------------------*/
@@ -197,28 +214,55 @@ void RGBController_PolychromeUSB::SetupZones()
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
{
PolychromeDeviceInfo device_info = controller->GetPolychromeDevices()[channel_idx];
zones[channel_idx].type = ZONE_TYPE_LINEAR;
if(device_info.device_type== PolychromeDeviceType::ADDRESSABLE)
{
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
zones[channel_idx].leds_count = device_info.num_leds;
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
if(first_run)
{
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[channel_idx].leds_count = device_info.num_leds;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[channel_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[channel_idx].matrix_map.width = 0;
zones[channel_idx].matrix_map.height = 0;
zones[channel_idx].matrix_map.map.resize(0);
}
}
else if(device_info.device_type==PolychromeDeviceType::FIXED)
{
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
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;
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
zones[channel_idx].type = ZONE_TYPE_LINEAR;
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;
}
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
led new_led;
@@ -271,10 +315,14 @@ void RGBController_PolychromeUSB::SetupZones()
}
}
void RGBController_PolychromeUSB::DeviceResizeZone(int zone, int new_size)
void RGBController_PolychromeUSB::DeviceConfigureZone(int zone_idx)
{
zones[zone].leds_count = (unsigned char) new_size;
controller->DeviceResizeZone(zones_info[zone].zone, new_size);
if((size_t)zone_idx < zones.size())
{
controller->SetZoneSize(zones_info[zone_idx].zone, zones[zone_idx].leds_count);
SetupZones();
}
}
void RGBController_PolychromeUSB::DeviceUpdateLEDs()
@@ -19,10 +19,11 @@ class RGBController_PolychromeUSB : public RGBController
{
public:
RGBController_PolychromeUSB(PolychromeUSBController* controller_ptr);
~RGBController_PolychromeUSB();
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -36,7 +36,7 @@ ASRockASRRGBSMBusController::~ASRockASRRGBSMBusController()
std::string ASRockASRRGBSMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -113,6 +113,8 @@ RGBController_ASRockASRRGBSMBus::RGBController_ASRockASRRGBSMBus(ASRockASRRGBSMB
RGBController_ASRockASRRGBSMBus::~RGBController_ASRockASRRGBSMBus()
{
Shutdown();
delete controller;
}
@@ -159,13 +161,6 @@ void RGBController_ASRockASRRGBSMBus::SetupZones()
SetupColors();
}
void RGBController_ASRockASRRGBSMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_ASRockASRRGBSMBus::DeviceUpdateLEDs()
{
for(unsigned int led = 0; led < colors.size(); led++)
@@ -22,8 +22,6 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
@@ -36,7 +36,7 @@ ASRockPolychromeV1SMBusController::~ASRockPolychromeV1SMBusController()
std::string ASRockPolychromeV1SMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -230,6 +230,8 @@ RGBController_ASRockPolychromeV1SMBus::RGBController_ASRockPolychromeV1SMBus(ASR
RGBController_ASRockPolychromeV1SMBus::~RGBController_ASRockPolychromeV1SMBus()
{
Shutdown();
delete controller;
}
@@ -296,10 +298,9 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
SetupColors();
}
void RGBController_ASRockPolychromeV1SMBus::DeviceResizeZone(int zone, int new_size)
void RGBController_ASRockPolychromeV1SMBus::DeviceConfigureZone(int zone_idx)
{
LOG_TRACE("[%s] DeviceResizeZone(%02X, %02X)", name.c_str(), zone, new_size);
controller-> SetARGBSize(new_size & 0xFF);
controller-> SetARGBSize(zones[zone_idx].leds_count & 0xFF);
zones[POLYCHROME_V1_ZONE_ADDRESSABLE].leds_count = 1;
}
@@ -23,7 +23,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -37,7 +37,7 @@ ASRockPolychromeV2SMBusController::~ASRockPolychromeV2SMBusController()
std::string ASRockPolychromeV2SMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -185,6 +185,8 @@ RGBController_ASRockPolychromeV2SMBus::RGBController_ASRockPolychromeV2SMBus(ASR
RGBController_ASRockPolychromeV2SMBus::~RGBController_ASRockPolychromeV2SMBus()
{
Shutdown();
delete controller;
}
@@ -279,7 +281,7 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
SetupColors();
}
void RGBController_ASRockPolychromeV2SMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_ASRockPolychromeV2SMBus::DeviceConfigureZone(int /*zone_idx*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
@@ -23,7 +23,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -85,31 +85,31 @@ uint16_t GetFirmwareVersion(i2c_smbus_interface* bus, uint8_t address)
}
}
DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface*>& busses)
DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface*>& buses)
{
DetectedControllers detected_controllers;
for(unsigned int bus = 0; bus < busses.size(); bus++)
for(unsigned int bus = 0; bus < buses.size(); bus++)
{
IF_MOBO_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
{
if(busses[bus]->pci_subsystem_vendor == ASROCK_SUB_VEN)
if(buses[bus]->info.pci_subsystem_vendor == ASROCK_SUB_VEN)
{
LOG_DEBUG(SMBUS_CHECK_DEVICE_MESSAGE_EN, ASROCK_DETECTOR_NAME, bus, VENDOR_NAME, SMBUS_ADDRESS);
// Check for Polychrome controller at 0x6A
if(TestForPolychromeSMBusController(busses[bus], SMBUS_ADDRESS))
if(TestForPolychromeSMBusController(buses[bus], SMBUS_ADDRESS))
{
LOG_DEBUG("[%s] Detected a device at address 0x%02X, testing for a known controller", ASROCK_DETECTOR_NAME, SMBUS_ADDRESS);
u16_to_u8 version;
version.u16 = GetFirmwareVersion(busses[bus], SMBUS_ADDRESS);
version.u16 = GetFirmwareVersion(buses[bus], SMBUS_ADDRESS);
switch(version.msb)
{
case ASROCK_TYPE_ASRLED:
{
LOG_DEBUG("[%s] Found a ASR RGB LED Controller", ASROCK_DETECTOR_NAME);
ASRockASRRGBSMBusController* controller = new ASRockASRRGBSMBusController(busses[bus], SMBUS_ADDRESS);
ASRockASRRGBSMBusController* controller = new ASRockASRRGBSMBusController(buses[bus], SMBUS_ADDRESS);
controller-> fw_version = version.u16;
RGBController_ASRockASRRGBSMBus* rgb_controller = new RGBController_ASRockASRRGBSMBus(controller);
detected_controllers.push_back(rgb_controller);
@@ -119,7 +119,7 @@ DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface
case ASROCK_TYPE_POLYCHROME_V1:
{
LOG_DEBUG("[%s] Found a Polychrome v1 Controller", ASROCK_DETECTOR_NAME);
ASRockPolychromeV1SMBusController* controller = new ASRockPolychromeV1SMBusController(busses[bus], SMBUS_ADDRESS);
ASRockPolychromeV1SMBusController* controller = new ASRockPolychromeV1SMBusController(buses[bus], SMBUS_ADDRESS);
controller-> fw_version = version.u16;
RGBController_ASRockPolychromeV1SMBus* rgb_controller = new RGBController_ASRockPolychromeV1SMBus(controller);
detected_controllers.push_back(rgb_controller);
@@ -129,7 +129,7 @@ DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface
case ASROCK_TYPE_POLYCHROME_V2:
{
LOG_DEBUG("[%s] Found a Polychrome v2 Controller", ASROCK_DETECTOR_NAME);
ASRockPolychromeV2SMBusController* controller = new ASRockPolychromeV2SMBusController(busses[bus], SMBUS_ADDRESS);
ASRockPolychromeV2SMBusController* controller = new ASRockPolychromeV2SMBusController(buses[bus], SMBUS_ADDRESS);
controller-> fw_version = version.u16;
RGBController_ASRockPolychromeV2SMBus* rgb_controller = new RGBController_ASRockPolychromeV2SMBus(controller);
detected_controllers.push_back(rgb_controller);
@@ -125,6 +125,13 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* controller
controller->UpdateDim();
}
RGBController_Alienware::~RGBController_Alienware()
{
Shutdown();
delete controller;
}
void RGBController_Alienware::SetupZones()
{
/*-------------------------------------------------*\
@@ -19,6 +19,7 @@ class RGBController_Alienware : public RGBController
{
public:
RGBController_Alienware(AlienwareController* controller_ptr);
~RGBController_Alienware();
void SetupZones();
@@ -278,6 +278,8 @@ RGBController_AlienwareAW410K::RGBController_AlienwareAW410K(AlienwareAW410KCont
RGBController_AlienwareAW410K::~RGBController_AlienwareAW410K()
{
Shutdown();
delete controller;
}
@@ -277,6 +277,8 @@ RGBController_AlienwareAW510K::RGBController_AlienwareAW510K(AlienwareAW510KCont
RGBController_AlienwareAW510K::~RGBController_AlienwareAW510K()
{
Shutdown();
delete controller;
}
@@ -46,6 +46,8 @@ RGBController_AlienwareAW3423DWF::RGBController_AlienwareAW3423DWF(AlienwareAW34
RGBController_AlienwareAW3423DWF::~RGBController_AlienwareAW3423DWF()
{
Shutdown();
delete controller;
}
@@ -46,6 +46,8 @@ RGBController_AlienwareMonitor::RGBController_AlienwareMonitor(AlienwareMonitorC
RGBController_AlienwareMonitor::~RGBController_AlienwareMonitor()
{
Shutdown();
delete controller;
}
@@ -144,6 +144,8 @@ RGBController_AnnePro2::RGBController_AnnePro2(AnnePro2Controller* controller_pt
RGBController_AnnePro2::~RGBController_AnnePro2()
{
Shutdown();
delete controller;
}
@@ -55,6 +55,8 @@ RGBController_Arctic::RGBController_Arctic(ArcticController* controller_ptr)
RGBController_Arctic::~RGBController_Arctic()
{
Shutdown();
keepalive_thread_run = false;
keepalive_thread.join();
delete controller;
@@ -125,6 +125,8 @@ RGBController_Areson::RGBController_Areson(AresonController* controller_ptr)
RGBController_Areson::~RGBController_Areson()
{
Shutdown();
delete controller;
}
@@ -45,6 +45,13 @@ RGBController_AuraCore::RGBController_AuraCore(AuraCoreController* controller_pt
SetupZones();
}
RGBController_AuraCore::~RGBController_AuraCore()
{
Shutdown();
delete controller;
}
void RGBController_AuraCore::SetupKeyboard()
{
name = "ASUS Aura Keyboard";
@@ -170,11 +177,6 @@ void RGBController_AuraCore::SetupGA15DH()
modes.push_back(Static);
}
RGBController_AuraCore::~RGBController_AuraCore()
{
delete controller;
}
void RGBController_AuraCore::SetupZones()
{
zone auraZone;
@@ -268,6 +268,8 @@ RGBController_AsusAuraCoreLaptop::RGBController_AsusAuraCoreLaptop(AsusAuraCoreL
RGBController_AsusAuraCoreLaptop::~RGBController_AsusAuraCoreLaptop()
{
Shutdown();
delete controller;
}
@@ -32,7 +32,7 @@ std::string AuraGPUController::GetDeviceName()
std::string AuraGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -79,7 +79,7 @@ void AuraGPUController::AuraGPURegisterWrite(unsigned char reg, unsigned char va
bool AuraGPUController::SaveOnlyApplies()
{
switch (bus->pci_subsystem_device)
switch (bus->info.pci_subsystem_device)
{
case ASUS_VEGA64_STRIX:
return false;
@@ -21,7 +21,7 @@
bool TestForAsusAuraGPUController(i2c_smbus_interface* bus, unsigned char address)
{
if(bus->pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
if(bus->info.pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
{
return false;
}
@@ -124,6 +124,8 @@ RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * controller_ptr)
RGBController_AuraGPU::~RGBController_AuraGPU()
{
Shutdown();
delete controller;
}
@@ -112,6 +112,8 @@ RGBController_AuraHeadsetStand::RGBController_AuraHeadsetStand(AuraHeadsetStandC
RGBController_AuraHeadsetStand::~RGBController_AuraHeadsetStand()
{
Shutdown();
delete controller;
}
@@ -380,6 +380,8 @@ RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* c
RGBController_AuraKeyboard::~RGBController_AuraKeyboard()
{
Shutdown();
delete controller;
}
@@ -45,6 +45,8 @@ RGBController_AuraMonitor::RGBController_AuraMonitor(AuraMonitorController* cont
RGBController_AuraMonitor::~RGBController_AuraMonitor()
{
Shutdown();
delete controller;
}
@@ -185,6 +185,8 @@ RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* controller
RGBController_AuraMouse::~RGBController_AuraMouse()
{
Shutdown();
delete controller;
}
@@ -116,6 +116,8 @@ RGBController_AsusROGSpatha::RGBController_AsusROGSpatha(AsusAuraMouseGen1Contro
RGBController_AsusROGSpatha::~RGBController_AsusROGSpatha()
{
Shutdown();
delete controller;
}
@@ -79,6 +79,8 @@ RGBController_AsusROGStrixEvolve::RGBController_AsusROGStrixEvolve(AsusAuraMouse
RGBController_AsusROGStrixEvolve::~RGBController_AsusROGStrixEvolve()
{
Shutdown();
delete controller;
}
@@ -182,6 +182,8 @@ RGBController_AuraMousemat::RGBController_AuraMousemat(AuraMousematController* c
RGBController_AuraMousemat::~RGBController_AuraMousemat()
{
Shutdown();
delete controller;
}
@@ -19,7 +19,10 @@ AsusAuraRyuoAIOController::AsusAuraRyuoAIOController(hid_device* dev_handle, con
| Manually adding device info for now |
| TODO: Implement config table accurately |
\*-----------------------------------------------------*/
device_info.push_back({0x00, 0x00, 12, 0, AuraDeviceType::FIXED});
uint8_t leds = (dev_name.find("Ryujin") != std::string::npos) ? 5 : 12;
device_info.push_back({0x00, 0x00, leds, 0, AuraDeviceType::FIXED});
}
AsusAuraRyuoAIOController::~AsusAuraRyuoAIOController()
@@ -128,6 +128,8 @@ RGBController_AsusAuraRyuoAIO::RGBController_AsusAuraRyuoAIO(AsusAuraRyuoAIOCont
RGBController_AsusAuraRyuoAIO::~RGBController_AsusAuraRyuoAIO()
{
Shutdown();
delete controller;
}
@@ -410,6 +410,8 @@ RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardCont
RGBController_AuraTUFKeyboard::~RGBController_AuraTUFKeyboard()
{
Shutdown();
delete controller;
}
@@ -119,6 +119,8 @@ RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* controller_ptr)
RGBController_AuraUSB::~RGBController_AuraUSB()
{
Shutdown();
delete controller;
}
@@ -145,41 +147,68 @@ void RGBController_AuraUSB::SetupZones()
| Set zones and leds |
\*-------------------------------------------------*/
int addressableCounter = 1;
for (unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
{
AuraDeviceInfo device_info = controller->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;
zones[channel_idx].name = "Aura Mainboard";
zones[channel_idx].type = ZONE_TYPE_LINEAR;
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++;
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
if(first_run)
{
zones[channel_idx].leds_count = 0;
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
zones[channel_idx].name = "Addressable RGB Header ";
zones[channel_idx].name.append(std::to_string(addressableCounter));
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[channel_idx].leds_count = 0;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[channel_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[channel_idx].matrix_map.width = 0;
zones[channel_idx].matrix_map.height = 0;
zones[channel_idx].matrix_map.map.resize(0);
}
addressableCounter++;
}
unsigned int num_mainboard_leds = device_info.num_leds - device_info.num_headers;
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
unsigned led_idx = led_ch_idx + 1;
led new_led;
new_led.name = zones[channel_idx].name;
if(device_info.device_type == AuraDeviceType::FIXED && led_ch_idx >= num_mainboard_leds)
{
new_led.name.append(", RGB Header ");
@@ -189,6 +218,7 @@ void RGBController_AuraUSB::SetupZones()
{
new_led.name.append(", LED ");
}
new_led.name.append(std::to_string(led_idx));
new_led.value = channel_idx;
@@ -200,17 +230,10 @@ void RGBController_AuraUSB::SetupZones()
SetupColors();
}
void RGBController_AuraUSB::DeviceResizeZone(int zone, int new_size)
void RGBController_AuraUSB::DeviceConfigureZone(int zone_idx)
{
if((size_t) zone >= zones.size())
if((size_t)zone_idx < 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();
}
}
@@ -24,7 +24,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -120,6 +120,7 @@
#define AURA_TERMINAL_PID 0x1889
#define ROG_STRIX_LC120_PID 0x879E
#define AURA_RYUO_AIO_PID 0x1887
#define AURA_RYUJIN_AIO_PID 0x18AE
#define ASUS_ROG_ALLY_PID 0x1ABE
#define ASUS_ROG_ALLY_X_PID 0x1B4C
@@ -523,6 +524,7 @@ REGISTER_HID_DETECTOR_PU("ASUS ROG PG32UQ", DetectAs
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBTerminal, AURA_USB_VID, AURA_TERMINAL_PID);
REGISTER_HID_DETECTOR_PU ("ASUS ROG Strix LC", DetectAsusAuraUSBROGStrixLC, AURA_USB_VID, ROG_STRIX_LC120_PID, 0x00FF, 1);
REGISTER_HID_DETECTOR_PU ("ASUS ROG Ryuo AIO", DetectAsusAuraUSBRyuoAIO, AURA_USB_VID, AURA_RYUO_AIO_PID, 0xFF72, 0x00A1);
REGISTER_HID_DETECTOR_PU ("ASUS ROG Ryujin AIO", DetectAsusAuraUSBRyuoAIO, AURA_USB_VID, AURA_RYUJIN_AIO_PID, 0xFF72, 0x00A1);
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_PID, 0);
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_PID, 0);
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI GUNDAM", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_GUNDAM_PID, 0);
@@ -117,6 +117,8 @@ RGBController_AsusROGAlly::RGBController_AsusROGAlly(ROGAllyController* controll
RGBController_AsusROGAlly::~RGBController_AsusROGAlly()
{
Shutdown();
delete controller;
}
@@ -129,6 +129,8 @@ RGBController_AsusROGStrixLC::RGBController_AsusROGStrixLC(AsusROGStrixLCControl
RGBController_AsusROGStrixLC::~RGBController_AsusROGStrixLC()
{
Shutdown();
delete controller;
}
@@ -283,6 +283,8 @@ RGBController_AsusCerberusKeyboard::RGBController_AsusCerberusKeyboard(AsusCerbe
RGBController_AsusCerberusKeyboard::~RGBController_AsusCerberusKeyboard()
{
Shutdown();
delete controller;
}
@@ -165,6 +165,8 @@ RGBController_AsusSagarisKeyboard::RGBController_AsusSagarisKeyboard(AsusSagaris
RGBController_AsusSagarisKeyboard::~RGBController_AsusSagarisKeyboard()
{
Shutdown();
delete controller;
}
@@ -89,7 +89,7 @@ void AsusMonitorController::SetDirect(std::vector<RGBColor> colors)
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = 0x40;
usb_buf[0x02] = 0x84;
usb_buf[0x04] = colors.size();
usb_buf[0x04] = (uint8_t)colors.size();
for(size_t i = 0; i < colors.size(); i++)
{
@@ -46,6 +46,8 @@ RGBController_AsusMonitor::RGBController_AsusMonitor(AsusMonitorController* cont
RGBController_AsusMonitor::~RGBController_AsusMonitor()
{
Shutdown();
delete controller;
}
@@ -92,6 +92,13 @@ RGBController_AsusTUFLaptopLinux::RGBController_AsusTUFLaptopLinux(AsusTUFLaptop
SetupZones();
}
RGBController_AsusTUFLaptopLinux::~RGBController_AsusTUFLaptopLinux()
{
Shutdown();
delete controller;
}
void RGBController_AsusTUFLaptopLinux::SetupZones()
{
/*---------------------------------------------------------*\
@@ -16,6 +16,7 @@ class RGBController_AsusTUFLaptopLinux : public RGBController
{
public:
RGBController_AsusTUFLaptopLinux(AsusTUFLaptopLinuxController* controller_ptr);
~RGBController_AsusTUFLaptopLinux();
void SetupZones();
@@ -85,6 +85,8 @@ RGBController_AsusTUFLaptopWMI::RGBController_AsusTUFLaptopWMI(AsusTUFLaptopCont
RGBController_AsusTUFLaptopWMI::~RGBController_AsusTUFLaptopWMI()
{
Shutdown();
delete controller;
}
@@ -44,86 +44,90 @@ RGBController_BlinkyTape::RGBController_BlinkyTape(BlinkyTapeController* control
RGBController_BlinkyTape::~RGBController_BlinkyTape()
{
Shutdown();
delete controller;
}
void RGBController_BlinkyTape::SetupZones()
{
zones.clear();
/*-------------------------------------------------*\
| 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(1);
zone led_zone;
led_zone.name = "LED Strip";
led_zone.type = ZONE_TYPE_LINEAR;
led_zone.leds_min = 0;
led_zone.leds_max = 512;
led_zone.leds_count = 0;
zones.push_back(led_zone);
/*-----------------------------------------------------*\
| Set up zones |
\*-----------------------------------------------------*/
zones[0].leds_min = 0;
zones[0].leds_max = 512;
DeviceResizeZone(0, led_zone.leds_count);
}
void RGBController_BlinkyTape::DeviceResizeZone(int zone, int new_size)
{
/*-------------------------------------------------*\
| Explicitly cast these to avoid compiler warnings |
\*-------------------------------------------------*/
const unsigned int zone_u = static_cast<unsigned int>(zone);
const unsigned int new_size_u = static_cast<unsigned int>(new_size);
/*-------------------------------------------------*\
| Check that the zone is in bounds |
\*-------------------------------------------------*/
if((zone_u > zones.size()) || (zone < 0))
if(first_run)
{
return;
zones[0].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
/*-------------------------------------------------*\
| And that the new size is in bounds |
\*-------------------------------------------------*/
if((new_size_u > zones.at(zone).leds_max) || (new_size_u < zones.at(zone).leds_min))
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
return;
zones[0].name = "Addressable RGB Header";
}
/*-------------------------------------------------*\
| And that there's actually a change |
\*-------------------------------------------------*/
if(zones.at(zone).leds_count == new_size_u)
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
return;
zones[0].leds_count = 0;
}
/*-------------------------------------------------*\
| If the new size is less than the current size, |
| just chop off the end |
\*-------------------------------------------------*/
if(leds.size() > new_size_u)
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
leds.resize(new_size);
zones[0].type = ZONE_TYPE_LINEAR;
}
/*-------------------------------------------------*\
| Otherwise, add new LEDs to the end |
\*-------------------------------------------------*/
if(leds.size() < new_size_u)
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
for(size_t led_idx = leds.size(); led_idx < new_size_u; led_idx++)
{
led new_led;
new_led.name = "LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
zones[0].matrix_map.width = 0;
zones[0].matrix_map.height = 0;
zones[0].matrix_map.map.resize(0);
}
zones.at(zone).leds_count = new_size;
/*-----------------------------------------------------*\
| Set up LEDs |
\*-----------------------------------------------------*/
for(size_t led_idx = leds.size(); led_idx < zones[0].leds_count; led_idx++)
{
led new_led;
new_led.name = zones[0].name + ", LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_BlinkyTape::DeviceConfigureZone(int zone_idx)
{
if((size_t)zone_idx < zones.size())
{
SetupZones();
}
}
void RGBController_BlinkyTape::DeviceUpdateLEDs()
{
controller->SetLEDs(colors);
@@ -23,7 +23,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -312,6 +312,8 @@ RGBController_CherryKeyboard::RGBController_CherryKeyboard(CherryKeyboardControl
RGBController_CherryKeyboard::~RGBController_CherryKeyboard()
{
Shutdown();
delete controller;
}
@@ -10,8 +10,9 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "ClevoKeyboardController.h"
#include <cstring>
#include "ClevoKeyboardController.h"
#include "StringUtils.h"
ClevoKeyboardController::ClevoKeyboardController(hid_device* dev_handle, const hid_device_info& info)
{
@@ -40,10 +41,7 @@ std::string ClevoKeyboardController::GetSerialString()
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
return(StringUtils::wstring_to_string(serial_string));
}
std::string ClevoKeyboardController::GetFirmwareVersion()
@@ -9,8 +9,8 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "DetectionManager.h"
#include "ClevoKeyboardController.h"
#include "DetectionManager.h"
#include "RGBController_ClevoKeyboard.h"
#include "RGBController.h"
#include <hidapi.h>
@@ -26,7 +26,7 @@
\*---------------------------------------------------------*/
#define CLEVO_KEYBOARD_PID_600B 0x600B
DetectedControllers DetectClevoKeyboardControllers(hid_device_info* info, const std::string& name)
DetectedControllers DetectClevoKeyboardControllers(hid_device_info* info, const std::string& /*name*/)
{
DetectedControllers detected_controllers;
hid_device* dev;
@@ -199,6 +199,8 @@ RGBController_ClevoKeyboard::RGBController_ClevoKeyboard(ClevoKeyboardController
RGBController_ClevoKeyboard::~RGBController_ClevoKeyboard()
{
Shutdown();
delete controller;
}
@@ -10,8 +10,9 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "ClevoLightbarController.h"
#include <cstring>
#include "ClevoLightbarController.h"
#include "StringUtils.h"
ClevoLightbarController::ClevoLightbarController(hid_device* dev_handle, const hid_device_info& info)
{
@@ -40,10 +41,7 @@ std::string ClevoLightbarController::GetSerialString()
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
return(StringUtils::wstring_to_string(serial_string));
}
std::string ClevoLightbarController::GetFirmwareVersion()
@@ -9,8 +9,8 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "DetectionManager.h"
#include "ClevoLightbarController.h"
#include "DetectionManager.h"
#include "RGBController_ClevoLightbar.h"
#include "RGBController.h"
#include <hidapi.h>
@@ -25,7 +25,7 @@
\*---------------------------------------------------------*/
#define CLEVO_LIGHTBAR_PID 0x7001
DetectedControllers DetectClevoLightbarControllers(hid_device_info* info, const std::string& name)
DetectedControllers DetectClevoLightbarControllers(hid_device_info* info, const std::string& /*name*/)
{
DetectedControllers detected_controllers;
hid_device* dev;
@@ -121,6 +121,8 @@ RGBController_ClevoLightbar::RGBController_ClevoLightbar(ClevoLightbarController
RGBController_ClevoLightbar::~RGBController_ClevoLightbar()
{
Shutdown();
delete controller;
}
@@ -26,7 +26,7 @@ ColorfulGPUController::~ColorfulGPUController()
std::string ColorfulGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -45,7 +45,7 @@ void ColorfulGPUController::SetDirect(RGBColor color)
uint8_t g = RGBGetGValue(color);
uint8_t b = RGBGetBValue(color);
if(this->bus->pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
if(this->bus->info.pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
{
uint8_t data_pkt[COLORFUL_PACKET_LENGTH_V2] = { 0xAA, 0xEF, 0x01, 0x04, 0x88, 0x26 };
for(int i=6; i < COLORFUL_PACKET_LENGTH_V2 -2; i = i + 3)
@@ -76,3 +76,6 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", Detec
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4080_ULTRAW_OCV2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV2, 0x61);
@@ -44,6 +44,8 @@ RGBController_ColorfulGPU::RGBController_ColorfulGPU(ColorfulGPUController * col
RGBController_ColorfulGPU::~RGBController_ColorfulGPU()
{
Shutdown();
delete controller;
}
@@ -24,7 +24,7 @@ ColorfulTuringGPUController::~ColorfulTuringGPUController()
std::string ColorfulTuringGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -17,7 +17,7 @@ DetectedControllers DetectColorfulTuringGPUControllers(i2c_smbus_interface* bus,
{
DetectedControllers detected_controllers;
if(bus->port_id == 1)
if(bus->info.port_id == 1)
{
ColorfulTuringGPUController* controller = new ColorfulTuringGPUController(bus, i2c_addr, name);
RGBController_ColorfulTuringGPU* rgb_controller = new RGBController_ColorfulTuringGPU(controller);
@@ -75,6 +75,8 @@ RGBController_ColorfulTuringGPU::RGBController_ColorfulTuringGPU(ColorfulTuringG
RGBController_ColorfulTuringGPU::~RGBController_ColorfulTuringGPU()
{
Shutdown();
delete controller;
}
@@ -12,16 +12,27 @@
#include "CMARGBController.h"
#include "StringUtils.h"
CMARGBController::CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx, std::shared_ptr<std::mutex> cm_mutex)
/*---------------------------------------------------------*\
| Map to convert port index to port ID used in protocol |
\*---------------------------------------------------------*/
static unsigned char cm_argb_port_index_to_id[5] =
{
dev = dev_handle;
location = _path;
zone_index = _zone_idx;
mutex_ptr = cm_mutex;
CM_ARGB_PORT_ARGB_1,
CM_ARGB_PORT_ARGB_2,
CM_ARGB_PORT_ARGB_3,
CM_ARGB_PORT_ARGB_4,
CM_ARGB_PORT_RGB
};
/*---------------------------------------------------------*\
| Get device name from HID manufacturer and product strings |
\*---------------------------------------------------------*/
CMARGBController::CMARGBController(hid_device* dev_handle, char *path)
{
dev = dev_handle;
location = path;
/*-----------------------------------------------------*\
| Get device name from HID manufacturer and product |
| strings |
\*-----------------------------------------------------*/
wchar_t name_string[HID_MAX_STR];
hid_get_manufacturer_string(dev, name_string, HID_MAX_STR);
@@ -29,57 +40,11 @@ CMARGBController::CMARGBController(hid_device* dev_handle, char *_path, unsigned
hid_get_product_string(dev, name_string, HID_MAX_STR);
device_name.append(" ").append(StringUtils::wstring_to_string(name_string));
GetStatus();
}
CMARGBController::~CMARGBController()
{
if(mutex_ptr.use_count() <= 1)
{
hid_close(dev);
}
}
void CMARGBController::GetStatus()
{
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x0B, 0x01 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
int rgb_offset = 0;
int zone;
if (argb_header_data[zone_index].digital)
{
zone = argb_header_data[zone_index].header;
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
}
else
{
zone = 0x00;
buffer[CM_ARGB_COMMAND_BYTE] = 0x0A;
rgb_offset = 1;
}
/*---------------------------------------------*\
| Guard the writes to the controller until the |
| for loop has completed to avoid collisons |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
/*---------------------------------------------------------*\
| If this is the group then just return the first status |
\*---------------------------------------------------------*/
buffer[CM_ARGB_ZONE_BYTE] = ( zone > 0x08 ) ? 0x01 : zone;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
current_mode = buffer[4 - rgb_offset];
bool_random = ( buffer[5 - rgb_offset] == 0x00 );
current_speed = buffer[6 - rgb_offset];
current_brightness = buffer[7 - rgb_offset];
current_red = buffer[8 - rgb_offset];
current_green = buffer[9 - rgb_offset];
current_blue = buffer[10 - rgb_offset];
hid_close(dev);
}
std::string CMARGBController::GetDeviceName()
@@ -87,6 +52,33 @@ std::string CMARGBController::GetDeviceName()
return(device_name);
}
std::string CMARGBController::GetLocation()
{
return("HID: " + location);
}
std::string CMARGBController::GetVersion()
{
/*-----------------------------------------------------*\
| This device uses the serial value to determine the |
| version. It does not report a proper unique serial. |
\*-----------------------------------------------------*/
std::string serial_string = GetSerial();
if(serial_string == CM_ARGB_FW0023)
{
return("0023");
}
else if(serial_string == CM_ARGB_FW0028)
{
return("0028");
}
else
{
return("Unsupported");
}
}
std::string CMARGBController::GetSerial()
{
wchar_t serial_string[HID_MAX_STR];
@@ -100,118 +92,187 @@ std::string CMARGBController::GetSerial()
return(StringUtils::wstring_to_string(serial_string));
}
std::string CMARGBController::GetLocation()
void CMARGBController::GetPortStatus
(
unsigned char port_idx,
unsigned char* port_mode,
unsigned char* port_speed,
unsigned char* port_brightness,
bool* port_random,
unsigned char* port_red,
unsigned char* port_green,
unsigned char* port_blue
)
{
return("HID: " + location);
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00, 0x80, 0x0B, 0x01};
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
int rgb_offset = 0;
int zone;
/*-----------------------------------------------------*\
| RGB port is handled differently from ARGB ports |
\*-----------------------------------------------------*/
if(cm_argb_port_index_to_id[port_idx] != CM_ARGB_PORT_RGB)
{
zone = cm_argb_port_index_to_id[port_idx];
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
}
else
{
zone = 0x00;
buffer[CM_ARGB_COMMAND_BYTE] = 0x0A;
rgb_offset = 1;
}
/*-----------------------------------------------------*\
| If this is the group then just return the first |
| status |
\*-----------------------------------------------------*/
buffer[CM_ARGB_ZONE_BYTE] = ( zone > 0x08 ) ? 0x01 : zone;
/*-----------------------------------------------------*\
| Send the command and read the response |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
/*-----------------------------------------------------*\
| Read data out of response |
\*-----------------------------------------------------*/
*port_mode = buffer[4 - rgb_offset];
*port_random = (buffer[5 - rgb_offset] == 0x00);
*port_speed = buffer[6 - rgb_offset];
*port_brightness = buffer[7 - rgb_offset];
*port_red = buffer[8 - rgb_offset];
*port_green = buffer[9 - rgb_offset];
*port_blue = buffer[10 - rgb_offset];
}
unsigned char CMARGBController::GetZoneIndex()
void CMARGBController::SetPortLEDCount(unsigned char port_idx, unsigned char led_count)
{
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);
}
bool CMARGBController::GetRandomColours()
{
return(bool_random);
}
void CMARGBController::SetLedCount(int zone, int led_count)
{
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x0D, 0x02 };
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00, 0x80, 0x0D, 0x02};
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
buffer[CM_ARGB_ZONE_BYTE] = zone;
buffer[CM_ARGB_ZONE_BYTE] = cm_argb_port_index_to_id[port_idx];
buffer[CM_ARGB_MODE_BYTE] = led_count;
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = (0x0F - led_count > 0) ? 0x0F - led_count : 0x01;
/*---------------------------------------------*\
| Guard the writes to the controller until the |
| for loop has completed to avoid collisons |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = 1;
/*-----------------------------------------------------*\
| Send the command |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
}
void CMARGBController::SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, RGBColor colour, bool random_colours)
void CMARGBController::SetPortMode
(
unsigned char port_idx,
unsigned char port_mode,
unsigned char port_speed,
unsigned char port_brightness,
bool port_random,
unsigned char port_red,
unsigned char port_green,
unsigned char port_blue
)
{
bool needs_update = !( (current_mode == mode) && (current_speed == speed) && (current_brightness == brightness) && (ToRGBColor(current_red, current_green, current_blue) == colour));
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00};
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
bool boolARGB_header = (cm_argb_port_index_to_id[port_idx] != CM_ARGB_PORT_RGB);
bool boolPassthru = (port_mode == CM_ARGB_MODE_PASSTHRU) || (port_mode == CM_RGB_MODE_PASSTHRU);
bool boolDirect = (port_mode == CM_ARGB_MODE_DIRECT);
unsigned char function = boolPassthru ? (boolARGB_header ? 0x02 : 0x04) : (boolARGB_header ? 0x01 : 0x03);
buffer[CM_ARGB_REPORT_BYTE] = 0x80;
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
if (needs_update)
if(boolDirect)
{
current_mode = mode;
current_speed = speed;
current_brightness = brightness;
current_red = RGBGetRValue(colour);
current_green = RGBGetGValue(colour);
current_blue = RGBGetBValue(colour);
bool_random = random_colours;
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
buffer[CM_ARGB_ZONE_BYTE] = 0x02;
SendUpdate();
/*-------------------------------------------------*\
| Send the command |
\*-------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
/*-------------------------------------------------*\
| Direct mode is now set up and no other mode |
| packet is required |
\*-------------------------------------------------*/
return;
}
buffer[CM_ARGB_FUNCTION_BYTE] = function;
/*-----------------------------------------------------*\
| Send the command |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
/*-----------------------------------------------------*\
| ARGB ports send command 0x0B, RGB port sends 0x04 |
\*-----------------------------------------------------*/
if(boolARGB_header)
{
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
buffer[CM_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02;
buffer[CM_ARGB_ZONE_BYTE] = cm_argb_port_index_to_id[port_idx];
buffer[CM_ARGB_MODE_BYTE] = port_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = port_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE] = port_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE] = port_brightness;
buffer[CM_ARGB_RED_BYTE] = port_red;
buffer[CM_ARGB_GREEN_BYTE] = port_green;
buffer[CM_ARGB_BLUE_BYTE] = port_blue;
}
else
{
buffer[CM_ARGB_COMMAND_BYTE] = boolPassthru ? 0x01 : 0x04;
buffer[CM_ARGB_MODE_BYTE + CM_RGB_OFFSET] = port_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE + CM_RGB_OFFSET] = port_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE + CM_RGB_OFFSET] = port_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE + CM_RGB_OFFSET] = port_brightness;
buffer[CM_ARGB_RED_BYTE + CM_RGB_OFFSET] = port_red;
buffer[CM_ARGB_GREEN_BYTE + CM_RGB_OFFSET] = port_green;
buffer[CM_ARGB_BLUE_BYTE + CM_RGB_OFFSET] = port_blue;
}
/*-----------------------------------------------------*\
| Send the command and wait for response |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
}
void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_count)
void CMARGBController::SetPortLEDsDirect(unsigned char port_idx, RGBColor *led_colours, unsigned int led_count)
{
const unsigned char buffer_size = CM_ARGB_PACKET_SIZE;
unsigned char buffer[buffer_size] = { 0x00, 0x00, 0x07, 0x02 };
unsigned char packet_count = 0;
std::vector<uint8_t> colours;
/*---------------------------------------------*\
| Set up the RGB triplets to send |
\*---------------------------------------------*/
/*-----------------------------------------------------*\
| Set up the RGB triplets to send |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i < led_count; i++)
{
RGBColor colour = led_colours[i];
colours.push_back( RGBGetRValue(colour) );
colours.push_back( RGBGetGValue(colour) );
colours.push_back( RGBGetBValue(colour) );
colours.push_back(RGBGetRValue(colour));
colours.push_back(RGBGetGValue(colour));
colours.push_back(RGBGetBValue(colour));
}
buffer[CM_ARGB_FUNCTION_BYTE] = zone_index - 1;
buffer[CM_ARGB_FUNCTION_BYTE] = port_idx;
buffer[CM_ARGB_ZONE_BYTE] = led_count;
unsigned char buffer_idx = CM_ARGB_MODE_BYTE;
/*---------------------------------------------*\
| Guard the writes to the controller until the |
| for loop has completed to avoid collisons |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
for(std::vector<unsigned char>::iterator it = colours.begin(); it != colours.end(); buffer_idx = CM_ARGB_COMMAND_BYTE)
{
/*-----------------------------------------------------------------*\
| Fill the write buffer till its full or the colour buffer is empty |
\*-----------------------------------------------------------------*/
/*-------------------------------------------------*\
| 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() ))
while((buffer_idx < buffer_size) && (it != colours.end()))
{
buffer[buffer_idx] = *it;
buffer_idx++;
@@ -223,76 +284,15 @@ void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_cou
buffer[CM_ARGB_REPORT_BYTE] += 0x80;
}
/*-------------------------------------------------*\
| Send the buffer |
\*-------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
/*-----------------------------------------------------------------*\
| Reset the write buffer |
\*-----------------------------------------------------------------*/
/*-------------------------------------------------*\
| Reset the write buffer |
\*-------------------------------------------------*/
memset(buffer, 0x00, buffer_size );
packet_count++;
}
}
void CMARGBController::SendUpdate()
{
/*---------------------------------------------*\
| Guard the writes to the controller |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 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 ) || ( current_mode == CM_RGB_MODE_PASSTHRU );
bool boolDirect = ( current_mode == CM_ARGB_MODE_DIRECT );
unsigned char function = boolPassthru ? (boolARGB_header ? 0x02 : 0x04) : (boolARGB_header ? 0x01 : 0x03);
buffer[CM_ARGB_REPORT_BYTE] = 0x80;
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
if(boolDirect)
{
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
buffer[CM_ARGB_ZONE_BYTE] = 0x02;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
/*-----------------------------------------------------------------*\
| Direct mode is now set up and no other mode packet is required |
\*-----------------------------------------------------------------*/
return;
}
buffer[CM_ARGB_FUNCTION_BYTE] = function;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
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 direct mode TODO
buffer[CM_ARGB_ZONE_BYTE] = argb_header_data[zone_index].header;
buffer[CM_ARGB_MODE_BYTE] = current_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = bool_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE] = current_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE] = current_brightness;
buffer[CM_ARGB_RED_BYTE] = current_red;
buffer[CM_ARGB_GREEN_BYTE] = current_green;
buffer[CM_ARGB_BLUE_BYTE] = current_blue;
}
else
{
buffer[CM_ARGB_COMMAND_BYTE] = boolPassthru ? 0x01 : 0x04; //ARGB sends 0x0b (1011) RGB sends 0x04 (0100)
buffer[CM_ARGB_MODE_BYTE + CM_RGB_OFFSET] = current_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE + CM_RGB_OFFSET] = bool_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE + CM_RGB_OFFSET] = current_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE + CM_RGB_OFFSET] = current_brightness;
buffer[CM_ARGB_RED_BYTE + CM_RGB_OFFSET] = current_red;
buffer[CM_ARGB_GREEN_BYTE + CM_RGB_OFFSET] = current_green;
buffer[CM_ARGB_BLUE_BYTE + CM_RGB_OFFSET] = current_blue;
}
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
}
@@ -16,19 +16,20 @@
#include <array>
#include <memory>
#include <hidapi.h>
#include "RGBController.h" //Needed to set the direct mode
#include "RGBController.h"
#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_PACKET_SIZE 65
#define CM_ARGB_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define CM_RGB_OFFSET -2
#define HID_MAX_STR 255
#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_PACKET_SIZE 65
#define CM_ARGB_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define CM_RGB_OFFSET -2
#define HID_MAX_STR 255
#define CM_ARGB_BRIGHTNESS_MAX 255
#define CM_ARGB_FW0023 std::string("A202011171238")
#define CM_ARGB_FW0028 std::string("A202105291658")
#define CM_ARGB_BRIGHTNESS_MAX 255
#define CM_ARGB_FW0000 std::string("A201804091608")
#define CM_ARGB_FW0023 std::string("A202011171238")
#define CM_ARGB_FW0028 std::string("A202105291658")
enum
{
@@ -45,22 +46,13 @@ enum
CM_ARGB_BLUE_BYTE = 11
};
struct argb_headers
enum
{
const char* name;
unsigned char header;
bool digital;
unsigned int count;
};
static argb_headers argb_header_data[] =
{
{ "RGB Header", 0xFE, 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 }
CM_ARGB_PORT_ARGB_1 = 0x01,
CM_ARGB_PORT_ARGB_2 = 0x02,
CM_ARGB_PORT_ARGB_3 = 0x04,
CM_ARGB_PORT_ARGB_4 = 0x08,
CM_ARGB_PORT_RGB = 0xFE,
};
enum
@@ -101,40 +93,44 @@ enum
class CMARGBController
{
public:
CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx, std::shared_ptr<std::mutex> cm_mutex);
CMARGBController(hid_device* dev_handle, char* path);
~CMARGBController();
std::string GetDeviceName();
std::string GetSerial();
std::string GetLocation();
std::string GetVersion();
unsigned char GetZoneIndex();
unsigned char GetMode();
unsigned char GetLedRed();
unsigned char GetLedGreen();
unsigned char GetLedBlue();
unsigned char GetLedSpeed();
bool GetRandomColours();
void SetLedCount(int zone, int led_count);
void SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, RGBColor colour, bool random_colours);
void SetLedsDirect(RGBColor * led_colours, unsigned int led_count);
void GetPortStatus
(
unsigned char port_idx,
unsigned char* port_mode,
unsigned char* port_speed,
unsigned char* port_brightness,
bool* port_random,
unsigned char* port_red,
unsigned char* port_green,
unsigned char* port_blue
);
void SetPortLEDCount(unsigned char port_idx, unsigned char led_count);
void SetPortMode
(
unsigned char port_idx,
unsigned char port_mode,
unsigned char port_speed,
unsigned char port_brightness,
bool port_random,
unsigned char port_red,
unsigned char port_green,
unsigned char port_blue
);
void SetPortLEDsDirect(unsigned char port_idx, RGBColor *led_colours, unsigned int led_count);
private:
std::string device_name;
std::string location;
hid_device* dev;
std::shared_ptr<std::mutex> mutex_ptr;
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 char current_brightness;
bool bool_random;
void GetStatus();
void SendUpdate();
hid_device* dev;
std::string device_name;
std::string location;
};
@@ -27,401 +27,594 @@
RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController* controller_ptr)
{
controller = controller_ptr;
unsigned char speed = controller->GetLedSpeed();
name = argb_header_data[controller->GetZoneIndex()].name;
name = controller->GetDeviceName();
vendor = "Cooler Master";
type = DEVICE_TYPE_LEDSTRIP;
description = controller->GetDeviceName();
version = "3.0 for FW0028";
description = "Cooler Master ARGB Controller Device";
version = controller->GetVersion();
serial = controller->GetSerial();
location = controller->GetLocation();
if(argb_header_data[controller->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 | MODE_FLAG_HAS_BRIGHTNESS;
Reload.colors_min = 1;
Reload.colors_max = 1;
Reload.colors.resize(Reload.colors_max);
Reload.brightness_min = 0;
Reload.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Reload.brightness = CM_ARGB_BRIGHTNESS_MAX;
Reload.speed_min = CM_ARGB_SPEED_SLOWEST;
Reload.speed_max = CM_ARGB_SPEED_FASTEST;
Reload.color_mode = MODE_COLORS_MODE_SPECIFIC;
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 | MODE_FLAG_HAS_BRIGHTNESS;
Recoil.colors_min = 1;
Recoil.colors_max = 1;
Recoil.colors.resize(Recoil.colors_max);
Recoil.brightness_min = 0;
Recoil.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Recoil.brightness = CM_ARGB_BRIGHTNESS_MAX;
Recoil.speed_min = CM_ARGB_SPEED_SLOWEST;
Recoil.speed_max = CM_ARGB_SPEED_FASTEST;
Recoil.color_mode = MODE_COLORS_MODE_SPECIFIC;
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 | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
Breathing.brightness_min = 0;
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
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 | MODE_FLAG_HAS_BRIGHTNESS;
Refill.colors_min = 1;
Refill.colors_max = 1;
Refill.colors.resize(Refill.colors_max);
Refill.brightness_min = 0;
Refill.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Refill.brightness = CM_ARGB_BRIGHTNESS_MAX;
Refill.speed_min = CM_ARGB_SPEED_SLOWEST;
Refill.speed_max = CM_ARGB_SPEED_FASTEST;
Refill.color_mode = MODE_COLORS_MODE_SPECIFIC;
Refill.speed = speed;
modes.push_back(Refill);
mode Demo;
Demo.name = "Demo";
Demo.value = CM_ARGB_MODE_DEMO;
Demo.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Demo.brightness_min = 0;
Demo.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Demo.brightness = CM_ARGB_BRIGHTNESS_MAX;
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 | MODE_FLAG_HAS_BRIGHTNESS;
Spectrum.brightness_min = 0;
Spectrum.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Spectrum.brightness = CM_ARGB_BRIGHTNESS_MAX;
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 | MODE_FLAG_HAS_BRIGHTNESS;
FillFlow.brightness_min = 0;
FillFlow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
FillFlow.brightness = CM_ARGB_BRIGHTNESS_MAX;
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 | MODE_FLAG_HAS_BRIGHTNESS;
Rainbow.brightness_min = 0;
Rainbow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Rainbow.brightness = CM_ARGB_BRIGHTNESS_MAX;
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 Static;
Static.name = "Static";
Static.value = CM_ARGB_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(Static.colors_max);
Static.brightness_min = 0;
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
Static.speed_min = CM_ARGB_SPEED_SLOWEST;
Static.speed_max = CM_ARGB_SPEED_FASTEST;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.speed = speed;
modes.push_back(Static);
mode Direct;
Direct.name = (serial >= CM_ARGB_FW0028) ? "Direct" : "Custom";
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.flags = 0;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
}
else
{
mode Static;
Static.name = "Static";
Static.value = CM_RGB_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(Static.colors_max);
Static.brightness_min = 0;
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.speed = 0;
modes.push_back(Static);
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 | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
Breathing.brightness_min = 0;
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed = CM_ARGB_SPEED_NORMAL;
modes.push_back(Breathing);
mode Flash;
Flash.name = "Flash";
Flash.value = CM_RGB_MODE_FLASH;
Flash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Flash.colors_min = 1;
Flash.colors_max = 1;
Flash.colors.resize(Flash.colors_max);
Flash.brightness_min = 0;
Flash.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Flash.brightness = CM_ARGB_BRIGHTNESS_MAX;
Flash.speed_min = CM_ARGB_SPEED_SLOWEST;
Flash.speed_max = CM_ARGB_SPEED_FASTEST;
Flash.color_mode = MODE_COLORS_MODE_SPECIFIC;
Flash.speed = CM_ARGB_SPEED_NORMAL;
modes.push_back(Flash);
mode Mirage;
Mirage.name = "Mirage";
Mirage.value = CM_RGB_MODE_MIRAGE;
Mirage.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Mirage.colors_min = 1;
Mirage.colors_max = 1;
Mirage.colors.resize(Mirage.colors_max);
Mirage.brightness_min = 0;
Mirage.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Mirage.brightness = CM_ARGB_BRIGHTNESS_MAX;
Mirage.speed_min = CM_ARGB_SPEED_SLOWEST;
Mirage.speed_max = CM_ARGB_SPEED_FASTEST;
Mirage.color_mode = MODE_COLORS_MODE_SPECIFIC;
Mirage.speed = CM_ARGB_SPEED_NORMAL;
modes.push_back(Mirage);
mode PassThru;
PassThru.name = "Pass Thru";
PassThru.value = CM_RGB_MODE_PASSTHRU;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
mode Off;
Off.name = "Turn Off";
Off.value = CM_RGB_MODE_OFF;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
}
Init_Controller();
SetupZones();
SetupModes();
int temp_mode = controller->GetMode();
for(int mode_idx = 0; mode_idx < (int)modes.size() ; mode_idx++)
/*-----------------------------------------------------*\
| Initialize the active mode to port 0 |
\*-----------------------------------------------------*/
unsigned char port_mode;
unsigned char port_speed;
unsigned char port_brightness;
bool port_random;
unsigned char port_red;
unsigned char port_green;
unsigned char port_blue;
controller->GetPortStatus(0, &port_mode, &port_speed, &port_brightness, &port_random, &port_red, &port_green, &port_blue);
for(std::size_t mode_idx = 0; mode_idx < modes.size(); mode_idx++)
{
if (temp_mode == modes[mode_idx].value)
if(modes[mode_idx].value == port_mode)
{
active_mode = mode_idx;
active_mode = (int)mode_idx;
if((modes[mode_idx].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR) && (modes[mode_idx].colors.size() > 0))
{
modes[mode_idx].colors[0] = ToRGBColor(port_red, port_green, port_blue);
}
if(modes[mode_idx].flags & MODE_FLAG_HAS_SPEED)
{
modes[mode_idx].speed = port_speed;
}
if(modes[mode_idx].flags & MODE_FLAG_HAS_BRIGHTNESS)
{
modes[mode_idx].brightness = port_brightness;
}
if(modes[mode_idx].flags & MODE_FLAG_HAS_RANDOM_COLOR)
{
if(port_random)
{
modes[mode_idx].color_mode = MODE_COLORS_RANDOM;
}
}
break;
}
}
if (modes[active_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
{
modes[active_mode].colors[0] = ToRGBColor(controller->GetLedRed(), controller->GetLedGreen(), controller->GetLedBlue());
modes[active_mode].color_mode = (controller->GetRandomColours()) ? MODE_COLORS_RANDOM : MODE_COLORS_MODE_SPECIFIC;
}
if (modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
{
modes[active_mode].speed = controller->GetLedSpeed();
}
}
RGBController_CMARGBController::~RGBController_CMARGBController()
{
Shutdown();
delete controller;
}
void RGBController_CMARGBController::Init_Controller()
void RGBController_CMARGBController::SetupModes()
{
int zone_idx = controller->GetZoneIndex();
int zone_led_count = argb_header_data[zone_idx].count;
/*-----------------------------------------------------*\
| Define Direct and Passthrough modes as require entire |
| device, these are not available as per-zone modes |
\*-----------------------------------------------------*/
mode Direct;
Direct.name = (serial >= CM_ARGB_FW0028) ? "Direct" : "Custom";
Direct.value = CM_ARGB_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
/*-------------------------------------------------*\
| If argb_header_data[zone_idx].count == 1 then the |
| zone is ZONE_TYPE_SINGLE |
\*-------------------------------------------------*/
bool boolSingleLED = ( zone_led_count == 1 );
mode PassThru;
PassThru.name = "Passthrough";
PassThru.value = CM_ARGB_MODE_PASSTHRU | MODE_FLAG_REQUIRES_ENTIRE_DEVICE;
PassThru.flags = 0;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
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 = 4;
ARGB_zone.leds_max = 48;
ARGB_zone.leds_count = zone_led_count;
zones.push_back(ARGB_zone);
/*-----------------------------------------------------*\
| The ARGB ports support more modes than the RGB port. |
| Define all of the modes the ARGB ports support and |
| map RGB modes to them as best as we can. |
\*-----------------------------------------------------*/
mode Off;
Off.name = "Off";
Off.value = CM_ARGB_MODE_OFF;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].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 | MODE_FLAG_HAS_BRIGHTNESS;
Reload.speed_min = CM_ARGB_SPEED_SLOWEST;
Reload.speed_max = CM_ARGB_SPEED_FASTEST;
Reload.speed = CM_ARGB_SPEED_NORMAL;
Reload.brightness_min = 0;
Reload.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Reload.brightness = CM_ARGB_BRIGHTNESS_MAX;
Reload.color_mode = MODE_COLORS_MODE_SPECIFIC;
Reload.colors_min = 1;
Reload.colors_max = 1;
Reload.colors.resize(Reload.colors_max);
modes.push_back(Reload);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].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 | MODE_FLAG_HAS_BRIGHTNESS;
Recoil.color_mode = MODE_COLORS_MODE_SPECIFIC;
Recoil.speed_min = CM_ARGB_SPEED_SLOWEST;
Recoil.speed_max = CM_ARGB_SPEED_FASTEST;
Recoil.speed = CM_ARGB_SPEED_NORMAL;
Recoil.brightness_min = 0;
Recoil.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Recoil.brightness = CM_ARGB_BRIGHTNESS_MAX;
Recoil.colors_min = 1;
Recoil.colors_max = 1;
Recoil.colors.resize(Recoil.colors_max);
modes.push_back(Recoil);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].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 | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.speed = CM_ARGB_SPEED_NORMAL;
Breathing.brightness_min = 0;
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
modes.push_back(Breathing);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].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 | MODE_FLAG_HAS_BRIGHTNESS;
Refill.color_mode = MODE_COLORS_MODE_SPECIFIC;
Refill.speed_min = CM_ARGB_SPEED_SLOWEST;
Refill.speed_max = CM_ARGB_SPEED_FASTEST;
Refill.speed = CM_ARGB_SPEED_NORMAL;
Refill.brightness_min = 0;
Refill.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Refill.brightness = CM_ARGB_BRIGHTNESS_MAX;
Refill.colors_min = 1;
Refill.colors_max = 1;
Refill.colors.resize(Refill.colors_max);
modes.push_back(Refill);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Refill);
}
mode Demo;
Demo.name = "Demo";
Demo.value = CM_ARGB_MODE_DEMO;
Demo.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Demo.color_mode = MODE_COLORS_NONE;
Demo.speed_min = CM_ARGB_SPEED_SLOWEST;
Demo.speed_max = CM_ARGB_SPEED_FASTEST;
Demo.speed = CM_ARGB_SPEED_NORMAL;
Demo.brightness_min = 0;
Demo.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Demo.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(Demo);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Demo);
}
mode Spectrum;
Spectrum.name = "Rainbow Wave";
Spectrum.value = CM_ARGB_MODE_SPECTRUM;
Spectrum.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Spectrum.color_mode = MODE_COLORS_NONE;
Spectrum.speed_min = CM_ARGB_SPEED_SLOWEST;
Spectrum.speed_max = CM_ARGB_SPEED_FASTEST;
Spectrum.speed = CM_ARGB_SPEED_NORMAL;
Spectrum.brightness_min = 0;
Spectrum.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Spectrum.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(Spectrum);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Spectrum);
}
mode FillFlow;
FillFlow.name = "Fill Flow";
FillFlow.value = CM_ARGB_MODE_FILLFLOW;
FillFlow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
FillFlow.color_mode = MODE_COLORS_NONE;
FillFlow.speed_min = CM_ARGB_SPEED_SLOWEST;
FillFlow.speed_max = CM_ARGB_SPEED_FASTEST;
FillFlow.speed = CM_ARGB_SPEED_NORMAL;
FillFlow.brightness_min = 0;
FillFlow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
FillFlow.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(FillFlow);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(FillFlow);
}
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CM_ARGB_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.speed_min = CM_ARGB_SPEED_SLOWEST;
Rainbow.speed_max = CM_ARGB_SPEED_FASTEST;
Rainbow.speed = CM_ARGB_SPEED_NORMAL;
Rainbow.brightness_min = 0;
Rainbow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Rainbow.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(Rainbow);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Rainbow);
}
mode Static;
Static.name = "Static";
Static.value = CM_ARGB_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.brightness_min = 0;
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(Static.colors_max);
modes.push_back(Static);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Static);
}
/*-----------------------------------------------------*\
| Define zone-specific modes for the RGB port |
\*-----------------------------------------------------*/
mode RGBOff;
RGBOff.name = "Off";
RGBOff.value = CM_RGB_MODE_OFF;
RGBOff.color_mode = MODE_COLORS_NONE;
zones[4].modes.push_back(RGBOff);
mode RGBMirage;
RGBMirage.name = "Mirage";
RGBMirage.value = CM_RGB_MODE_MIRAGE;
RGBMirage.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBMirage.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBMirage.speed_min = CM_ARGB_SPEED_SLOWEST;
RGBMirage.speed_max = CM_ARGB_SPEED_FASTEST;
RGBMirage.speed = CM_ARGB_SPEED_NORMAL;
RGBMirage.brightness_min = 0;
RGBMirage.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBMirage.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBMirage.colors_min = 1;
RGBMirage.colors_max = 1;
RGBMirage.colors.resize(RGBMirage.colors_max);
zones[4].modes.push_back(RGBMirage);
mode RGBFlash;
RGBFlash.name = "Flash";
RGBFlash.value = CM_RGB_MODE_FLASH;
RGBFlash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBFlash.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBFlash.speed_min = CM_ARGB_SPEED_SLOWEST;
RGBFlash.speed_max = CM_ARGB_SPEED_FASTEST;
RGBFlash.speed = CM_ARGB_SPEED_NORMAL;
RGBFlash.brightness_min = 0;
RGBFlash.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBFlash.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBFlash.colors_min = 1;
RGBFlash.colors_max = 1;
RGBFlash.colors.resize(RGBFlash.colors_max);
zones[4].modes.push_back(RGBFlash);
mode RGBBreathing;
RGBBreathing.name = "Breathing";
RGBBreathing.value = CM_RGB_MODE_BREATHING;
RGBBreathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBBreathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBBreathing.speed_min = CM_ARGB_SPEED_SLOWEST;
RGBBreathing.speed_max = CM_ARGB_SPEED_FASTEST;
RGBBreathing.speed = CM_ARGB_SPEED_NORMAL;
RGBBreathing.brightness_min = 0;
RGBBreathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBBreathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBBreathing.colors_min = 1;
RGBBreathing.colors_max = 1;
RGBBreathing.colors.resize(RGBBreathing.colors_max);
zones[4].modes.push_back(RGBBreathing);
mode RGBStatic;
RGBStatic.name = "Static";
RGBStatic.value = CM_RGB_MODE_STATIC;
RGBStatic.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBStatic.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBStatic.brightness_min = 0;
RGBStatic.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBStatic.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBStatic.colors_min = 1;
RGBStatic.colors_max = 1;
RGBStatic.colors.resize(RGBStatic.colors_max);
zones[4].modes.push_back(RGBStatic);
}
void RGBController_CMARGBController::SetupZones()
{
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
/*-----------------------------------------------------*\
| 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(5);
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
/*-----------------------------------------------------*\
| Set up addressable zones |
\*-----------------------------------------------------*/
for(unsigned int channel_idx = 0; channel_idx < 4; channel_idx++)
{
bool boolSingleLED = (zones[zone_idx].type == ZONE_TYPE_SINGLE);
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = 48;
if (!boolSingleLED)
if(first_run)
{
controller->SetLedCount( std::stoi(zones[zone_idx].name), zones[zone_idx].leds_count);
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
led new_led;
unsigned int i = std::stoi(zones[zone_idx].name);
zones[channel_idx].name = "Addressable RGB Header ";
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
}
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;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[channel_idx].leds_count = 0;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[channel_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[channel_idx].matrix_map.width = 0;
zones[channel_idx].matrix_map.height = 0;
zones[channel_idx].matrix_map.map.resize(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);
}
}
/*-----------------------------------------------------*\
| Set up RGB zone |
\*-----------------------------------------------------*/
zones[4].name = "RGB Header";
zones[4].type = ZONE_TYPE_SINGLE;
zones[4].leds_min = 1;
zones[4].leds_max = 1;
zones[4].leds_count = 1;
led new_led;
new_led.name = "RGB Header";
new_led.value = 4;
leds.push_back(new_led);
SetupColors();
}
void RGBController_CMARGBController::DeviceResizeZone(int zone, int new_size)
void RGBController_CMARGBController::DeviceConfigureZone(int zone_idx)
{
if((size_t) zone >= zones.size())
if((size_t)zone_idx < zones.size())
{
return;
}
uint8_t end_zone = last_zone(zone);
controller->SetPortLEDCount(zone_idx, zones[zone_idx].leds_count);
for(std::size_t zone_idx = first_zone(zone); zone_idx < end_zone; zone_idx++)
{
if(((unsigned int)new_size >= zones[zone_idx].leds_min) && ((unsigned int)new_size <= zones[zone_idx].leds_max))
{
zones[zone_idx].leds_count = new_size;
}
SetupZones();
}
SetupZones();
}
void RGBController_CMARGBController::DeviceUpdateLEDs()
{
uint8_t end_zone = last_zone(cmargb->GetZoneIndex());
for(int zone_idx = first_zone(cmargb->GetZoneIndex()); zone_idx < end_zone; zone_idx++)
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
DeviceUpdateZoneLEDs(zone_idx);
DeviceUpdateZoneLEDs((int)zone_idx);
}
}
void RGBController_CMARGBController::DeviceUpdateZoneLEDs(int zone)
{
controller->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
if(modes[active_mode].value != CM_ARGB_MODE_DIRECT)
{
return;
}
/*-----------------------------------------------------*\
| The RGB zone doesn't have a separate Direct mode, so |
| use static mode with the per-LED color for it |
\*-----------------------------------------------------*/
if(zone < 4)
{
controller->SetPortLEDsDirect(zone, zones[zone].colors, zones[zone].leds_count);
}
else
{
controller->SetPortMode(zone, CM_RGB_MODE_STATIC, 0, 255, false, RGBGetRValue(zones[zone].colors[0]), RGBGetGValue(zones[zone].colors[0]), RGBGetBValue(zones[zone].colors[0]));
}
}
void RGBController_CMARGBController::DeviceUpdateSingleLED(int led)
{
DeviceUpdateZoneLEDs(GetLED_Zone(led));
unsigned int zone_idx = leds[led].value;
UpdateZoneLEDs(zone_idx);
}
void RGBController_CMARGBController::DeviceUpdateMode()
{
bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
RGBColor colour = (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC) ? modes[active_mode].colors[0] : 0;
controller->SetMode( modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, colour, random_colours );
/*-----------------------------------------------------*\
| Apply mode to all zones |
\*-----------------------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
DeviceUpdateZoneMode((int)zone_idx);
}
}
int RGBController_CMARGBController::GetLED_Zone(int led_idx)
void RGBController_CMARGBController::DeviceUpdateZoneMode(int zone)
{
/*---------------------------------------------------------*\
| This may be more useful in the abstract RGBController.cpp |
\*---------------------------------------------------------*/
for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++)
{
int zone_start = zones[zone_idx].start_idx;
int zone_end = zone_start + zones[zone_idx].leds_count - 1;
/*-----------------------------------------------------*\
| Determine the active mode for this zone |
\*-----------------------------------------------------*/
bool use_zone_mode = false;
int zone_active_mode = active_mode;
int zone_mode_value = modes[active_mode].value;
if(zone_start <= led_idx && zone_end >= led_idx)
/*-----------------------------------------------------*\
| Set up mode parameters |
\*-----------------------------------------------------*/
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
RGBColor color = 0;
unsigned int brightness = modes[active_mode].brightness;
unsigned int speed = modes[active_mode].speed;
if(modes[active_mode].colors.size() > 0)
{
color = modes[active_mode].colors[0];
}
if(!(modes[active_mode].flags & MODE_FLAG_REQUIRES_ENTIRE_DEVICE))
{
if(zones[zone].active_mode >= 0)
{
return(zone_idx);
use_zone_mode = true;
zone_active_mode = zones[zone].active_mode;
zone_mode_value = zones[zone].modes[zone_active_mode].value;
random = (zones[zone].modes[zone_active_mode].color_mode == MODE_COLORS_RANDOM);
if(zones[zone].modes[zone_active_mode].colors.size() > 0)
{
color = zones[zone].modes[zone_active_mode].colors[0];
}
brightness = zones[zone].modes[zone_active_mode].brightness;
speed = zones[zone].modes[zone_active_mode].speed;
}
}
return -1;
if((zone == 4) && !use_zone_mode)
{
/*-------------------------------------------------*\
| Map entire-device ARGB modes with the equivalent |
| RGB modes for the RGB zone |
\*-------------------------------------------------*/
switch(modes[active_mode].value)
{
case CM_ARGB_MODE_SPECTRUM:
case CM_ARGB_MODE_FILLFLOW:
case CM_ARGB_MODE_RAINBOW:
zone_mode_value = CM_RGB_MODE_MIRAGE;
random = true;
break;
case CM_ARGB_MODE_RELOAD:
case CM_ARGB_MODE_RECOIL:
zone_mode_value = CM_RGB_MODE_FLASH;
break;
case CM_ARGB_MODE_BREATHING:
zone_mode_value = CM_RGB_MODE_BREATHING;
break;
case CM_ARGB_MODE_REFILL:
case CM_ARGB_MODE_STATIC:
zone_mode_value = CM_RGB_MODE_STATIC;
break;
case CM_ARGB_MODE_DEMO:
zone_mode_value = CM_RGB_MODE_FLASH;
random = true;
break;
case CM_ARGB_MODE_OFF:
default:
zone_mode_value = CM_RGB_MODE_OFF;
break;
case CM_ARGB_MODE_PASSTHRU:
zone_mode_value = CM_RGB_MODE_PASSTHRU;
break;
}
}
controller->SetPortMode
(
zone,
zone_mode_value,
speed,
brightness,
random,
RGBGetRValue(color),
RGBGetGValue(color),
RGBGetBValue(color)
);
}
@@ -12,11 +12,8 @@
#pragma once
#include <vector>
#include "RGBController.h"
#include "CMARGBController.h"
#define first_zone(zn) ((zones.size() > 1) ? 1 : 0)
#define last_zone(zn) ((zones.size() > 1) ? 4 : 1)
#include "RGBController.h"
class RGBController_CMARGBController : public RGBController
{
@@ -24,19 +21,19 @@ public:
RGBController_CMARGBController(CMARGBController* controller_ptr);
~RGBController_CMARGBController();
void SetupModes();
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceUpdateZoneMode(int zone);
private:
void Init_Controller();
int GetDeviceMode();
int GetLED_Zone(int led_idx);
CMARGBController* controller;
CMARGBController* controller;
std::vector<unsigned int> leds_channel;
};
@@ -186,6 +186,8 @@ RGBController_CMARGBGen2A1Controller::RGBController_CMARGBGen2A1Controller(CMARG
RGBController_CMARGBGen2A1Controller::~RGBController_CMARGBGen2A1Controller()
{
Shutdown();
delete controller;
}
@@ -218,10 +220,8 @@ void RGBController_CMARGBGen2A1Controller::SetupZones()
SetupColors();
}
void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_size)
void RGBController_CMARGBGen2A1Controller::DeviceConfigureZone(int zone_idx)
{
zones[zone].leds_count = new_size;
unsigned int total_leds = 0;
for(unsigned int channel = 0; channel < CM_ARGB_GEN2_A1_CHANNEL_COUNT; channel++)
@@ -236,7 +236,7 @@ void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_si
leds[i].name = "LED " + std::to_string(i + 1);
}
controller->SetupZoneSize(zone, new_size);
controller->SetupZoneSize(zone_idx, zones[zone_idx].leds_count);
SetupColors();
}
@@ -23,7 +23,7 @@ public:
~RGBController_CMARGBGen2A1Controller();
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void UpdateSegmentLEDs(int zone, int subchannel);
@@ -140,6 +140,8 @@ RGBController_CMGD160Controller::RGBController_CMGD160Controller(CMGD160Controll
RGBController_CMGD160Controller::~RGBController_CMGD160Controller()
{
Shutdown();
delete controller;
}
@@ -49,6 +49,8 @@ RGBController_CMKeyboardController::RGBController_CMKeyboardController(CMKeyboar
RGBController_CMKeyboardController::~RGBController_CMKeyboardController()
{
Shutdown();
if(m_pController)
{
delete m_pController;
@@ -129,6 +129,8 @@ RGBController_CMMM711Controller::RGBController_CMMM711Controller(CMMM711Controll
RGBController_CMMM711Controller::~RGBController_CMMM711Controller()
{
Shutdown();
delete controller;
}
@@ -122,6 +122,8 @@ RGBController_CMMM712Controller::RGBController_CMMM712Controller(CMMM712Controll
RGBController_CMMM712Controller::~RGBController_CMMM712Controller()
{
Shutdown();
delete controller;
}
@@ -168,6 +168,8 @@ RGBController_CMMMController::RGBController_CMMMController(CMMMController* contr
RGBController_CMMMController::~RGBController_CMMMController()
{
Shutdown();
delete controller;
}
@@ -93,6 +93,8 @@ RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controll
RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
{
Shutdown();
delete controller;
}
@@ -141,6 +141,8 @@ RGBController_CMMonitorController::RGBController_CMMonitorController(CMMonitorCo
RGBController_CMMonitorController::~RGBController_CMMonitorController()
{
Shutdown();
delete controller;
}
@@ -152,6 +152,8 @@ RGBController_CMR6000Controller::RGBController_CMR6000Controller(CMR6000Controll
RGBController_CMR6000Controller::~RGBController_CMR6000Controller()
{
Shutdown();
delete controller;
}
@@ -153,6 +153,8 @@ RGBController_CMRGBController::RGBController_CMRGBController(CMRGBController* co
RGBController_CMRGBController::~RGBController_CMRGBController()
{
Shutdown();
delete controller;
}
@@ -18,11 +18,10 @@ cm_small_argb_headers cm_small_argb_header_data[1] =
{ "CM Small ARGB", 0x01, true, 12 }
};
CMSmallARGBController::CMSmallARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx)
CMSmallARGBController::CMSmallARGBController(hid_device* dev_handle, char *_path)
{
dev = dev_handle;
location = _path;
zone_index = _zone_idx;
current_speed = CM_SMALL_ARGB_SPEED_NORMAL;
/*---------------------------------------------------------*\
@@ -51,7 +50,7 @@ void CMSmallARGBController::GetStatus()
{
unsigned char buffer[CM_SMALL_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x01, 0x01 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
int header = zone_index - 1;
int header = 0 - 1;
buffer[CM_SMALL_ARGB_ZONE_BYTE] = header;
buffer[CM_SMALL_ARGB_MODE_BYTE] = 0x01;
@@ -98,11 +97,6 @@ std::string CMSmallARGBController::GetLocation()
return("HID: " + location);
}
unsigned char CMSmallARGBController::GetZoneIndex()
{
return(zone_index);
}
unsigned char CMSmallARGBController::GetMode()
{
return(current_mode);
@@ -177,7 +171,7 @@ void CMSmallARGBController::SetLedsDirect(RGBColor* led_colours, unsigned int le
colours.push_back( RGBGetBValue(colour) );
}
buffer[CM_SMALL_ARGB_ZONE_BYTE] = zone_index - 1; //argb_header_data[zone_index].header;
buffer[CM_SMALL_ARGB_ZONE_BYTE] = 0 - 1; //argb_header_data[zone_index].header;
buffer[CM_SMALL_ARGB_MODE_BYTE] = led_count;
unsigned char buffer_idx = CM_SMALL_ARGB_MODE_BYTE + 1;
@@ -225,7 +219,7 @@ void CMSmallARGBController::SendUpdate()
buffer[CM_SMALL_ARGB_COMMAND_BYTE] = 0x0b;
buffer[CM_SMALL_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02; //This controls custom mode TODO
buffer[CM_SMALL_ARGB_ZONE_BYTE] = cm_small_argb_header_data[zone_index].header;
buffer[CM_SMALL_ARGB_ZONE_BYTE] = cm_small_argb_header_data[0].header;
buffer[CM_SMALL_ARGB_MODE_BYTE] = current_mode;
buffer[CM_SMALL_ARGB_SPEED_BYTE] = current_speed;
buffer[CM_SMALL_ARGB_COLOUR_INDEX_BYTE] = (bool_random) ? 0x00 : 0x10; //This looks to still be the colour index and controls random colours
@@ -74,14 +74,13 @@ enum
class CMSmallARGBController
{
public:
CMSmallARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx);
CMSmallARGBController(hid_device* dev_handle, char *_path);
~CMSmallARGBController();
std::string GetDeviceName();
std::string GetSerial();
std::string GetLocation();
unsigned char GetZoneIndex();
unsigned char GetMode();
unsigned char GetLedRed();
unsigned char GetLedGreen();
@@ -97,7 +96,6 @@ private:
std::string location;
hid_device* dev;
unsigned char zone_index;
unsigned char current_mode;
unsigned char current_speed;
@@ -29,7 +29,7 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
controller = controller_ptr;
unsigned char speed = controller->GetLedSpeed();
name = cm_small_argb_header_data[controller->GetZoneIndex()].name;
name = cm_small_argb_header_data[0].name;
vendor = "Cooler Master";
type = DEVICE_TYPE_LEDSTRIP;
description = controller->GetDeviceName();
@@ -152,7 +152,6 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
Init_Controller(); //Only processed on first run
SetupZones();
int temp_mode = controller->GetMode();
@@ -181,60 +180,75 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
RGBController_CMSmallARGBController::~RGBController_CMSmallARGBController()
{
Shutdown();
delete controller;
}
void RGBController_CMSmallARGBController::Init_Controller()
{
int zone_idx = controller->GetZoneIndex();
int zone_led_count = cm_small_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 = CM_SMALL_ARGB_MIN_LEDS;
ARGB_zone.leds_max = CM_SMALL_ARGB_MAX_LEDS;
ARGB_zone.leds_count = zone_led_count;
zones.push_back(ARGB_zone);
}
void RGBController_CMSmallARGBController::SetupZones()
{
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
/*-----------------------------------------------------*\
| 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(1);
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
/*-----------------------------------------------------*\
| Set up zones and LEDs |
\*-----------------------------------------------------*/
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
zones[zone_idx].leds_min = 0;
zones[zone_idx].leds_max = CM_SMALL_ARGB_MAX_LEDS;
if (!boolSingleLED)
if(first_run)
{
controller->SetLedCount(cm_small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
zones[zone_idx].name = "Addressable RGB Header";
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[zone_idx].leds_count = 0;
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[zone_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[zone_idx].matrix_map.width = 0;
zones[zone_idx].matrix_map.height = 0;
zones[zone_idx].matrix_map.map.resize(0);
}
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 = cm_small_argb_header_data[i].header;
}
else
{
new_led.name = i;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = cm_small_argb_header_data[i].header;
}
led new_led;
new_led.name = zones[zone_idx].name;
new_led.name.append(", LED " + std::to_string(lp_idx));
leds.push_back(new_led);
}
@@ -243,16 +257,11 @@ void RGBController_CMSmallARGBController::SetupZones()
SetupColors();
}
void RGBController_CMSmallARGBController::DeviceResizeZone(int zone, int new_size)
void RGBController_CMSmallARGBController::DeviceConfigureZone(int zone_idx)
{
if((size_t) zone >= zones.size())
if((size_t)zone_idx < 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;
controller->SetLedCount(cm_small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
SetupZones();
}
@@ -27,7 +27,7 @@ public:
~RGBController_CMSmallARGBController();
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -91,19 +91,19 @@ DetectedControllers DetectCoolerMasterARGB(hid_device_info* info, const std::str
if(dev)
{
/*-------------------------------------------------*\
| Create mutex to prevent the controllers sharing a |
| receiver from interfering with each other |
\*-------------------------------------------------*/
std::shared_ptr<std::mutex> cm_mutex = std::make_shared<std::mutex>();
CMARGBController* controller = new CMARGBController(dev, info->path);
for(unsigned char i = 0; i < CM_ARGB_HEADER_DATA_SIZE; i++)
if(controller->GetVersion() != "Unsupported")
{
CMARGBController* controller = new CMARGBController(dev, info->path, i, cm_mutex);
RGBController_CMARGBController* rgb_controller = new RGBController_CMARGBController(controller);
detected_controllers.push_back(rgb_controller);
}
else
{
LOG_ERROR("[CMARGBController] Unsupported firmware version");
delete controller;
}
}
return(detected_controllers);
@@ -326,7 +326,7 @@ DetectedControllers DetectCoolerMasterSmallARGB(hid_device_info* info, const std
if(dev)
{
CMSmallARGBController* controller = new CMSmallARGBController(dev, info->path, 0);
CMSmallARGBController* controller = new CMSmallARGBController(dev, info->path);
RGBController_CMSmallARGBController* rgb_controller = new RGBController_CMSmallARGBController(controller);
detected_controllers.push_back(rgb_controller);
@@ -51,56 +51,99 @@ static unsigned int matrix_map24[11][11] =
RGBController_CorsairCommanderCore::RGBController_CorsairCommanderCore(CorsairCommanderCoreController* controller_ptr)
{
controller = controller_ptr;
controller = controller_ptr;
name = controller->GetNameString();
vendor = "Corsair";
description = "Corsair Commander Core Device";
version = controller->GetFirmwareString();
type = DEVICE_TYPE_COOLER;
location = controller->GetLocationString();
SetupZones();
name = controller->GetNameString();
vendor = "Corsair";
description = "Corsair Commander Core Device";
version = controller->GetFirmwareString();
type = DEVICE_TYPE_COOLER;
location = controller->GetLocationString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
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_CorsairCommanderCore::~RGBController_CorsairCommanderCore()
{
Shutdown();
delete controller;
}
void RGBController_CorsairCommanderCore::SetupZones()
{
std::atomic<bool> first_run;
first_run = 0;
/*-----------------------------------------------------*\
| Only set LED count on the first run |
\*-----------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = 1;
first_run = true;
}
std::vector<unsigned short int> led_count = controller->GetLedCounts();
/*-----------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-----------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(7);
/*-----------------------------------------------------*\
| Set up zones |
\*-----------------------------------------------------*/
std::vector<unsigned short int> led_count = controller->GetLedCounts();
if(controller->GetPidInt() == CORSAIR_COMMANDER_CORE_XT_PID)
{
zones[0].name = "External RGB Port";
zones[0].type = ZONE_TYPE_LINEAR;
zones[0].leds_min = zones[0].leds_min;
zones[0].leds_max = 204;
zones[0].leds_count = zones[0].leds_count;
zones[0].leds_min = 0;
zones[0].leds_max = 204;
if(first_run)
{
zones[0].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
zones[0].name = "Corsair RGB Header";
}
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[0].leds_count = 0;
}
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[0].type = ZONE_TYPE_LINEAR;
}
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[0].matrix_map.width = 0;
zones[0].matrix_map.height = 0;
zones[0].matrix_map.map.resize(0);
}
}
else
{
zones[0].name = "Pump";
zones[0].type = ZONE_TYPE_MATRIX;
zones[0].leds_min = led_count.at(0);
zones[0].leds_max = led_count.at(0);
zones[0].leds_count = led_count.at(0);
zones[0].name = "Pump";
zones[0].type = ZONE_TYPE_MATRIX;
zones[0].leds_min = led_count.at(0);
zones[0].leds_max = led_count.at(0);
zones[0].leds_count = led_count.at(0);
if(led_count.at(0) == 24)
{
@@ -112,28 +155,52 @@ void RGBController_CorsairCommanderCore::SetupZones()
}
}
for(unsigned int i = 1; i < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); i++)
for(unsigned int zone_idx = 1; zone_idx < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); zone_idx++)
{
zones[i].name = "RGB Port " + std::to_string(i);
zones[i].type = ZONE_TYPE_LINEAR;
zones[i].leds_min = 0;
zones[i].leds_max = 34;
zones[zone_idx].leds_min = 0;
zones[zone_idx].leds_max = 34;
if(first_run)
{
zones[i].leds_count = (led_count.size() > i) ? led_count.at(i) : 0;
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
zones[zone_idx].name = "Corsair Fan Header " + std::to_string(zone_idx);
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[zone_idx].leds_count = 0;
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[zone_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[zone_idx].matrix_map.width = 0;
zones[zone_idx].matrix_map.height = 0;
zones[zone_idx].matrix_map.map.resize(0);
}
}
leds.clear();
colors.clear();
/*-----------------------------------------------------*\
| Set up LEDs |
\*-----------------------------------------------------*/
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
led new_led;
new_led.name = zones[zone_idx].name + " LED " + std::to_string(led_idx+1);
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx+1);
leds.push_back(new_led);
}
@@ -142,28 +209,23 @@ void RGBController_CorsairCommanderCore::SetupZones()
SetupColors();
}
void RGBController_CorsairCommanderCore::DeviceResizeZone(int zone, int new_size)
void RGBController_CorsairCommanderCore::DeviceConfigureZone(int zone_idx)
{
if((size_t) zone >= zones.size())
if((size_t)zone_idx < 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;
if(zone == 0 && controller->GetPidInt() == CORSAIR_COMMANDER_CORE_XT_PID)
if(zone_idx == 0 && controller->GetPidInt() == CORSAIR_COMMANDER_CORE_XT_PID)
{
if(new_size > 0)
if(zones[zone_idx].leds_count > 0)
{
controller->SetFanMode(true);
controller->SetLedAmount(new_size);
controller->SetLedAmount(zones[zone_idx].leds_count);
}
else
{
controller->SetFanMode(false);
}
}
SetupZones();
}
}
@@ -22,7 +22,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);

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