Store name in HYTEKeyboardController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-11 17:20:20 -05:00
parent 0269cdd068
commit d412ef5e17
4 changed files with 21 additions and 14 deletions

View file

@ -12,10 +12,11 @@
#include <cstring> #include <cstring>
#include "HYTEKeyboardController.h" #include "HYTEKeyboardController.h"
HYTEKeyboardController::HYTEKeyboardController(hid_device* dev_handle, const char* path) HYTEKeyboardController::HYTEKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name)
{ {
dev = dev_handle; dev = dev_handle;
location = path; location = path;
name = dev_name;
} }
HYTEKeyboardController::~HYTEKeyboardController() HYTEKeyboardController::~HYTEKeyboardController()
@ -28,6 +29,11 @@ std::string HYTEKeyboardController::GetDeviceLocation()
return("HID " + location); return("HID " + location);
} }
std::string HYTEKeyboardController::GetDeviceName()
{
return(name);
}
void HYTEKeyboardController::LEDStreaming(unsigned int zone, RGBColor* colors) void HYTEKeyboardController::LEDStreaming(unsigned int zone, RGBColor* colors)
{ {
/*-----------------------------------------------------*\ /*-----------------------------------------------------*\

View file

@ -24,16 +24,18 @@ enum
class HYTEKeyboardController class HYTEKeyboardController
{ {
public: public:
HYTEKeyboardController(hid_device* dev_handle, const char* path); HYTEKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name);
~HYTEKeyboardController(); ~HYTEKeyboardController();
std::string GetDeviceLocation(); std::string GetDeviceLocation();
std::string GetDeviceName();
void LEDStreaming(unsigned int zone, RGBColor* colors); void LEDStreaming(unsigned int zone, RGBColor* colors);
private: private:
hid_device* dev; hid_device* dev;
std::string location; std::string location;
std::string name;
void LEDStreaming_Keyboard(RGBColor* colors); void LEDStreaming_Keyboard(RGBColor* colors);
void LEDStreaming_Surround(RGBColor* colors); void LEDStreaming_Surround(RGBColor* colors);

View file

@ -30,9 +30,8 @@ void DetectHYTEKeyboard(hid_device_info* info, const std::string& name)
if(dev) if(dev)
{ {
HYTEKeyboardController* controller = new HYTEKeyboardController(dev, info->path); HYTEKeyboardController* controller = new HYTEKeyboardController(dev, info->path, name);
RGBController_HYTEKeyboard* rgb_controller = new RGBController_HYTEKeyboard(controller); RGBController_HYTEKeyboard* rgb_controller = new RGBController_HYTEKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

@ -59,19 +59,19 @@ keyboard_keymap_overlay_values hyte_keeb_tkl_layout =
RGBController_HYTEKeyboard::RGBController_HYTEKeyboard(HYTEKeyboardController* controller_ptr) RGBController_HYTEKeyboard::RGBController_HYTEKeyboard(HYTEKeyboardController* controller_ptr)
{ {
controller = controller_ptr; controller = controller_ptr;
name = "HYTE Keyboard Device"; name = controller->GetDeviceName();
vendor = "HYTE"; vendor = "HYTE";
type = DEVICE_TYPE_KEYBOARD; type = DEVICE_TYPE_KEYBOARD;
description = "HYTE Keyboard Device"; description = "HYTE Keyboard Device";
location = controller->GetDeviceLocation(); location = controller->GetDeviceLocation();
mode Direct; mode Direct;
Direct.name = "Direct"; Direct.name = "Direct";
Direct.value = 0xFFFF; Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED; Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct); modes.push_back(Direct);
SetupZones(); SetupZones();