Store name in MintakaKeyboardController to avoid setting it in detector
This commit is contained in:
parent
8c63eeea47
commit
f9bfb951ca
4 changed files with 15 additions and 14 deletions
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
MintakaKeyboardController::MintakaKeyboardController(hid_device* dev_handle, const hid_device_info& info)
|
MintakaKeyboardController::MintakaKeyboardController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||||
{
|
{
|
||||||
dev = dev_handle;
|
dev = dev_handle;
|
||||||
version = "";
|
|
||||||
location = info.path;
|
location = info.path;
|
||||||
|
name = dev_name;
|
||||||
|
|
||||||
wchar_t serial_string[128];
|
wchar_t serial_string[128];
|
||||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||||
|
|
@ -45,16 +45,16 @@ std::string MintakaKeyboardController::GetDeviceLocation()
|
||||||
return("HID: " + location);
|
return("HID: " + location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string MintakaKeyboardController::GetNameString()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string MintakaKeyboardController::GetSerialString()
|
std::string MintakaKeyboardController::GetSerialString()
|
||||||
{
|
{
|
||||||
return(serial_number);
|
return(serial_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MintakaKeyboardController::GetFirmwareVersion()
|
|
||||||
{
|
|
||||||
return(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MintakaKeyboardController:: SetLedSequencePositions(std::vector<unsigned int> positions)
|
void MintakaKeyboardController:: SetLedSequencePositions(std::vector<unsigned int> positions)
|
||||||
{
|
{
|
||||||
led_sequence_positions = positions;
|
led_sequence_positions = positions;
|
||||||
|
|
|
||||||
|
|
@ -91,12 +91,12 @@ enum
|
||||||
class MintakaKeyboardController
|
class MintakaKeyboardController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MintakaKeyboardController(hid_device* dev_handle, const hid_device_info& info);
|
MintakaKeyboardController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||||
~MintakaKeyboardController();
|
~MintakaKeyboardController();
|
||||||
|
|
||||||
std::string GetSerialString();
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
std::string GetFirmwareVersion();
|
std::string GetNameString();
|
||||||
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SetLedSequencePositions(std::vector<unsigned int> positions);
|
void SetLedSequencePositions(std::vector<unsigned int> positions);
|
||||||
void SetMode(std::vector<mode> modes, int active_mode, std::vector<RGBColor> colors);
|
void SetMode(std::vector<mode> modes, int active_mode, std::vector<RGBColor> colors);
|
||||||
|
|
@ -106,6 +106,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string location;
|
std::string location;
|
||||||
|
std::string name;
|
||||||
std::string serial_number;
|
std::string serial_number;
|
||||||
std::string version;
|
std::string version;
|
||||||
std::vector<unsigned int> led_sequence_positions;
|
std::vector<unsigned int> led_sequence_positions;
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ void DetectMintakaKeyboardControllers(hid_device_info* info, const std::string&
|
||||||
|
|
||||||
if(dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
MintakaKeyboardController* controller = new MintakaKeyboardController(dev, *info);
|
MintakaKeyboardController* controller = new MintakaKeyboardController(dev, *info, name);
|
||||||
RGBController_MintakaKeyboard* rgb_controller = new RGBController_MintakaKeyboard(controller);
|
RGBController_MintakaKeyboard* rgb_controller = new RGBController_MintakaKeyboard(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,13 +79,13 @@ typedef struct
|
||||||
RGBController_MintakaKeyboard::RGBController_MintakaKeyboard(MintakaKeyboardController* controller_ptr)
|
RGBController_MintakaKeyboard::RGBController_MintakaKeyboard(MintakaKeyboardController* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
name = "Mintaka Keyboard";
|
|
||||||
|
name = controller->GetNameString();
|
||||||
vendor = "VSG";
|
vendor = "VSG";
|
||||||
type = DEVICE_TYPE_KEYBOARD;
|
type = DEVICE_TYPE_KEYBOARD;
|
||||||
description = name;
|
description = name;
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
serial = controller->GetSerialString();
|
serial = controller->GetSerialString();
|
||||||
version = controller->GetFirmwareVersion();
|
|
||||||
|
|
||||||
mode Custom;
|
mode Custom;
|
||||||
Custom.name = "Custom";
|
Custom.name = "Custom";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue