Store name in MountainKeyboardController to avoid setting it in detector
This commit is contained in:
parent
f9bfb951ca
commit
c256b6246a
4 changed files with 28 additions and 20 deletions
|
|
@ -17,10 +17,11 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
MountainKeyboardController::MountainKeyboardController(hid_device* dev_handle, const char* path)
|
||||
MountainKeyboardController::MountainKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
MountainKeyboardController::~MountainKeyboardController()
|
||||
|
|
@ -33,6 +34,11 @@ std::string MountainKeyboardController::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string MountainKeyboardController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string MountainKeyboardController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -145,10 +145,11 @@ typedef struct
|
|||
class MountainKeyboardController
|
||||
{
|
||||
public:
|
||||
MountainKeyboardController(hid_device* dev_handle, const char* path);
|
||||
MountainKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~MountainKeyboardController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendOffCmd();
|
||||
|
|
@ -170,11 +171,12 @@ public:
|
|||
void SelectMode(unsigned char mode_idx);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendColorStartPacketCmd(unsigned char brightness);
|
||||
void SendColorPacketCmd(unsigned char pkt_no,unsigned char brightness, unsigned char *data, unsigned int data_size);
|
||||
void SendColorEdgePacketCmd(unsigned char pkt_no, unsigned char *data, unsigned int data_size);
|
||||
void SendColorPacketFinishCmd();
|
||||
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ void DetectMountainKeyboardControllers(hid_device_info* info, const std::string&
|
|||
|
||||
if(dev)
|
||||
{
|
||||
MountainKeyboardController* controller = new MountainKeyboardController(dev, info->path);
|
||||
MountainKeyboardController* controller = new MountainKeyboardController(dev, info->path, name);
|
||||
RGBController_MountainKeyboard* rgb_controller = new RGBController_MountainKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectMountainKeyboardControllers() */
|
||||
|
|
|
|||
|
|
@ -530,24 +530,25 @@ static const char *led_names[MOUNTAIN_KEYBOARD_MAX_TRANSFER_COLORS] =
|
|||
|
||||
RGBController_MountainKeyboard::RGBController_MountainKeyboard(MountainKeyboardController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
memset(wheel_color, 0, 3);
|
||||
|
||||
wheel_config * wheel_conf = controller->GetWheelConfig();
|
||||
wheel_config * wheel_conf = controller->GetWheelConfig();
|
||||
|
||||
if (wheel_conf != nullptr) {
|
||||
wheel_color[0] = wheel_conf->r;
|
||||
wheel_color[1] = wheel_conf->g;
|
||||
wheel_color[2] = wheel_conf->b;
|
||||
if(wheel_conf != nullptr)
|
||||
{
|
||||
wheel_color[0] = wheel_conf->r;
|
||||
wheel_color[1] = wheel_conf->g;
|
||||
wheel_color[2] = wheel_conf->b;
|
||||
}
|
||||
|
||||
name = "Mountain Everest Keyboard";
|
||||
vendor = "Mountain";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Mountain Everest Keyboard";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
name = controller->GetNameString();
|
||||
vendor = "Mountain";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Mountain Everest Keyboard";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -680,7 +681,6 @@ RGBController_MountainKeyboard::RGBController_MountainKeyboard(MountainKeyboardC
|
|||
modes.push_back(Matrix);
|
||||
|
||||
SetupZones();
|
||||
|
||||
}
|
||||
|
||||
RGBController_MountainKeyboard::~RGBController_MountainKeyboard()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue