Files
OpenRGB/Controllers/LogitechController/LogitechLightspeedController.cpp
Chris 41ac14dd41 Adding DEBUG logging & detection fixes to resolve #1592
+ Logitech detection and set up includes debug logging for troubleshooting
+ Adding a pre check to LogitechLightspeedController::GetSerialString()

* Rearranging check logic to ensure that all usages per device are bundled
* Adding PID check to usage bundle to ensure we don't roll into the next device in hid_device_info
- Code cleanup to remove dev_use1 post detection & decoupling the bundled usages for wired lightspeed devices
* Changing wired lightspeed devices to REGISTER_HID_DETECTOR_IPU to target the correct FAP long message usage

+ Adding device validity check isValid() from @cheerpipe
+ Adding wireless check into connected() prior to initialising device
+ Adding the getDeviceFeatureList() back into the Logitech Lightspeed device set up
+ Changed getRGBconfig() for more robust detection

+ Adding Powerplay Mat virtual PID for Linux
+ Adding Logitech G733 for testing @ I=2 P=0xFF43 U=514
+ Adding LOGITECH_POWERPLAY_MAT_VIRTUAL_PID to Linux detection
+ Adding LOGITECH_POWERPLAY_MAT_VIRTUAL_PID and LOGITECH_G733_PID to 60-openrgb.rules
+ Adding LOGITECH_DEVICE_TYPE mapping and extending validity to include new HEADSET type
2021-07-26 00:09:33 +10:00

68 lines
2.0 KiB
C++

/*-----------------------------------------*\
| LogitechLightspeedController.cpp |
| |
| Driver for Logitech Lightspeed Wireless |
| Gaming Mice lighting controller |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "LogitechLightspeedController.h"
#include <cstring>
LogitechLightspeedController::LogitechLightspeedController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechLightspeedController::~LogitechLightspeedController()
{
delete lightspeed;
}
std::string LogitechLightspeedController::GetDeviceLocation()
{
return("HID: " + location + " (Receiver) \r\nWireless Index: " + std::to_string(lightspeed->device_index));
}
std::string LogitechLightspeedController::GetSerialString()
{
if (lightspeed->device_index == 255 && lightspeed->wireless)
{
LOG_DEBUG("[%s] Skipped get serial number as this is the reciever", lightspeed->device_name.c_str());
return("");
}
else
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
LOG_DEBUG("[%s] hid_get_serial_number_string Returned status - %i : %s", lightspeed->device_name.c_str(), ret, ((ret == 0) ? "SUCCESS" : "FAILED"));
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
}
void LogitechLightspeedController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
)
{
lightspeed->setMode(mode, speed, zone, red, green, blue, 0x64);
}