Compare commits

...
Author SHA1 Message Date
Steven Franzen 252ecf424e Change search path for i2c devices on linux
Looking for devices by bus instead of class should fix issues where the
class is named differently, e.g. i2c-dev instead of i2c-adapter.
2019-10-26 21:44:49 -05:00
Adam Honse 6612e8990f Update README 2019-08-16 12:29:52 -05:00
Network Silence 5bcaabccc7 Fixed readme for the project 2019-08-16 12:05:27 -05:00
Adam Honse f7753ae3a3 Add support for AUMA0-E6K5-0104 2019-08-06 12:31:58 -05:00
Adam Honse 4c55e35397 Update README.md 2019-06-13 20:04:52 +00:00
Adam Honse 535c34af36 Add Nuvoton NCT6798D ID to list of supported Super IOs 2019-06-12 16:52:22 -05:00
Stavros Avramidis 234b006bee Add time-out on query enumeration
Signed-off-by: Stavros Avramidis <[email protected]>
2019-06-02 12:35:31 -05:00
Adam Honse 9c4bbec686 Add 0x4F and 0x66 to detected Aura addresses 2019-05-29 12:23:58 -05:00
Adam Honse 25d85a1db0 Re-add Super IO ID mask 2019-05-27 14:58:51 -05:00
Adam Honse dde0292719 Add a few more Nuvoton Super IO chips to the supported list including NCT6796D, clean up the Nuvoton detection code 2019-05-27 11:44:51 -05:00
Adam Honse 9d1745c0d0 Get SMBus base address from NCT6793D configuration registers 2019-05-27 04:14:22 -05:00
Adam Honse 559f1e9bcc Add preliminary probe functionality for NCT6793D, remove SMBus block read from NCT6793D SMBus driver as I haven't written this functionality yet 2019-05-23 00:05:28 -05:00
Adam Honse 3c95f9fe21 Fix block writes on Nuvoton NCT6793D SMBus driver 2019-05-22 00:01:58 -05:00
Adam Honse c2e384ab39 Add README.md 2019-05-21 03:55:04 +00:00
Adam Honse fe7d7df29b Initial SMBus driver for Nuvoton NCT6793D Super IO chip used on Prime Z270-A (and other Intel boards) 2019-05-20 22:21:10 -05:00
Thomas Berger 73d91b9494 Add support for 970 PRO GAMING/AURA
the Aura controller is located on 0x40 of the SMBus for
this board.
2019-04-23 20:30:02 -05:00
Adam Honse a2cdfc5aec Add Dump Aura button to Linux Qt dialog 2019-03-13 22:08:23 -05:00
Adam Honse 484e4e9770 Move Qt project file up to root directory 2019-03-13 19:49:36 -05:00
Adam Honse c45001b810 Initial files for Corsair Vengeance RGB RAM support 2019-03-09 00:18:35 -06:00
Adam Honse e3dcb9e87d Add button to dump Aura device memory 2019-03-06 21:48:48 -06:00
Adam Honse 75cf8b6aa8 Add support for AUMA0-E6K5-0105 2019-03-06 13:52:21 -06:00
Adam Honse 35ec4f5e90 cstring not string, oops 2019-03-06 12:47:16 -06:00
Adam Honse ab03edb6ce Add AUMA0-E6K5-0106 to device list and use v2 registers 2019-03-06 12:30:56 -06:00
Adam Honse 022871c5c5 Allow alternative color register locations for newer Aura chips. Select registers based on device string 2019-03-05 22:07:13 -06:00
Adam Honse dc3009bcaf Add some sanity checking to Aura device detection. Aura devices appear to read incrementing values at 0xA0 if no register written 2019-02-25 22:10:38 -06:00
Adam Honse 0941f25a8d Check for "INTEL" manufacturer string, per issue comment 10#note_144867740 by @F-Lehmann 2019-02-25 21:19:33 -06:00
Adam Honse 20fa1f4b1a vector not used on Linux, move to Windows ifdef block 2019-02-20 23:16:22 -06:00
Adam Honse f1be1c9a8f Add Qt GUI, builds and runs on Linux 2019-02-20 20:19:08 -06:00
22 changed files with 1545 additions and 69 deletions
+22
View File
@@ -0,0 +1,22 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = OpenAuraSDK.bin
TEMPLATE = app
SOURCES += \
OpenAuraSDK/i2c_smbus.cpp \
OpenAuraSDK/AuraController.cpp \
OpenAuraSDK/OpenAuraSDK.cpp \
OpenAuraSDK/i2c_smbus_linux.cpp \
OpenAuraSDK/OpenAuraSDKQtDialog.cpp
HEADERS += \
OpenAuraSDK/i2c_smbus.h \
OpenAuraSDK/i2c_smbus_linux.h \
OpenAuraSDK/AuraController.h \
OpenAuraSDK/OpenAuraSDKQtDialog.h
FORMS += \
OpenAuraSDK/openaurasdk.ui
+55 -5
View File
@@ -8,6 +8,7 @@
\*-----------------------------------------*/
#include "AuraController.h"
#include <cstring>
AuraController::AuraController(i2c_smbus_interface* bus, aura_dev_id dev)
{
@@ -16,7 +17,56 @@ AuraController::AuraController(i2c_smbus_interface* bus, aura_dev_id dev)
AuraUpdateDeviceName();
led_count = 5; //temporary, some controllers have more channels
// LED-0116 - First generation motherboard controller
if (strcmp(device_name, "LED-0116") == 0)
{
direct_reg = AURA_REG_COLORS_DIRECT;
effect_reg = AURA_REG_COLORS_EFFECT;
led_count = 5;
}
// DIMM_LED-0102 - First generation DRAM controller (Trident Z RGB)
else if (strcmp(device_name, "DIMM_LED-0102") == 0)
{
direct_reg = AURA_REG_COLORS_DIRECT;
effect_reg = AURA_REG_COLORS_EFFECT;
led_count = 5;
}
// AUDA0-E6K5-0101 - Second generation DRAM controller (Geil Super Luce)
else if (strcmp(device_name, "AUDA0-E6K5-0101") == 0)
{
direct_reg = AURA_REG_COLORS_DIRECT_V2;
effect_reg = AURA_REG_COLORS_EFFECT_V2;
led_count = 5;
}
// AUMA0-E6K5-0106 - Second generation motherboard controller
else if (strcmp(device_name, "AUMA0-E6K5-0106") == 0)
{
direct_reg = AURA_REG_COLORS_DIRECT_V2;
effect_reg = AURA_REG_COLORS_EFFECT_V2;
led_count = 5;
}
// AUMA0-E6K5-0105 - Second generation motherboard controller
else if (strcmp(device_name, "AUMA0-E6K5-0105") == 0)
{
direct_reg = AURA_REG_COLORS_DIRECT_V2;
effect_reg = AURA_REG_COLORS_EFFECT_V2;
led_count = 5;
}
// AUMA0-E6K5-0104 - Second generation motherboard controller
else if (strcmp(device_name, "AUMA0-E6K5-0104") == 0)
{
direct_reg = AURA_REG_COLORS_DIRECT_V2;
effect_reg = AURA_REG_COLORS_EFFECT_V2;
led_count = 5;
}
// Assume first generation controller if string does not match
else
{
direct_reg = AURA_REG_COLORS_DIRECT;
effect_reg = AURA_REG_COLORS_EFFECT;
led_count = 5;
}
}
AuraController::~AuraController()
@@ -45,7 +95,7 @@ void AuraController::SetAllColorsDirect(unsigned char red, unsigned char green,
colors[i + 2] = green;
}
AuraRegisterWriteBlock(AURA_REG_COLORS_DIRECT, colors, led_count * 3);
AuraRegisterWriteBlock(direct_reg, colors, led_count * 3);
delete colors;
}
@@ -61,7 +111,7 @@ void AuraController::SetAllColorsEffect(unsigned char red, unsigned char green,
colors[i + 2] = green;
}
AuraRegisterWriteBlock(AURA_REG_COLORS_EFFECT, colors, led_count * 3);
AuraRegisterWriteBlock(effect_reg, colors, led_count * 3);
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
@@ -78,14 +128,14 @@ void AuraController::SetLEDColorDirect(unsigned int led, unsigned char red, unsi
{
unsigned char colors[3] = { red, blue, green };
AuraRegisterWriteBlock(AURA_REG_COLORS_DIRECT + ( 3 * led ), colors, 3);
AuraRegisterWriteBlock(direct_reg + ( 3 * led ), colors, 3);
}
void AuraController::SetLEDColorEffect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char colors[3] = { red, blue, green };
AuraRegisterWriteBlock(AURA_REG_COLORS_EFFECT + (3 * led), colors, 3);
AuraRegisterWriteBlock(effect_reg + (3 * led), colors, 3);
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
}
+4
View File
@@ -26,6 +26,8 @@ enum
AURA_REG_APPLY = 0x80A0, /* AURA Apply Changes Register */
AURA_REG_SLOT_INDEX = 0x80F8, /* AURA Slot Index Register (RAM only) */
AURA_REG_I2C_ADDRESS = 0x80F9, /* AURA I2C Address Register (RAM only) */
AURA_REG_COLORS_DIRECT_V2 = 0x8100, /* Direct Colors (v2) 30 bytes */
AURA_REG_COLORS_EFFECT_V2 = 0x8160, /* Internal Colors (v2) 30 bytes */
};
enum
@@ -70,6 +72,8 @@ public:
private:
char device_name[16];
unsigned int led_count;
aura_register direct_reg;
aura_register effect_reg;
i2c_smbus_interface * bus;
aura_dev_id dev;
+44
View File
@@ -0,0 +1,44 @@
/*-----------------------------------------*\
| CorsairController.h |
| |
| Driver for Corsair Vengeance RGB RAM |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 3/8/2019 |
\*-----------------------------------------*/
#include "CorsairController.h"
#include <cstring>
CorsairController::CorsairController(i2c_smbus_interface* bus, corsair_dev_id dev)
{
this->bus = bus;
this->dev = dev;
strcpy(device_name, "Corsair Vengeance RGB");
led_count = 1;
}
CorsairController::~CorsairController()
{
}
char * CorsairController::GetDeviceName()
{
return(device_name);
}
unsigned int CorsairController::GetLEDCount()
{
return(led_count);
}
void CorsairController::SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue)
{
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_FADE_TIME, 0x00);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_RED_VAL, red);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_GREEN_VAL, green);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_BLUE_VAL, blue);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_VENGEANCE_RGB_CMD_MODE, CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
}
+51
View File
@@ -0,0 +1,51 @@
/*-----------------------------------------*\
| CorsairController.h |
| |
| Definitions and types for Corsair |
| Vengeance RGB RAM lighting controller |
| |
| Adam Honse (CalcProgrammer1) 3/8/2019 |
\*-----------------------------------------*/
#include "i2c_smbus.h"
#pragma once
typedef unsigned char corsair_dev_id;
typedef unsigned char corsair_cmd;
enum
{
CORSAIR_VENGEANCE_RGB_CMD_FADE_TIME = 0xA4, /* Fade Time, 0 for Static */
CORSAIR_VENGEANCE_RGB_CMD_HOLD_TIME = 0xA5, /* Hold Time */
CORSAIR_VENGEANCE_RGB_CMD_MODE = 0xA6, /* Mode Control Value */
CORSAIR_VENGEANCE_RGB_CMD_RED_VAL = 0xB0, /* Red Color Value */
CORSAIR_VENGEANCE_RGB_CMD_GREEN_VAL = 0xB1, /* Green Color Value */
CORSAIR_VENGEANCE_RGB_CMD_BLUE_VAL = 0xB2, /* Blue Color Value */
};
enum
{
CORSAIR_VENGEANCE_RGB_MODE_SINGLE = 0x00, /* Single Color Effect Mode */
CORSAIR_VENGEANCE_RGB_MODE_FADE = 0x01, /* Fade Through Colors */
CORSAIR_VENGEANCE_RGB_MODE_PULSE = 0x02, /* Pulse Through Colors */
};
class CorsairController
{
public:
CorsairController(i2c_smbus_interface* bus, corsair_dev_id dev);
~CorsairController();
char* GetDeviceName();
unsigned int GetLEDCount();
void SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
private:
char device_name[32];
unsigned int led_count;
i2c_smbus_interface * bus;
corsair_dev_id dev;
};
+211 -38
View File
@@ -11,20 +11,24 @@
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include "OpenAuraSDKDialog.h"
#include "I2CDetectDialog.h"
#ifdef WIN32
#include <tchar.h>
#include <regex>
#include "OpenAuraSDKDialog.h"
#include "I2CDetectDialog.h"
#include "i2c_smbus_piix4.h"
#include "i2c_smbus_i801.h"
#include "i2c_smbus_nuvoton_nct6793d.h"
#include "wmi.h"
#include "inpout32.h"
#pragma comment(lib, "inpout32.lib")
#else /* WIN32 */
#include "OpenAuraSDKQtDialog.h"
#include "i2c_smbus_linux.h"
#include <regex>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
@@ -35,6 +39,128 @@ std::vector<AuraController *> controllers;
std::vector<i2c_smbus_interface *> busses;
#ifdef WIN32
/******************************************************************************************\
* *
* Nuvoton Super IO constants *
* *
\******************************************************************************************/
#define SIO_NCT5577_ID 0xC330 /* Device ID for NCT5577D (C333) */
#define SIO_NCT6102_ID 0x1060 /* Device ID for NCT6102D/6106D (1061) */
#define SIO_NCT6793_ID 0xd120 /* Device ID for NCT6793D (D121) */
#define SIO_NCT6796_ID 0xd420 /* Device ID for NCT6796D (D421) */
#define SIO_NCT6798_ID 0xd428 /* Device ID for NCT6798D (D428) */
#define SIO_REG_LOGDEV 0x07 /* Logical Device Register */
#define SIO_REG_DEVID 0x20 /* Device ID Register */
#define SIO_REG_SMBA 0x62 /* SMBus Base Address Register */
#define SIO_LOGDEV_SMBUS 0x0B /* Logical Device for SMBus */
#define SIO_ID_MASK 0xFFF8 /* Device ID mask */
/******************************************************************************************\
* *
* superio_enter *
* *
* Put the Super IO chip into Extended Function Mode *
* *
\******************************************************************************************/
void superio_enter(int ioreg)
{
Out32(ioreg, 0x87);
Out32(ioreg, 0x87);
}
/******************************************************************************************\
* *
* superio_outb *
* *
* Write a byte to the Super IO configuration register *
* *
\******************************************************************************************/
void superio_outb(int ioreg, int reg, int val)
{
Out32(ioreg, reg);
Out32(ioreg + 1, val);
}
/******************************************************************************************\
* *
* superio_inb *
* *
* Read a byte to the Super IO configuration register *
* *
\******************************************************************************************/
int superio_inb(int ioreg, int reg)
{
Out32(ioreg, reg);
return Inp32(ioreg + 1);
}
/******************************************************************************************\
* *
* DetectNuvotonI2CBusses (Windows) *
* *
* Detects available Nuvoton Super IO SMBUS adapters and enumerates *
* i2c_smbus_interface objects for them *
* *
\******************************************************************************************/
void DetectNuvotonI2CBusses()
{
i2c_smbus_interface* bus;
int sioaddr = 0x2E;
superio_enter(sioaddr);
int val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) | superio_inb(sioaddr, SIO_REG_DEVID + 1);
switch (val & SIO_ID_MASK)
{
case SIO_NCT5577_ID:
case SIO_NCT6102_ID:
case SIO_NCT6793_ID:
case SIO_NCT6796_ID:
case SIO_NCT6798_ID:
bus = new i2c_smbus_nuvoton_nct6793d();
// Set logical device register to get SMBus base address
superio_outb(sioaddr, SIO_REG_LOGDEV, SIO_LOGDEV_SMBUS);
// Get SMBus base address from configuration register
int smba = (superio_inb(sioaddr, SIO_REG_SMBA) << 8) | superio_inb(sioaddr, SIO_REG_SMBA + 1);
((i2c_smbus_nuvoton_nct6793d*)bus)->nuvoton_nct6793d_smba = smba;
// Set device name string
switch (val & SIO_ID_MASK)
{
case SIO_NCT5577_ID:
sprintf(bus->device_name, "Nuvoton NCT5577D SMBus at %X", smba);
break;
case SIO_NCT6102_ID:
sprintf(bus->device_name, "Nuvoton NCT6102D/NCT6106D SMBus at %X", smba);
break;
case SIO_NCT6793_ID:
sprintf(bus->device_name, "Nuvoton NCT6793D SMBus at %X", smba);
break;
case SIO_NCT6796_ID:
sprintf(bus->device_name, "Nuvoton NCT6796D SMBus at %X", smba);
break;
case SIO_NCT6798_ID:
sprintf(bus->device_name, "Nuvoton NCT6798D SMBus at %X", smba);
break;
}
busses.push_back(bus);
}
} /* DetectNuvotonI2CBusses() */
/******************************************************************************************\
* *
* DetectI2CBusses (Windows) *
@@ -86,7 +212,8 @@ void DetectI2CBusses()
// Analysis of many Intel boards has shown that Intel SMBus adapter I/O space varies between boards
// We can query Win32_PnPAllocatedResource entries and look up the PCI device ID to find the allocated I/O space
// Intel SMBus adapters use the i801 driver
else if (i["Manufacturer"].find("Intel") != std::string::npos)
else if ((i["Manufacturer"].find("Intel") != std::string::npos)
|| (i["Manufacturer"].find("INTEL") != std::string::npos))
{
std::string rgx1 = ".+" + q_res_PnPSignedDriver[0]["DeviceID"].substr(4, 33) + ".+";
@@ -113,6 +240,9 @@ void DetectI2CBusses()
}
}
// Detect Nuvoton Super IO SMBus adapters
DetectNuvotonI2CBusses();
} /* DetectI2CBusses() */
#else /* WIN32 */
@@ -135,8 +265,8 @@ void DetectI2CBusses()
struct dirent * ent;
int test_fd;
// Start looking for I2C adapters in /sys/class/i2c-adapter/
strcpy(driver_path, "/sys/class/i2c-adapter/");
// Start looking for I2C adapters in /sys/bus/i2c/devices/
strcpy(driver_path, "/sys/bus/i2c/devices/");
dir = opendir(driver_path);
if(dir == NULL)
@@ -195,6 +325,42 @@ void DetectI2CBusses()
#endif /* WIN32 */
/******************************************************************************************\
* *
* TestForAuraController *
* *
* Tests the given address to see if an Aura controller exists there. First does a *
* quick write to test for a response, and if so does a simple read at 0xA0 to test *
* for incrementing values 0...F which was observed at this location during data dump *
* *
\******************************************************************************************/
bool TestForAuraController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
for (int i = 0xA0; i < 0xB0; i++)
{
res = bus->i2c_smbus_read_byte_data(address, i);
if (res != (i - 0xA0))
{
pass = false;
}
}
}
return(pass);
} /* TestForAuraController() */
/******************************************************************************************\
* *
* DetectAuraControllers *
@@ -234,23 +400,40 @@ void DetectAuraControllers()
// Add Aura-enabled controllers at their remapped addresses
for (unsigned int slot = 0; slot < 8; slot++)
{
int res = busses[bus]->i2c_smbus_write_quick(0x70 + slot, I2C_SMBUS_WRITE);
if (res >= 0)
if (TestForAuraController(busses[bus], 0x70 + slot))
{
new_controller = new AuraController(busses[bus], 0x70 + slot);
controllers.push_back(new_controller);
}
}
// Check for Aura controller at 0x4E
int res = busses[bus]->i2c_smbus_write_quick(0x4E, I2C_SMBUS_WRITE);
// Check for Aura controller at 0x40
if (TestForAuraController(busses[bus], 0x40))
{
new_controller = new AuraController(busses[bus], 0x40);
controllers.push_back(new_controller);
}
if (res >= 0)
// Check for Aura controller at 0x4E
if (TestForAuraController(busses[bus], 0x4E))
{
new_controller = new AuraController(busses[bus], 0x4E);
controllers.push_back(new_controller);
}
// Check for Aura controller at 0x4F
if (TestForAuraController(busses[bus], 0x4F))
{
new_controller = new AuraController(busses[bus], 0x4F);
controllers.push_back(new_controller);
}
// Check for Aura controller at 0x66
if (TestForAuraController(busses[bus], 0x66))
{
new_controller = new AuraController(busses[bus], 0x66);
controllers.push_back(new_controller);
}
}
} /* DetectAuraControllers() */
@@ -349,7 +532,7 @@ void DumpAuraRegisters(AuraController * controller)
int start = 0x0000;
freopen("auradump.txt", "a", stdout);
FILE* file = freopen("auradump.txt", "a", stdout);
printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
@@ -365,47 +548,37 @@ void DumpAuraRegisters(AuraController * controller)
printf("\r\n");
}
fclose(file);
} /* DumpAuraRegisters() */
/******************************************************************************************\
* *
* main/WinMain *
* main *
* *
* Main function. Has no defined purpose yet, but is where you can call the other *
* functions in this project to test them out *
* *
* Currently, this program will enumerate all detected SMBus adapters and then detect *
* all attached devices, similar to i2cdetect on Linux *
* Main function. Detects busses and Aura controllers, then opens the main window *
* *
\******************************************************************************************/
int main()
int main(int argc, char *argv[])
{
// Colors Array R B G
unsigned char colors[15] = { 255, 0, 0,
0, 255, 0,
0, 0, 255,
255, 0, 255,
255, 255, 255 };
DetectI2CBusses();
DetectAuraControllers();
#if WIN32
OpenAuraSDKDialog dlg(busses, controllers);
dlg.DoModal();
/*for (unsigned int i = 0; i < controllers.size(); i++)
{
controllers[i]->AuraRegisterWrite(AURA_REG_DIRECT, 1);
controllers[i]->AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
}
return 0;
for (unsigned int i = 0; i < controllers.size(); i++)
{
controllers[i]->AuraRegisterWriteBlock(AURA_REG_COLORS_DIRECT, colors, 15);
}
#else
QApplication a(argc, argv);
DumpAuraRegisters(controllers[4]);*/
return 1;
Ui::OpenAuraSDKQtDialog dlg(busses, controllers);
dlg.show();
return a.exec();
#endif
}
+3 -1
View File
@@ -1,4 +1,5 @@
#include <string>
#include "AuraController.h"
#include "i2c_smbus.h"
#define MODE_AUTO 0
@@ -6,4 +7,5 @@
#define MODE_READ 2
#define MODE_FUNC 3
std::string DetectI2C(i2c_smbus_interface * bus, int mode);
std::string DetectI2C(i2c_smbus_interface * bus, int mode);
void DumpAuraRegisters(AuraController * controller);
-17
View File
@@ -1,17 +0,0 @@
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
i2c_smbus.cpp \
AuraController.cpp \
OpenAuraSDK.cpp \
i2c_smbus_linux.cpp
HEADERS += \
i2c_smbus.h \
i2c_smbus_linux.h \
AuraController.h
FORMS +=
+7 -5
View File
@@ -23,20 +23,20 @@
<ProjectGuid>{6D22BFF3-C1DF-407A-8816-05D63919A991}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>OpenAuraSDK</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
@@ -44,14 +44,14 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
@@ -181,6 +181,7 @@
<ClInclude Include="I2CDetectDialog.h" />
<ClInclude Include="i2c_smbus.h" />
<ClInclude Include="i2c_smbus_i801.h" />
<ClInclude Include="i2c_smbus_nuvoton_nct6793d.h" />
<ClInclude Include="i2c_smbus_piix4.h" />
<ClInclude Include="OpenAuraSDK.h" />
<ClInclude Include="OpenAuraSDKDialog.h" />
@@ -193,6 +194,7 @@
<ClCompile Include="I2CDetectDialog.cpp" />
<ClCompile Include="i2c_smbus.cpp" />
<ClCompile Include="i2c_smbus_i801.cpp" />
<ClCompile Include="i2c_smbus_nuvoton_nct6793d.cpp" />
<ClCompile Include="i2c_smbus_piix4.cpp" />
<ClCompile Include="OpenAuraSDKDialog.cpp" />
<ClCompile Include="wmi.cpp" />
+6
View File
@@ -42,6 +42,9 @@
<ClInclude Include="I2CDetectDialog.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="i2c_smbus_nuvoton_nct6793d.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="OpenAuraSDK.cpp">
@@ -71,6 +74,9 @@
<ClCompile Include="I2CDetectDialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="i2c_smbus_nuvoton_nct6793d.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc">
+14 -1
View File
@@ -35,6 +35,7 @@ BEGIN_MESSAGE_MAP(OpenAuraSDKDialog, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_COLORS, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColors)
ON_CBN_CLOSEUP(IDC_COMBO_OPENAURASDK_DEVICE, &OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkDevice)
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_SET_COLORS_ALL, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkSetColorsAll)
ON_BN_CLICKED(IDC_BUTTON_OPENAURASDK_DUMP, &OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkDump)
END_MESSAGE_MAP()
BOOL OpenAuraSDKDialog::OnInitDialog()
@@ -425,4 +426,16 @@ void OpenAuraSDKDialog::OnCbnCloseupComboOpenaurasdkDevice()
}
}
}
}
void OpenAuraSDKDialog::OnBnClickedButtonOpenaurasdkDump()
{
unsigned int aura_device = ((CComboBox*)GetDlgItem(IDC_COMBO_OPENAURASDK_DEVICE))->GetCurSel();
if (aura_device > 0)
{
((CButton*)GetDlgItem(IDC_BUTTON_OPENAURASDK_DUMP))->EnableWindow(false);
DumpAuraRegisters(controllers[aura_device - 1]);
((CButton*)GetDlgItem(IDC_BUTTON_OPENAURASDK_DUMP))->EnableWindow(true);
}
}
+1
View File
@@ -40,6 +40,7 @@ public:
afx_msg void OnBnClickedButtonOpenaurasdkSetColors();
afx_msg void OnCbnCloseupComboOpenaurasdkDevice();
afx_msg void OnBnClickedButtonOpenaurasdkSetColorsAll();
afx_msg void OnBnClickedButtonOpenaurasdkDump();
};
#endif
+356
View File
@@ -0,0 +1,356 @@
#include "OpenAuraSDKQtDialog.h"
#include "OpenAuraSDK.h"
using namespace Ui;
OpenAuraSDKQtDialog::OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<AuraController *>& control, QWidget *parent) : QMainWindow(parent), busses(bus), controllers (control), ui(new OpenAuraSDKQtDialogUi)
{
ui->setupUi(this);
ui->ComboAuraDevices->addItem("All Devices");
for (int i = 0; i < controllers.size(); i++)
{
ui->ComboAuraDevices->addItem(controllers[i]->GetDeviceName());
}
ui->ComboAuraDevices->setCurrentIndex(0);
}
OpenAuraSDKQtDialog::~OpenAuraSDKQtDialog()
{
delete ui;
}
void OpenAuraSDKQtDialog::show()
{
QMainWindow::show();
}
void Ui::OpenAuraSDKQtDialog::on_ButtonSetAll_clicked()
{
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
if (aura_device == 0)
{
unsigned char direct = ui->RadioDirect->isChecked();
if (direct == 0)
{
for (int i = 0; i < controllers.size(); i++)
{
controllers[i]->SetAllColorsEffect(ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt());
controllers[i]->SetDirect(false);
}
}
else
{
for (int i = 0; i < controllers.size(); i++)
{
controllers[i]->SetAllColorsDirect(ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt());
controllers[i]->SetDirect(true);
}
}
}
else
{
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
if (direct == 0)
{
controllers[aura_device - 1]->SetAllColorsEffect(ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt());
}
else
{
controllers[aura_device - 1]->SetAllColorsDirect(ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt());
}
}
}
void Ui::OpenAuraSDKQtDialog::on_ButtonSetColors_clicked()
{
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
if (aura_device == 0)
{
unsigned char direct = ui->RadioDirect->isChecked();
if (direct == 0)
{
for (int i = 0; i < controllers.size(); i++)
{
controllers[i]->SetLEDColorEffect( 0,
ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt() );
controllers[i]->SetLEDColorEffect( 1,
ui->EditLED1R->text().toInt(),
ui->EditLED1G->text().toInt(),
ui->EditLED1B->text().toInt() );
controllers[i]->SetLEDColorEffect( 2,
ui->EditLED2R->text().toInt(),
ui->EditLED2G->text().toInt(),
ui->EditLED2B->text().toInt() );
controllers[i]->SetLEDColorEffect( 3,
ui->EditLED3R->text().toInt(),
ui->EditLED3G->text().toInt(),
ui->EditLED3B->text().toInt() );
controllers[i]->SetLEDColorEffect( 4,
ui->EditLED4R->text().toInt(),
ui->EditLED4G->text().toInt(),
ui->EditLED4B->text().toInt() );
controllers[i]->SetDirect(false);
}
}
else
{
for (int i = 0; i < controllers.size(); i++)
{
controllers[i]->SetLEDColorDirect( 0,
ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt() );
controllers[i]->SetLEDColorDirect( 1,
ui->EditLED1R->text().toInt(),
ui->EditLED1G->text().toInt(),
ui->EditLED1B->text().toInt() );
controllers[i]->SetLEDColorDirect( 2,
ui->EditLED2R->text().toInt(),
ui->EditLED2G->text().toInt(),
ui->EditLED2B->text().toInt() );
controllers[i]->SetLEDColorDirect( 3,
ui->EditLED3R->text().toInt(),
ui->EditLED3G->text().toInt(),
ui->EditLED3B->text().toInt() );
controllers[i]->SetLEDColorDirect( 4,
ui->EditLED4R->text().toInt(),
ui->EditLED4G->text().toInt(),
ui->EditLED4B->text().toInt() );
controllers[i]->SetDirect(true);
}
}
}
else
{
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
if (direct == 0)
{
controllers[aura_device - 1]->SetLEDColorEffect( 0,
ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorEffect( 1,
ui->EditLED1R->text().toInt(),
ui->EditLED1G->text().toInt(),
ui->EditLED1B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorEffect( 2,
ui->EditLED2R->text().toInt(),
ui->EditLED2G->text().toInt(),
ui->EditLED2B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorEffect( 3,
ui->EditLED3R->text().toInt(),
ui->EditLED3G->text().toInt(),
ui->EditLED3B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorEffect( 4,
ui->EditLED4R->text().toInt(),
ui->EditLED4G->text().toInt(),
ui->EditLED4B->text().toInt() );
}
else
{
controllers[aura_device - 1]->SetLEDColorDirect( 0,
ui->EditLED0R->text().toInt(),
ui->EditLED0G->text().toInt(),
ui->EditLED0B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorDirect( 1,
ui->EditLED1R->text().toInt(),
ui->EditLED1G->text().toInt(),
ui->EditLED1B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorDirect( 2,
ui->EditLED2R->text().toInt(),
ui->EditLED2G->text().toInt(),
ui->EditLED2B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorDirect( 3,
ui->EditLED3R->text().toInt(),
ui->EditLED3G->text().toInt(),
ui->EditLED3B->text().toInt() );
controllers[aura_device - 1]->SetLEDColorDirect( 4,
ui->EditLED4R->text().toInt(),
ui->EditLED4G->text().toInt(),
ui->EditLED4B->text().toInt() );
}
}
}
void Ui::OpenAuraSDKQtDialog::on_RadioDirect_clicked()
{
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
if ( aura_device == 0)
{
for (int i = 0; i < controllers.size(); i++)
{
controllers[i]->SetDirect(true);
}
}
else
{
controllers[aura_device - 1]->SetDirect(true);
}
}
void Ui::OpenAuraSDKQtDialog::on_RadioEffect_clicked()
{
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
if (aura_device == 0)
{
for (int i = 0; i < controllers.size(); i++)
{
controllers[i]->SetDirect(false);
}
}
else
{
controllers[aura_device - 1]->SetDirect(false);
}
}
void Ui::OpenAuraSDKQtDialog::on_ComboAuraDevices_currentIndexChanged(int aura_device)
{
if (aura_device != 0)
{
unsigned char direct = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_DIRECT);
ui->RadioDirect->setChecked(direct != 0);
ui->RadioEffect->setChecked(direct == 0);
unsigned char mode = controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_MODE);
ui->RadioOff->setChecked(mode == AURA_MODE_OFF);
ui->RadioStatic->setChecked(mode == AURA_MODE_STATIC);
ui->RadioBreathing->setChecked(mode == AURA_MODE_BREATHING);
ui->RadioFlashing->setChecked(mode == AURA_MODE_FLASHING);
ui->RadioSpectrumCycle->setChecked(mode == AURA_MODE_SPECTRUM_CYCLE);
ui->RadioRainbow->setChecked(mode == AURA_MODE_RAINBOW);
ui->RadioBreathingSpectrum->setChecked(mode == AURA_MODE_SPECTRUM_CYCLE_BREATHING);
ui->RadioChaseFade->setChecked(mode == AURA_MODE_CHASE_FADE);
if (direct == 0)
{
ui->EditLED0R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 0)));
ui->EditLED0B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 1)));
ui->EditLED0G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 2)));
ui->EditLED1R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 3)));
ui->EditLED1B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 4)));
ui->EditLED1G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 5)));
ui->EditLED2R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 6)));
ui->EditLED2B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 7)));
ui->EditLED2G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 8)));
ui->EditLED3R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 9)));
ui->EditLED3B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 10)));
ui->EditLED3G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 11)));
ui->EditLED4R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 12)));
ui->EditLED4B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 13)));
ui->EditLED4G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_EFFECT + 14)));
}
else
{
ui->EditLED0R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 0)));
ui->EditLED0B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 1)));
ui->EditLED0G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 2)));
ui->EditLED1R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 3)));
ui->EditLED1B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 4)));
ui->EditLED1G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 5)));
ui->EditLED2R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 6)));
ui->EditLED2B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 7)));
ui->EditLED2G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 8)));
ui->EditLED3R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 9)));
ui->EditLED3B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 10)));
ui->EditLED3G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 11)));
ui->EditLED4R->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 12)));
ui->EditLED4B->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 13)));
ui->EditLED4G->setText(QString::number(controllers[aura_device - 1]->AuraRegisterRead(AURA_REG_COLORS_DIRECT + 14)));
}
}
}
void OpenAuraSDKQtDialog::setMode(unsigned char mode_val)
{
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
if (aura_device == 0)
{
for (int i = 0; i < controllers.size(); i++)
{
controllers[i]->SetMode(mode_val);
}
}
else
{
controllers[aura_device - 1]->SetMode(mode_val);
}
}
void Ui::OpenAuraSDKQtDialog::on_RadioOff_clicked()
{
setMode(AURA_MODE_OFF);
}
void Ui::OpenAuraSDKQtDialog::on_RadioStatic_clicked()
{
setMode(AURA_MODE_STATIC);
}
void Ui::OpenAuraSDKQtDialog::on_RadioBreathing_clicked()
{
setMode(AURA_MODE_BREATHING);
}
void Ui::OpenAuraSDKQtDialog::on_RadioFlashing_clicked()
{
setMode(AURA_MODE_FLASHING);
}
void Ui::OpenAuraSDKQtDialog::on_RadioSpectrumCycle_clicked()
{
setMode(AURA_MODE_SPECTRUM_CYCLE);
}
void Ui::OpenAuraSDKQtDialog::on_RadioRainbow_clicked()
{
setMode(AURA_MODE_RAINBOW);
}
void Ui::OpenAuraSDKQtDialog::on_RadioBreathingSpectrum_clicked()
{
setMode(AURA_MODE_SPECTRUM_CYCLE_BREATHING);
}
void Ui::OpenAuraSDKQtDialog::on_RadioChaseFade_clicked()
{
setMode(AURA_MODE_CHASE_FADE);
}
void Ui::OpenAuraSDKQtDialog::on_ButtonDumpAura_clicked()
{
unsigned int aura_device = ui->ComboAuraDevices->currentIndex();
if (aura_device > 0)
{
ui->ButtonDumpAura->setEnabled(false);
DumpAuraRegisters(controllers[aura_device - 1]);
ui->ButtonDumpAura->setEnabled(true);
}
}
+68
View File
@@ -0,0 +1,68 @@
#ifndef OPENAURASDKQTDIALOG_H
#define OPENAURASDKQTDIALOG_H
#include "ui_openaurasdk.h"
#include <vector>
#include "i2c_smbus.h"
#include "AuraController.h"
#include <QMainWindow>
#include <QTimer>
#include <QSystemTrayIcon>
#include <QMenu>
namespace Ui
{
class OpenAuraSDKQtDialog;
}
class Ui::OpenAuraSDKQtDialog : public QMainWindow
{
Q_OBJECT
public:
explicit OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus, std::vector<AuraController *>& control, QWidget *parent = 0);
~OpenAuraSDKQtDialog();
void show();
void setMode(unsigned char mode_val);
protected:
std::vector<i2c_smbus_interface *>& busses;
std::vector<AuraController *>& controllers;
private slots:
void on_ButtonSetAll_clicked();
void on_ButtonSetColors_clicked();
void on_RadioDirect_clicked();
void on_RadioEffect_clicked();
void on_ComboAuraDevices_currentIndexChanged(int index);
void on_RadioOff_clicked();
void on_RadioStatic_clicked();
void on_RadioBreathing_clicked();
void on_RadioFlashing_clicked();
void on_RadioSpectrumCycle_clicked();
void on_RadioRainbow_clicked();
void on_RadioBreathingSpectrum_clicked();
void on_RadioChaseFade_clicked();
void on_ButtonDumpAura_clicked();
private:
Ui::OpenAuraSDKQtDialogUi *ui;
};
#endif // OPENAURASDKQTDIALOG_H
Binary file not shown.
+160
View File
@@ -0,0 +1,160 @@
/*-----------------------------------------*\
| i2c_smbus_nuvoton_nct6793d.cpp |
| |
| Nuvoton NCT6793D SMBUS driver for Windows|
| |
| Adam Honse (CalcProgrammer1) 5/19/2019 |
\*-----------------------------------------*/
#include "i2c_smbus_nuvoton_nct6793d.h"
#include <Windows.h>
#include "inpout32.h"
#pragma comment(lib, "inpout32.lib")
s32 i2c_smbus_nuvoton_nct6793d::nct6793d_access(u16 addr, char read_write, u8 command, int size, i2c_smbus_data *data)
{
int i, len, status, cnt;
Out32(SMBHSTCTL, NCT6793D_SOFT_RESET);
switch (size)
{
case I2C_SMBUS_QUICK:
Out32(SMBHSTADD, (addr << 1) | read_write);
break;
case I2C_SMBUS_BYTE:
case I2C_SMBUS_BYTE_DATA:
Out32(SMBHSTADD, (addr << 1) | read_write);
Out32(SMBHSTIDX, command);
if (read_write == I2C_SMBUS_WRITE)
{
Out32(SMBHSTDAT, data->byte);
Out32(SMBHSTCMD, NCT6793D_WRITE_BYTE);
}
else
{
Out32(SMBHSTCMD, NCT6793D_READ_BYTE);
}
break;
case I2C_SMBUS_WORD_DATA:
Out32(SMBHSTADD, (addr << 1) | read_write);
Out32(SMBHSTIDX, command);
if (read_write == I2C_SMBUS_WRITE)
{
Out32(SMBHSTDAT, data->word & 0xFF);
Out32(SMBHSTDAT, (data->word & 0xFF00) >> 8);
Out32(SMBHSTCMD, NCT6793D_WRITE_WORD);
}
else
{
Out32(SMBHSTCMD, NCT6793D_READ_WORD);
}
break;
case I2C_SMBUS_BLOCK_DATA:
Out32(SMBHSTADD, (addr << 1) | read_write);
Out32(SMBHSTIDX, command);
if (read_write == I2C_SMBUS_WRITE)
{
len = data->block[0];
if (len == 0 || len > I2C_SMBUS_BLOCK_MAX)
{
return -EINVAL;
}
Out32(SMBBLKSZ, len);
//Load 4 bytes into FIFO
cnt = 1;
if (len >= 4)
{
for (i = cnt; i <= 4; i++)
{
Out32(SMBHSTDAT, data->block[i]);
}
len -= 4;
cnt += 4;
}
else
{
for (i = cnt; i <= len; i++)
{
Out32(SMBHSTDAT, data->block[i]);
}
len = 0;
}
Out32(SMBHSTCMD, NCT6793D_WRITE_BLOCK);
}
else
{
return -EOPNOTSUPP;
//Out32(SMBHSTCMD, NCT6793D_READ_BLOCK);
}
break;
default:
return -EOPNOTSUPP;
}
Out32(SMBHSTCTL, NCT6793D_MANUAL_START);
while ((size == I2C_SMBUS_BLOCK_DATA) && (len > 0))
{
if (read_write == I2C_SMBUS_WRITE)
{
while ((Inp32(SMBHSTSTS) & NCT6793D_FIFO_EMPTY) == 0);
//Load more bytes into FIFO
if (len >= 4)
{
for (i = cnt; i <= (cnt + 4); i++)
{
Out32(SMBHSTDAT, data->block[i]);
}
len -= 4;
cnt += 4;
}
else
{
for (i = cnt; i <= (cnt + len); i++)
{
Out32(SMBHSTDAT, data->block[i]);
}
len = 0;
}
}
}
//wait for manual mode to complete
while ((Inp32(SMBHSTSTS) & NCT6793D_MANUAL_ACTIVE) != 0);
if ((Inp32(SMBHSTERR) & NCT6793D_NO_ACK) != 0)
{
return -EPROTO;
}
else if ((read_write == I2C_SMBUS_WRITE) || (size == I2C_SMBUS_QUICK))
{
return 0;
}
switch (size)
{
case I2C_SMBUS_QUICK:
case I2C_SMBUS_BYTE_DATA:
data->byte = (u8)Inp32(SMBHSTDAT);
break;
case I2C_SMBUS_WORD_DATA:
data->word = Inp32(SMBHSTDAT) + (Inp32(SMBHSTDAT) << 8);
break;
}
return 0;
}
s32 i2c_smbus_nuvoton_nct6793d::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data)
{
return nct6793d_access(addr, read_write, command, size, data);
}
+53
View File
@@ -0,0 +1,53 @@
/*-----------------------------------------*\
| i2c_smbus_nuvoton_nct6793d.h |
| |
| Nuvoton NCT6793D SMBUS driver for Windows|
| |
| Adam Honse (CalcProgrammer1) 5/19/2019 |
\*-----------------------------------------*/
#include "i2c_smbus.h"
#pragma once
#define SMBHSTDAT (0 + nuvoton_nct6793d_smba)
#define SMBBLKSZ (1 + nuvoton_nct6793d_smba)
#define SMBHSTCMD (2 + nuvoton_nct6793d_smba)
#define SMBHSTIDX (3 + nuvoton_nct6793d_smba) //Index field is the Command field on other controllers
#define SMBHSTCTL (4 + nuvoton_nct6793d_smba)
#define SMBHSTADD (5 + nuvoton_nct6793d_smba)
#define SMBHSTERR (9 + nuvoton_nct6793d_smba)
#define SMBHSTSTS (0xE + nuvoton_nct6793d_smba)
/* Command register */
#define NCT6793D_READ_BYTE 0
#define NCT6793D_READ_WORD 1
#define NCT6793D_READ_BLOCK 2
#define NCT6793D_BLOCK_WRITE_READ_PROC_CALL 3
#define NCT6793D_PROC_CALL 4
#define NCT6793D_WRITE_BYTE 8
#define NCT6793D_WRITE_WORD 9
#define NCT6793D_WRITE_BLOCK 10
/* Control register */
#define NCT6793D_MANUAL_START 128
#define NCT6793D_SOFT_RESET 64
/* Error register */
#define NCT6793D_NO_ACK 32
/* Status register */
#define NCT6793D_FIFO_EMPTY 1
#define NCT6793D_FIFO_FULL 2
#define NCT6793D_MANUAL_ACTIVE 4
class i2c_smbus_nuvoton_nct6793d : public i2c_smbus_interface
{
public:
u16 nuvoton_nct6793d_smba = 0x0290;
private:
s32 nct6793d_access(u16 addr, char read_write, u8 command, int size, i2c_smbus_data *data);
s32 i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data);
};
+428
View File
@@ -0,0 +1,428 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenAuraSDKQtDialogUi</class>
<widget class="QMainWindow" name="OpenAuraSDKQtDialogUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>OpenAuraSDK</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QPushButton" name="ButtonSetAll">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set All</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonSetColors">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set Colors</string>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0R">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0G">
<property name="geometry">
<rect>
<x>70</x>
<y>60</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0B">
<property name="geometry">
<rect>
<x>130</x>
<y>60</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED1R">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED1G">
<property name="geometry">
<rect>
<x>70</x>
<y>90</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED1B">
<property name="geometry">
<rect>
<x>130</x>
<y>90</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED2R">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED2G">
<property name="geometry">
<rect>
<x>70</x>
<y>120</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED2B">
<property name="geometry">
<rect>
<x>130</x>
<y>120</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED3R">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED3G">
<property name="geometry">
<rect>
<x>70</x>
<y>150</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED3B">
<property name="geometry">
<rect>
<x>130</x>
<y>150</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED4R">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED4G">
<property name="geometry">
<rect>
<x>70</x>
<y>180</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED4B">
<property name="geometry">
<rect>
<x>130</x>
<y>180</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelRed">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Red</string>
</property>
</widget>
<widget class="QLabel" name="LabelGreen">
<property name="geometry">
<rect>
<x>70</x>
<y>40</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Green</string>
</property>
</widget>
<widget class="QLabel" name="LabelBlue">
<property name="geometry">
<rect>
<x>130</x>
<y>40</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Blue</string>
</property>
</widget>
<widget class="QComboBox" name="ComboAuraDevices">
<property name="geometry">
<rect>
<x>290</x>
<y>10</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelAuraDevice">
<property name="geometry">
<rect>
<x>200</x>
<y>10</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Aura Device</string>
</property>
</widget>
<widget class="QGroupBox" name="GroupBoxDirect">
<property name="geometry">
<rect>
<x>290</x>
<y>40</y>
<width>200</width>
<height>60</height>
</rect>
</property>
<property name="title">
<string>Mode</string>
</property>
<widget class="QRadioButton" name="RadioDirect">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>70</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Direct</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioEffect">
<property name="geometry">
<rect>
<x>110</x>
<y>30</y>
<width>70</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Effect</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="GroupBoxEffect">
<property name="geometry">
<rect>
<x>290</x>
<y>100</y>
<width>200</width>
<height>180</height>
</rect>
</property>
<property name="title">
<string>Effect</string>
</property>
<widget class="QRadioButton" name="RadioOff">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Off</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioStatic">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Static</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioBreathing">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Breathing</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioFlashing">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Flashing</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioSpectrumCycle">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Spectrum Cycle</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioRainbow">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Rainbow Wave</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioBreathingSpectrum">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<width>180</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Breathing Spectrum</string>
</property>
</widget>
<widget class="QRadioButton" name="RadioChaseFade">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>180</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Chase Fade</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="ButtonDumpAura">
<property name="geometry">
<rect>
<x>190</x>
<y>260</y>
<width>89</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Dump Aura</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
+3 -1
View File
@@ -35,6 +35,8 @@
#define IDC_EDIT_OPENAURASDK_LED_4_R 1030
#define IDC_EDIT_OPENAURASDK_LED_4_G 1031
#define IDC_EDIT_OPENAURASDK_LED_4_B 1032
#define IDC_BUTTON1 1033
#define IDC_BUTTON_OPENAURASDK_DUMP 1033
#define IDC_BUTTON_OPENAURASDK_SET_COLORS2 1034
#define IDC_BUTTON_OPENAURASDK_SET_COLORS 1034
@@ -44,7 +46,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1021
#define _APS_NEXT_CONTROL_VALUE 1034
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
+1 -1
View File
@@ -155,7 +155,7 @@ HRESULT Wmi::query(std::string queryStr, std::vector<QueryObj>& queryVectorOut,
while (pEnumerator)
{
hres = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
hres = pEnumerator->Next(WMI_WAIT_TIME, 1, &pclsObj, &uReturn);
if (0==uReturn)
{
+2
View File
@@ -9,6 +9,8 @@
#include <Wbemidl.h>
#include <Windows.h>
#define WMI_WAIT_TIME 2000 /// Max time to wait for next object in when enumerating next object in wmi query in milliseconds
#pragma comment(lib, "wbemuuid.lib")
+56
View File
@@ -0,0 +1,56 @@
# OpenAuraSDK
##### This project is an open-source implementation of the Asus Aura RGB controller software. It currently only supports a limited number of motherboard and RAM module lighting controllers.
## Supported Devices
Confirmed supported motherboards:
- ASUS PRIME X370 Pro
- ASUS PRIME X470 Pro
- ASUS PRIME Z270-A
- ASUS PRIME Z370-A
- ASUS ROG Strix Z370-E
Confirmed supported RGB RAM (except on X299):
- G.Skill Trident Z RGB
- Geil Super Luce
- TeamGroup Delta RGB
Experimental support in generic RGB testing branch:
- Corsair Vengeance RGB
- Corsair Vengeance Pro RGB
- HyperX Predator RGB
## Installation
#### Windows
1. Download the latest Visual Studio Community Edition and open the `.sln`.
2. Build the project for `x86` Architecture. The InpOut32 library I use does not support x64.
3. Copy InpOut32.dll from dependencies to the same path as OpenAuraSDK.exe.
**You may have to retarget the project to the latest version of the Windows SDK and build tools and stuff.**
**You must run the application as Administrator the first time to allow InpOut32 to set up. It can be run as a normal user afterwards**
#### Linux:
1. Either open the project using QT Creator or build it using qmake.
cd OpenAuraSDK
qmake OpenAuraSDK.pro
make
2. Allow access to SMBus:<br>
- This can be identified by your motherboard
##### Intel
- `modprobe i2c-dev i2c-i801`
- Asus used the SMBus controller on the Super IO chip for on-board Aura chips on Intel motherboards. I have a kernel patch to add a driver for this chip [here](https://gitlab.com/CalcProgrammer1/OpenAuraSDK/issues/22). After patching the kernel, enable the Nuvoton NCT67xx SMBus driver in your kernel configuration. The driver may be loaded with `modprobe i2c-nct6775`
##### AMD
- `modprobe i2c-dev i2c-piix4`
- The second SMBus isn't currently picked up by the kernel driver and that seems to be where Asus wired the Aura controllers so I have a kernel patch [here](https://gitlab.com/CalcProgrammer1/OpenAuraSDK/issues/9) that will allow the kernel to use the second bus (at `0x0b20`).
- You'll have to enable user access to your SMbus if you don't run as root.
- List all SMBus controllers: `sudo i2cdetect -l`
- Find out which control your Aura devices (PIIX4, I801, and NCT67xx)
- Give user access to those controllers, for instance: `sudo chmod 777 /dev/i2c-0`