Store name in WootingKeyboardController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 22:56:43 -05:00
parent 550503d757
commit d069947252
6 changed files with 19 additions and 19 deletions

View file

@ -67,11 +67,10 @@ void DetectWootingOneKeyboardControllers(hid_device_info* info, const std::strin
uint8_t wooting_type = (info->product_id == WOOTING_ONE_OLD_PID) ? WOOTING_KB_TKL : WOOTING_KB_FULL;
LOG_DEBUG("[%s] Device type %i opened - creating Controller", controller_name, wooting_type);
WootingOneKeyboardController* controller = new WootingOneKeyboardController(dev, info->path, wooting_type);
WootingOneKeyboardController* controller = new WootingOneKeyboardController(dev, info->path, wooting_type, name);
LOG_DEBUG("[%s] Controller created - creating RGBController", controller_name);
RGBController_WootingKeyboard* rgb_controller = new RGBController_WootingKeyboard(controller);
rgb_controller->name = name;
LOG_DEBUG("[%s] Initialization complete - Registering controller\t%s", controller_name, name.c_str());
ResourceManager::get()->RegisterRGBController(rgb_controller);
@ -95,11 +94,10 @@ void DetectWootingTwoKeyboardControllers(hid_device_info* info, const std::strin
}
LOG_DEBUG("[%s] Device type %i opened - creating Controller", controller_name, wooting_type);
WootingTwoKeyboardController* controller = new WootingTwoKeyboardController(dev, info->path, wooting_type);
WootingTwoKeyboardController* controller = new WootingTwoKeyboardController(dev, info->path, wooting_type, name);
LOG_DEBUG("[%s] Controller created - creating RGBController", controller_name);
RGBController_WootingKeyboard* rgb_controller = new RGBController_WootingKeyboard(controller);
rgb_controller->name = name;
LOG_DEBUG("[%s] Initialization complete - Registering controller\t%s", controller_name, name.c_str());
ResourceManager::get()->RegisterRGBController(rgb_controller);

View file

@ -53,10 +53,11 @@ static uint16_t getCrc16ccitt(const uint8_t* buffer, uint16_t size)
return crc;
}
WootingOneKeyboardController::WootingOneKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type)
WootingOneKeyboardController::WootingOneKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
this->wooting_type = wooting_type;
key_code_limit = (wooting_type == WOOTING_KB_TKL) ? WOOTING_ONE_KEY_CODE_LIMIT : WOOTING_TWO_KEY_CODE_LIMIT;

View file

@ -16,7 +16,7 @@
class WootingOneKeyboardController : public WootingKeyboardController
{
public:
WootingOneKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type);
WootingOneKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type, std::string dev_name);
~WootingOneKeyboardController();
void SendDirect(RGBColor* colors, uint8_t colour_count);

View file

@ -36,10 +36,11 @@ static unsigned int matrix_to_led_index_map_full[WOOTING_RGB_ROWS * WOOTING_TWO_
80, 101, NA, 18, 39, 60, 81, 102, 123, 19, 40, 61, 82, 103, 124, 20, 41, 62, NA, 104, NA
};
WootingTwoKeyboardController::WootingTwoKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type)
WootingTwoKeyboardController::WootingTwoKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
this->wooting_type = wooting_type;
key_code_limit = (wooting_type == WOOTING_KB_TKL) ? WOOTING_ONE_KEY_CODE_LIMIT : WOOTING_TWO_KEY_CODE_LIMIT;

View file

@ -16,7 +16,7 @@
class WootingTwoKeyboardController : public WootingKeyboardController
{
public:
WootingTwoKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type);
WootingTwoKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type, std::string dev_name);
~WootingTwoKeyboardController();
void SendDirect(RGBColor* colors, uint8_t colour_count);