diff --git a/Controllers/MSIRGBController/MSIRGBController.cpp b/Controllers/MSIRGBController/MSIRGBController.cpp index 1a0c247d5..d847f27bc 100644 --- a/Controllers/MSIRGBController/MSIRGBController.cpp +++ b/Controllers/MSIRGBController/MSIRGBController.cpp @@ -10,11 +10,45 @@ \*-----------------------------------------*/ #include "MSIRGBController.h" +#include "dependencies/dmiinfo.h" #include "super_io.h" +#define NUM_INVERTED_DEVICES (sizeof(inverted_devices) / sizeof(inverted_devices[0])) + +/*-------------------------------------------------------------------------*\ +| This is a list of DMI info for boards which need the inversion flag set | +\*-------------------------------------------------------------------------*/ +static const char * inverted_devices[21] = +{ + "7B89", + "7B90", + "7B19", + "7C02", + "7B75", + "7B22", + "7B23", + "7B24", + "7B27", + "7B30", + "7B31", + "7B51", + "7C04", + "7C00", + "7B98", + "7C22", + "7C24", + "7C01", + "7C39", + "7B86", + "7B87" +}; + MSIRGBController::MSIRGBController(int sioaddr) { msi_sioaddr = sioaddr; + DMIInfo board; + + std::string board_dmi = board.getMainboard(); /*-----------------------------------------------------*\ | This setup step isn't well documented | @@ -50,10 +84,21 @@ MSIRGBController::MSIRGBController(int sioaddr) \*-----------------------------------------------------*/ superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_1, 0x00); - /*-----------------------------------------------------*\ - | Lighting enabled, RGB non-inverted, header on | - \*-----------------------------------------------------*/ - superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_3, 0xE2); + /*--------------------------------------------------------------*\ + | Header on, pulse deactivated, colors inverted depending on DMI | + \*--------------------------------------------------------------*/ + unsigned char ff_val = 0b11100010; + + for(unsigned int i = 0; i < NUM_INVERTED_DEVICES; i++) + { + if (board_dmi.find(std::string(inverted_devices[i])) != std::string::npos) + { + ff_val |= 0b00011100; + break; + } + } + + superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_3, ff_val); } MSIRGBController::~MSIRGBController() diff --git a/Controllers/MSIRGBController/MSIRGBController.h b/Controllers/MSIRGBController/MSIRGBController.h index 8ea7179d4..7b1179312 100644 --- a/Controllers/MSIRGBController/MSIRGBController.h +++ b/Controllers/MSIRGBController/MSIRGBController.h @@ -11,7 +11,6 @@ \*-----------------------------------------*/ #include - #pragma once #define MSI_SIO_LOGDEV_RGB 0x12