Commander Core XT
This commit is contained in:
parent
febdd2ad5e
commit
e21d29fa27
4 changed files with 124 additions and 50 deletions
|
|
@ -30,11 +30,19 @@ CorsairCommanderCoreController::CorsairCommanderCoreController(hid_device* dev_h
|
|||
this->pid = pid;
|
||||
guard_manager_ptr = new DeviceGuardManager(new CorsairDeviceGuard());
|
||||
|
||||
if(pid == 0x0C32)
|
||||
if(pid == CORSAIR_COMMANDER_CORE2_PID)
|
||||
{
|
||||
packet_size = CORSAIR_COMMANDER_CORE_PACKET_SIZE_V3;
|
||||
command_res_size = packet_size - 4;
|
||||
}
|
||||
else if(pid == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Commander Core XT |
|
||||
\*-----------------------------------------------------*/
|
||||
packet_size = CORSAIR_COMMANDER_CORE_XT_PACKET_SIZE;
|
||||
command_res_size = packet_size - 4;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Initialize controller |
|
||||
|
|
@ -84,7 +92,7 @@ void CorsairCommanderCoreController::InitController()
|
|||
version[2] = res[2];
|
||||
delete[] res;
|
||||
|
||||
if(pid == 0x0C1C && version[0] == 1)
|
||||
if(pid == CORSAIR_COMMANDER_CORE_PID && version[0] == 1)
|
||||
{
|
||||
packet_size = CORSAIR_COMMANDER_CORE_PACKET_SIZE_V1;
|
||||
command_res_size = packet_size - 4;
|
||||
|
|
@ -116,6 +124,11 @@ std::string CorsairCommanderCoreController::GetNameString()
|
|||
return(name);
|
||||
}
|
||||
|
||||
int CorsairCommanderCoreController::GetPidInt()
|
||||
{
|
||||
return(this->pid);
|
||||
}
|
||||
|
||||
std::vector<unsigned short int> CorsairCommanderCoreController::GetLedCounts()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
|
|
@ -336,9 +349,14 @@ void CorsairCommanderCoreController::SetDirectColor
|
|||
int packet_offset = 0;
|
||||
int led_idx = 0;
|
||||
int channel_idx = 0;
|
||||
unsigned char* usb_buf = new unsigned char[CORSAIR_COMMANDER_CORE_RGB_DATA_LENGTH];
|
||||
int packet_len = CORSAIR_COMMANDER_CORE_RGB_DATA_LENGTH;
|
||||
|
||||
memset(usb_buf, 0, CORSAIR_COMMANDER_CORE_RGB_DATA_LENGTH);
|
||||
if(pid == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||
{
|
||||
packet_len = CORSAIR_COMMANDER_CORE_XT_RGB_DATA_LENGTH;
|
||||
}
|
||||
|
||||
unsigned char* usb_buf = new unsigned char[packet_len];
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
|
|
@ -355,10 +373,6 @@ void CorsairCommanderCoreController::SetDirectColor
|
|||
|
||||
led_idx = led_idx + zones[zone_idx].leds_count;
|
||||
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Move offset for fans with less than 34 LEDs |
|
||||
\*-------------------------------------------------*/
|
||||
if(zone_idx != 0)
|
||||
{
|
||||
packet_offset += 3 * (34 - zones[zone_idx].leds_count);
|
||||
|
|
@ -382,31 +396,71 @@ void CorsairCommanderCoreController::SetDirectColor
|
|||
|
||||
void CorsairCommanderCoreController::SetFanMode()
|
||||
{
|
||||
controller_ready = 0;
|
||||
DeviceGuardLock _ = guard_manager_ptr->AwaitExclusiveAccess();
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------*\
|
||||
| Force controller to 6 QL fan mode to expose maximum number of LEDs per rgb port (34 LEDs per port) |
|
||||
\*--------------------------------------------------------------------------------------------------*/
|
||||
unsigned char endpoint[2] = {0x1E, 0x00};
|
||||
unsigned char data_type[2] = {0x0D, 0x00};
|
||||
|
||||
unsigned char endpoint[2] = {0x1E, 0x00};
|
||||
unsigned char data_type[2] = {0x0D, 0x00};
|
||||
unsigned char buf[15];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set AIO mode |
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0] = 0x07;
|
||||
buf[1] = 0x01;
|
||||
buf[2] = 0x08;
|
||||
memset(buf, 0x00, 15);
|
||||
|
||||
buf[0] = 0x07;
|
||||
if(pid == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Commander Core XT external RGB port |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[1] = 0x01;
|
||||
buf[2] = 0x01;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Commander Core, Set AIO mode |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[1] = 0x01;
|
||||
buf[2] = 0x08;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| SET fan modes |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int i = 3; i < 15; i = i + 2)
|
||||
{
|
||||
buf[i] = 0x01;
|
||||
buf[i + 1] = 0x06;
|
||||
buf[i] = 0x01;
|
||||
buf[i + 1] = 0x06;
|
||||
}
|
||||
|
||||
WriteData(endpoint, data_type, buf, 15);
|
||||
|
||||
controller_ready = 1;
|
||||
}
|
||||
|
||||
void CorsairCommanderCoreController::SetLedAmount(int led_amount)
|
||||
{
|
||||
controller_ready = 0;
|
||||
DeviceGuardLock _ = guard_manager_ptr->AwaitExclusiveAccess();
|
||||
|
||||
unsigned char buf[15];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, 15);
|
||||
|
||||
unsigned char endpoint[2] = {0x1D, 0x00};
|
||||
unsigned char data_type[2] = {0x0C, 0x00};
|
||||
|
||||
buf[0] = 0x07;
|
||||
buf[1] = led_amount;
|
||||
|
||||
WriteData(endpoint, data_type, buf, 15);
|
||||
controller_ready = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,27 @@
|
|||
#include "RGBController.h"
|
||||
#include "DeviceGuardManager.h"
|
||||
|
||||
#define CORSAIR_COMMANDER_CORE_PACKET_SIZE_V1 1025 // First bit is the report bit
|
||||
#define CORSAIR_COMMANDER_CORE_PACKET_SIZE_V2 97 // First bit is the report bit
|
||||
#define CORSAIR_COMMANDER_CORE_PACKET_SIZE_V3 65 // First bit is the report bit
|
||||
/*-----------------------------------------------------*\
|
||||
| Packet size per device |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_COMMANDER_CORE_PACKET_SIZE_V1 1025
|
||||
#define CORSAIR_COMMANDER_CORE_PACKET_SIZE_V2 97
|
||||
#define CORSAIR_COMMANDER_CORE_PACKET_SIZE_V3 65
|
||||
#define CORSAIR_COMMANDER_CORE_XT_PACKET_SIZE 385
|
||||
|
||||
#define CORSAIR_COMMANDER_CORE_RGB_DATA_LENGTH 699
|
||||
#define CORSAIR_QL_FAN_ZONE_OFFSET 102
|
||||
#define CORSAIR_COMMANDER_CORE_NUM_CHANNELS 6
|
||||
#define CORSAIR_COMMANDER_CORE_RGB_DATA_LENGTH 699
|
||||
#define CORSAIR_COMMANDER_CORE_XT_RGB_DATA_LENGTH 1224
|
||||
|
||||
#define CORSAIR_QL_FAN_ZONE_OFFSET 102
|
||||
#define CORSAIR_COMMANDER_CORE_NUM_CHANNELS 6
|
||||
|
||||
#define CORSAIR_COMMANDER_CORE_PID 0x0C1C
|
||||
#define CORSAIR_COMMANDER_CORE2_PID 0x0C32
|
||||
#define CORSAIR_COMMANDER_CORE3_PID 0x0C1D
|
||||
#define CORSAIR_COMMANDER_CORE4_PID 0x0C3C
|
||||
#define CORSAIR_COMMANDER_CORE5_PID 0x0C3D
|
||||
#define CORSAIR_COMMANDER_CORE6_PID 0x0C3E
|
||||
#define CORSAIR_COMMANDER_CORE_XT_PID 0x0C2A
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -41,6 +55,7 @@ public:
|
|||
std::vector<unsigned short int> GetLedCounts();
|
||||
std::string GetLocationString();
|
||||
std::string GetNameString();
|
||||
int GetPidInt();
|
||||
|
||||
void SetDirectColor
|
||||
(
|
||||
|
|
@ -50,6 +65,7 @@ public:
|
|||
|
||||
void KeepaliveThread();
|
||||
void SetFanMode();
|
||||
void SetLedAmount(int led_amount);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
|
|
|
|||
|
|
@ -19,16 +19,6 @@
|
|||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_VID 0x1B1C
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Commander Core product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_COMMANDER_CORE_PID 0x0C1C
|
||||
#define CORSAIR_COMMANDER_CORE2_PID 0x0C32
|
||||
#define CORSAIR_COMMANDER_CORE3_PID 0x0C1D
|
||||
#define CORSAIR_COMMANDER_CORE4_PID 0x0C3C
|
||||
#define CORSAIR_COMMANDER_CORE5_PID 0x0C3D
|
||||
#define CORSAIR_COMMANDER_CORE6_PID 0x0C3E
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairCommanderCoreControllers *
|
||||
|
|
@ -56,3 +46,4 @@ REGISTER_HID_DETECTOR_IPU("Corsair Commander Core", DetectCorsairCommanderCoreCo
|
|||
REGISTER_HID_DETECTOR_IPU("Corsair Commander Core", DetectCorsairCommanderCoreControllers, CORSAIR_VID, CORSAIR_COMMANDER_CORE4_PID, 0x00, 0xFF42, 0x01);
|
||||
REGISTER_HID_DETECTOR_IPU("Corsair Commander Core", DetectCorsairCommanderCoreControllers, CORSAIR_VID, CORSAIR_COMMANDER_CORE5_PID, 0x00, 0xFF42, 0x01);
|
||||
REGISTER_HID_DETECTOR_IPU("Corsair Commander Core", DetectCorsairCommanderCoreControllers, CORSAIR_VID, CORSAIR_COMMANDER_CORE6_PID, 0x00, 0xFF42, 0x01);
|
||||
REGISTER_HID_DETECTOR_IPU("Corsair Commander Core XT", DetectCorsairCommanderCoreControllers, CORSAIR_VID, CORSAIR_COMMANDER_CORE_XT_PID, 0x00, 0xFF42, 0x01);
|
||||
|
|
|
|||
|
|
@ -55,11 +55,10 @@ RGBController_CorsairCommanderCore::RGBController_CorsairCommanderCore(CorsairCo
|
|||
|
||||
name = controller->GetNameString();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Commander Core";
|
||||
description = "Corsair Commander Core Device";
|
||||
version = controller->GetFirmwareString();
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = controller->GetLocationString();
|
||||
|
||||
SetupZones();
|
||||
|
||||
mode Direct;
|
||||
|
|
@ -87,23 +86,34 @@ void RGBController_CorsairCommanderCore::SetupZones()
|
|||
|
||||
std::vector<unsigned short int> led_count = controller->GetLedCounts();
|
||||
zones.resize(7);
|
||||
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].matrix_map = new matrix_map_type;
|
||||
if(led_count.at(0) == 24)
|
||||
if(controller->GetPidInt() == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||
{
|
||||
zones[0].matrix_map->height = 11;
|
||||
zones[0].matrix_map->width = 11;
|
||||
zones[0].matrix_map->map = (unsigned int *)&matrix_map24;
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[0].matrix_map->height = 7;
|
||||
zones[0].matrix_map->width = 7;
|
||||
zones[0].matrix_map->map = (unsigned int *)&matrix_map29;
|
||||
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].matrix_map = new matrix_map_type;
|
||||
if(led_count.at(0) == 24)
|
||||
{
|
||||
zones[0].matrix_map->height = 11;
|
||||
zones[0].matrix_map->width = 11;
|
||||
zones[0].matrix_map->map = (unsigned int *)&matrix_map24;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[0].matrix_map->height = 7;
|
||||
zones[0].matrix_map->width = 7;
|
||||
zones[0].matrix_map->map = (unsigned int *)&matrix_map29;
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 1; i < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); i++)
|
||||
|
|
@ -124,7 +134,7 @@ void RGBController_CorsairCommanderCore::SetupZones()
|
|||
|
||||
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++)
|
||||
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);
|
||||
|
|
@ -146,7 +156,10 @@ void RGBController_CorsairCommanderCore::ResizeZone(int zone, int new_size)
|
|||
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)
|
||||
{
|
||||
controller->SetLedAmount(new_size);
|
||||
}
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue