Use HID path for Location on NZXT Hue 2 controller

This commit is contained in:
Adam Honse
2020-10-05 00:03:34 -05:00
parent e678c132bf
commit e82b251bae
4 changed files with 13 additions and 4 deletions

View File

@@ -11,9 +11,10 @@
#include <string>
#include <cstring>
NZXTHue2Controller::NZXTHue2Controller(hid_device* dev_handle, unsigned int rgb_channels, unsigned int fan_channels)
NZXTHue2Controller::NZXTHue2Controller(hid_device* dev_handle, unsigned int rgb_channels, unsigned int fan_channels, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
num_fan_channels = fan_channels;
num_rgb_channels = rgb_channels;
@@ -47,6 +48,11 @@ unsigned short NZXTHue2Controller::GetFanRPM
return(fan_rpm[fan_channel]);
}
std::string NZXTHue2Controller::GetLocation()
{
return(location);
}
unsigned int NZXTHue2Controller::GetNumFanChannels()
{
return(num_fan_channels);

View File

@@ -54,10 +54,11 @@ enum
class NZXTHue2Controller
{
public:
NZXTHue2Controller(hid_device* dev_handle, unsigned int rgb_channels, unsigned int fan_channels);
NZXTHue2Controller(hid_device* dev_handle, unsigned int rgb_channels, unsigned int fan_channels, const char* path);
~NZXTHue2Controller();
std::string GetFirmwareVersion();
std::string GetLocation();
unsigned char GetFanCommand
(
@@ -110,6 +111,7 @@ private:
std::vector<unsigned short> fan_rpm;
char firmware_version[16];
std::string location;
unsigned int num_fan_channels;
unsigned int num_rgb_channels;

View File

@@ -66,7 +66,7 @@ void DetectNZXTHue2Controllers(std::vector<RGBController*> &rgb_controllers)
if( dev )
{
NZXTHue2Controller* controller = new NZXTHue2Controller(dev, device_list[device_idx].num_rgb_channels, device_list[device_idx].num_fan_channels);
NZXTHue2Controller* controller = new NZXTHue2Controller(dev, device_list[device_idx].num_rgb_channels, device_list[device_idx].num_fan_channels, info->path);
RGBController_NZXTHue2* rgb_controller = new RGBController_NZXTHue2(controller);

View File

@@ -17,6 +17,7 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* hue2_ptr)
type = DEVICE_TYPE_LEDSTRIP;
description = "NZXT Hue 2 Device";
version = hue2->GetFirmwareVersion();
location = hue2->GetLocation();
mode Direct;
Direct.name = "Direct";