Store name in GigabyteAorusMouseController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-10 00:07:00 -05:00
parent c8abbc6054
commit 2bde9b287f
4 changed files with 20 additions and 13 deletions

View file

@ -13,10 +13,11 @@
#include "GigabyteAorusMouseController.h" #include "GigabyteAorusMouseController.h"
#include "StringUtils.h" #include "StringUtils.h"
GigabyteAorusMouseController::GigabyteAorusMouseController(hid_device* dev_handle, const hid_device_info& info) GigabyteAorusMouseController::GigabyteAorusMouseController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{ {
dev = dev_handle; dev = dev_handle;
location = info.path; location = info.path;
name = dev_name;
version = ""; version = "";
} }
@ -30,6 +31,16 @@ std::string GigabyteAorusMouseController::GetDeviceLocation()
return("HID: " + location); return("HID: " + location);
} }
std::string GigabyteAorusMouseController::GetFirmwareVersion()
{
return(version);
}
std::string GigabyteAorusMouseController::GetNameString()
{
return(name);
}
std::string GigabyteAorusMouseController::GetSerialString() std::string GigabyteAorusMouseController::GetSerialString()
{ {
wchar_t serial_string[128]; wchar_t serial_string[128];
@ -43,11 +54,6 @@ std::string GigabyteAorusMouseController::GetSerialString()
return(StringUtils::wstring_to_string(serial_string)); return(StringUtils::wstring_to_string(serial_string));
} }
std::string GigabyteAorusMouseController::GetFirmwareVersion()
{
return(version);
}
void GigabyteAorusMouseController::SetMode(RGBColor color, uint8_t mode_value, uint8_t brightness, uint8_t speed) void GigabyteAorusMouseController::SetMode(RGBColor color, uint8_t mode_value, uint8_t brightness, uint8_t speed)
{ {
uint8_t usb_buf[GIGABYTE_AORUS_MOUSE_REPORT_SIZE]; uint8_t usb_buf[GIGABYTE_AORUS_MOUSE_REPORT_SIZE];

View file

@ -40,12 +40,13 @@ enum
class GigabyteAorusMouseController class GigabyteAorusMouseController
{ {
public: public:
GigabyteAorusMouseController(hid_device* dev_handle, const hid_device_info& info); GigabyteAorusMouseController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~GigabyteAorusMouseController(); ~GigabyteAorusMouseController();
std::string GetSerialString();
std::string GetDeviceLocation(); std::string GetDeviceLocation();
std::string GetFirmwareVersion(); std::string GetFirmwareVersion();
std::string GetNameString();
std::string GetSerialString();
void SetMode(RGBColor color, uint8_t mode_value, uint8_t brightness, uint8_t speed); void SetMode(RGBColor color, uint8_t mode_value, uint8_t brightness, uint8_t speed);
void SendDirect(RGBColor color); void SendDirect(RGBColor color);
@ -54,5 +55,6 @@ private:
hid_device* dev; hid_device* dev;
std::string location; std::string location;
std::string name;
std::string version; std::string version;
}; };

View file

@ -30,9 +30,8 @@ void DetectGigabyteAorusMouseControllers(hid_device_info* info, const std::strin
if(dev) if(dev)
{ {
GigabyteAorusMouseController* controller = new GigabyteAorusMouseController(dev, *info); GigabyteAorusMouseController* controller = new GigabyteAorusMouseController(dev, *info, name);
RGBController_GigabyteAorusMouse* rgb_controller = new RGBController_GigabyteAorusMouse(controller); RGBController_GigabyteAorusMouse* rgb_controller = new RGBController_GigabyteAorusMouse(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

@ -26,10 +26,10 @@
RGBController_GigabyteAorusMouse::RGBController_GigabyteAorusMouse(GigabyteAorusMouseController* controller_ptr) RGBController_GigabyteAorusMouse::RGBController_GigabyteAorusMouse(GigabyteAorusMouseController* controller_ptr)
{ {
controller = controller_ptr; controller = controller_ptr;
name = "Gigabyte Aorus"; name = controller->GetNameString();
vendor = "Gigabyte"; vendor = "Gigabyte";
type = DEVICE_TYPE_MOUSE; type = DEVICE_TYPE_MOUSE;
description = name; description = "Gigabyte Mouse Device";
location = controller->GetDeviceLocation(); location = controller->GetDeviceLocation();
serial = controller->GetSerialString(); serial = controller->GetSerialString();
version = controller->GetFirmwareVersion(); version = controller->GetFirmwareVersion();