Store name in RedSquareControllers to avoid setting it in detectors

This commit is contained in:
Adam Honse
2025-08-14 19:32:37 -05:00
parent 06413f2877
commit 9680d072fa
7 changed files with 35 additions and 21 deletions

View File

@@ -161,10 +161,10 @@ RGBController_RedSquareKeyrox::RGBController_RedSquareKeyrox(RedSquareKeyroxCont
{
controller = controller_ptr;
name = "Red Square Keyrox";
name = controller->GetNameString();
vendor = "Red Square";
type = DEVICE_TYPE_KEYBOARD;
description = name;
description = "Red Square Keyrox Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();

View File

@@ -15,10 +15,11 @@
using namespace std::chrono_literals;
RedSquareKeyroxController::RedSquareKeyroxController(hid_device *dev_handle, const hid_device_info &info, int variant)
RedSquareKeyroxController::RedSquareKeyroxController(hid_device *dev_handle, const hid_device_info &info, int variant, std::string dev_name)
{
dev = dev_handle;
location = info.path;
name = dev_name;
this->variant = variant;
}
@@ -37,6 +38,11 @@ std::string RedSquareKeyroxController::GetDeviceLocation()
return("HID: " + location);
}
std::string RedSquareKeyroxController::GetNameString()
{
return(name);
}
std::string RedSquareKeyroxController::GetSerialString()
{
wchar_t serial_wchar[128];

View File

@@ -60,11 +60,12 @@ enum
class RedSquareKeyroxController
{
public:
RedSquareKeyroxController(hid_device *dev_handle, const hid_device_info &info, int variant);
RedSquareKeyroxController(hid_device *dev_handle, const hid_device_info &info, int variant, std::string dev_name);
~RedSquareKeyroxController();
int GetVariant();
std::string GetDeviceLocation();
std::string GetNameString();
std::string GetSerialString();
int GetDirectionLRUD(int direction); // Direction for Left-Right-Up-Down modes
@@ -83,6 +84,7 @@ protected:
private:
int variant;
std::string location;
std::string name;
std::string serial_number;
std::vector<unsigned int> led_sequence_positions;
};