diff --git a/Controllers/CougarController/CougarControllerDetect.cpp b/Controllers/CougarController/CougarControllerDetect.cpp index b454f708..65758431 100644 --- a/Controllers/CougarController/CougarControllerDetect.cpp +++ b/Controllers/CougarController/CougarControllerDetect.cpp @@ -29,9 +29,9 @@ void DetectCougarRevengerSTControllers(hid_device_info* info, const std::string& if(dev) { - CougarRevengerSTController* controller = new CougarRevengerSTController(dev, *info); + CougarRevengerSTController* controller = new CougarRevengerSTController(dev, *info, name); RGBController_CougarRevengerST* rgb_controller = new RGBController_CougarRevengerST(controller); - rgb_controller->name = name; + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -42,9 +42,8 @@ void DetectCougar700kEvo(hid_device_info* info, const std::string& name) if (dev) { - CougarKeyboardController* controller = new CougarKeyboardController(dev, info->path); + CougarKeyboardController* controller = new CougarKeyboardController(dev, info->path, name); RGBController_CougarKeyboard* rgb_controller = new RGBController_CougarKeyboard(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } diff --git a/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp b/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp index 4b7c3fa6..b2df09a8 100644 --- a/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp +++ b/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp @@ -54,21 +54,11 @@ static uint8_t keyvalue_map[113] = 149, 150, 151 }; -CougarKeyboardController::CougarKeyboardController(hid_device* dev_handle, const char* path) +CougarKeyboardController::CougarKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name) { dev = dev_handle; location = path; - - /*---------------------------------------------------------*\ - | Get device name from HID manufacturer and product strings | - \*---------------------------------------------------------*/ - wchar_t name_string[HID_MAX_STR]; - - hid_get_manufacturer_string(dev, name_string, HID_MAX_STR); - device_name = StringUtils::wstring_to_string(name_string); - - hid_get_product_string(dev, name_string, HID_MAX_STR); - device_name.append(" ").append(StringUtils::wstring_to_string(name_string)); + name = dev_name; } CougarKeyboardController::~CougarKeyboardController() @@ -78,7 +68,7 @@ CougarKeyboardController::~CougarKeyboardController() std::string CougarKeyboardController::GetDeviceName() { - return device_name; + return(name); } std::string CougarKeyboardController::GetSerial() diff --git a/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.h b/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.h index 936f66c2..2945d5ce 100644 --- a/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.h +++ b/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.h @@ -66,7 +66,7 @@ enum Cougar_Keyboard_Controller_Speeds class CougarKeyboardController { public: - CougarKeyboardController(hid_device* dev_handle, const char* path); + CougarKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name); ~CougarKeyboardController(); std::string GetDeviceName(); @@ -78,8 +78,8 @@ public: void Save(uint8_t flag); void SendProfile(uint8_t profile, uint8_t light); private: - std::string device_name; std::string serial; std::string location; + std::string name; hid_device* dev; }; diff --git a/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp b/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp index 84e48bcf..cc8ca4ae 100644 --- a/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp +++ b/Controllers/CougarController/CougarKeyboardController/RGBController_CougarKeyboard.cpp @@ -170,10 +170,10 @@ RGBController_CougarKeyboard::RGBController_CougarKeyboard(CougarKeyboardControl { controller = controller_ptr; - name = "CougarKeyboard"; + name = controller->GetDeviceName(); vendor = "Cougar"; type = DEVICE_TYPE_KEYBOARD; - description = controller->GetDeviceName(); + description = "Cougar Keyboard Device"; serial = controller->GetSerial(); location = controller->GetLocation(); diff --git a/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.cpp b/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.cpp index ff9807f4..5409065b 100644 --- a/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.cpp +++ b/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.cpp @@ -13,10 +13,11 @@ #include "CougarRevengerSTController.h" #include "StringUtils.h" -CougarRevengerSTController::CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info) +CougarRevengerSTController::CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name) { dev = dev_handle; location = info.path; + name = dev_name; version = ""; ActivateMode(0, DIRECT_MODE_VALUE); @@ -34,6 +35,11 @@ std::string CougarRevengerSTController::GetDeviceLocation() return("HID: " + location); } +std::string CougarRevengerSTController::GetNameString() +{ + return(name); +} + std::string CougarRevengerSTController::GetSerialString() { wchar_t serial_string[128]; diff --git a/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.h b/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.h index 0f70d1f2..85482e9a 100644 --- a/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.h +++ b/Controllers/CougarController/CougarRevengerSTController/CougarRevengerSTController.h @@ -228,12 +228,13 @@ static const std::map modes_mapping = class CougarRevengerSTController { public: - CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info); + CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name); ~CougarRevengerSTController(); std::string GetSerialString(); std::string GetDeviceLocation(); std::string GetFirmwareVersion(); + std::string GetNameString(); void ActivateMode(unsigned char zone, unsigned char mode_value); void SetDirect(unsigned char zone, RGBColor color, unsigned char brightness); @@ -242,6 +243,7 @@ public: private: hid_device* dev; std::string location; + std::string name; std::string version; void Apply(); diff --git a/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp b/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp index 3d71329e..89966da6 100644 --- a/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp +++ b/Controllers/CougarController/CougarRevengerSTController/RGBController_CougarRevengerST.cpp @@ -28,10 +28,10 @@ RGBController_CougarRevengerST::RGBController_CougarRevengerST(CougarRevengerSTC { controller = controller_ptr; - name = "Cougar Revenger ST USB Device"; + name = controller->GetNameString(); vendor = "Cougar"; type = DEVICE_TYPE_MOUSE; - description = name; + description = "Cougar Revenger ST Device"; location = controller->GetDeviceLocation(); serial = controller->GetSerialString(); version = controller->GetFirmwareVersion();