Store name in LogitechControllers to avoid setting it in detectors

This commit is contained in:
Adam Honse 2025-08-16 16:47:44 -05:00
parent 86fbdfa6e7
commit a0726dc065
35 changed files with 258 additions and 185 deletions

View file

@ -17,10 +17,11 @@
using namespace std::chrono_literals;
LogitechG933Controller::LogitechG933Controller(hid_device* dev_handle, const char* path)
LogitechG933Controller::LogitechG933Controller(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
}
LogitechG933Controller::~LogitechG933Controller()
@ -33,6 +34,11 @@ std::string LogitechG933Controller::GetDeviceLocation()
return("HID: " + location);
}
std::string LogitechG933Controller::GetDeviceName()
{
return(name);
}
void LogitechG933Controller::SetDirectMode(uint8_t zone)
{
unsigned char usb_buf[LOGI_G933_LED_PACKET_SIZE];

View file

@ -30,13 +30,14 @@ enum
class LogitechG933Controller
{
public:
LogitechG933Controller(hid_device* dev_handle, const char* path);
LogitechG933Controller(hid_device* dev_handle, const char* path, std::string dev_name);
~LogitechG933Controller();
std::string GetDeviceLocation();
std::string GetDeviceName();
void SetDirectMode(uint8_t zone);
void SetOffMode(uint8_t zone);
void SetDirectMode(uint8_t zone);
void SetOffMode(uint8_t zone);
void SendHeadsetMode
(
@ -48,10 +49,11 @@ public:
);
private:
hid_device* dev;
std::string location;
hid_device* dev;
std::string location;
std::string name;
void fail_retry_write(hid_device *device, const unsigned char *data, size_t length);
void fail_retry_write(hid_device *device, const unsigned char *data, size_t length);
};

View file

@ -25,13 +25,13 @@
RGBController_LogitechG933::RGBController_LogitechG933(LogitechG933Controller* controller_ptr)
{
controller = controller_ptr;
controller = controller_ptr;
name = "Logitech G933 Lightsync Headset";
vendor = "Logitech";
type = DEVICE_TYPE_HEADSET;
description = "Logitech G933 Lightsync Headset";
location = controller->GetDeviceLocation();
name = controller->GetDeviceName();
vendor = "Logitech";
type = DEVICE_TYPE_HEADSET;
description = "Logitech G933 Lightsync Headset";
location = controller->GetDeviceLocation();
mode Off;
Off.name = "Off";