mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-03-31 04:11:14 -04:00
Correcting the metadata for the Logitech x56 HOTAS to resolve #2574
* Changing detector to IPU to remove duplicate detection + Adding Save() method to controller + Adding Brightness
This commit is contained in:
@@ -681,8 +681,8 @@ REGISTER_HID_DETECTOR_IPU("Logitech G933 Lightsync Headset", Dete
|
|||||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||||
| Joysticks |
|
| Joysticks |
|
||||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Joystick", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_JOYSTICK_PID, 2, 0xFF00);
|
REGISTER_HID_DETECTOR_IPU("Logitech X56 Rhino Hotas Joystick", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_JOYSTICK_PID, 2, 0xFF00, 3);
|
||||||
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Throttle", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_THROTTLE_PID, 2, 0xFF00);
|
REGISTER_HID_DETECTOR_IPU("Logitech X56 Rhino Hotas Throttle", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_THROTTLE_PID, 2, 0xFF00, 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ std::string LogitechX56Controller::GetSerialString()
|
|||||||
{
|
{
|
||||||
wchar_t serial_string[128];
|
wchar_t serial_string[128];
|
||||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||||
|
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
{
|
{
|
||||||
return("");
|
return("");
|
||||||
@@ -47,23 +47,23 @@ std::string LogitechX56Controller::GetSerialString()
|
|||||||
return(return_string);
|
return(return_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogitechX56Controller::SetColor(RGBColor color)
|
void LogitechX56Controller::SetColor(RGBColor color, uint8_t brightness)
|
||||||
{
|
{
|
||||||
unsigned char buf[64];
|
unsigned char buf[X56_CONTROLLER_PACKET_SIZE];
|
||||||
unsigned char cbuf[64];
|
unsigned char cbuf[X56_CONTROLLER_PACKET_SIZE];
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
| Zero out buffer |
|
| Zero out buffer |
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
memset(buf, 0x00, sizeof(buf));
|
memset(buf, 0x00, X56_CONTROLLER_PACKET_SIZE);
|
||||||
memset(cbuf, 0x00, sizeof(cbuf));
|
memset(cbuf, 0x00, X56_CONTROLLER_PACKET_SIZE);
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
| Set up init packet |
|
| Set up init packet |
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
buf[0x00] = 0x09;
|
buf[0x00] = 0x09;
|
||||||
buf[0x02] = 0x02;
|
buf[0x02] = 0x02;
|
||||||
buf[0x03] = 0x64;
|
buf[0x03] = brightness;
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
| Set up color packet |
|
| Set up color packet |
|
||||||
@@ -73,11 +73,29 @@ void LogitechX56Controller::SetColor(RGBColor color)
|
|||||||
cbuf[0x03] = RGBGetRValue(color);
|
cbuf[0x03] = RGBGetRValue(color);
|
||||||
cbuf[0x04] = RGBGetGValue(color);
|
cbuf[0x04] = RGBGetGValue(color);
|
||||||
cbuf[0x05] = RGBGetBValue(color);
|
cbuf[0x05] = RGBGetBValue(color);
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
| Send packets |
|
| Send packets |
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
hid_send_feature_report(dev, buf, 64);
|
hid_send_feature_report(dev, buf, X56_CONTROLLER_PACKET_SIZE);
|
||||||
hid_send_feature_report(dev, cbuf, 64);
|
hid_send_feature_report(dev, cbuf, X56_CONTROLLER_PACKET_SIZE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LogitechX56Controller::Save()
|
||||||
|
{
|
||||||
|
uint8_t buffer[X56_CONTROLLER_PACKET_SIZE];
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Zero out buffer |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
memset(buffer, 0x00, X56_CONTROLLER_PACKET_SIZE);
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Set up init packet |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
buffer[0x00] = 0x01;
|
||||||
|
buffer[0x01] = 0x01;
|
||||||
|
|
||||||
|
hid_send_feature_report(dev, buffer, X56_CONTROLLER_PACKET_SIZE);
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define X56_CONTROLLER_PACKET_SIZE 64
|
||||||
|
|
||||||
class LogitechX56Controller
|
class LogitechX56Controller
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -24,7 +26,8 @@ public:
|
|||||||
char* GetDeviceName();
|
char* GetDeviceName();
|
||||||
std::string GetSerialString();
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SetColor(RGBColor colors);
|
void SetColor(RGBColor colors, uint8_t brightness);
|
||||||
|
void Save();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char device_name[32];
|
char device_name[32];
|
||||||
|
|||||||
@@ -13,28 +13,31 @@
|
|||||||
@name Logitech X56
|
@name Logitech X56
|
||||||
@category Gamepad
|
@category Gamepad
|
||||||
@type USB
|
@type USB
|
||||||
@save :x:
|
@save :white_check_mark:
|
||||||
@direct :white_check_mark:
|
@direct :white_check_mark:
|
||||||
@effects :x:
|
@effects :x:
|
||||||
@detectors DetectLogitechKeyboardGPro
|
@detectors DetectLogitechX56
|
||||||
@comment
|
@comment
|
||||||
\*-------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
RGBController_LogitechX56::RGBController_LogitechX56(LogitechX56Controller* controller_ptr)
|
RGBController_LogitechX56::RGBController_LogitechX56(LogitechX56Controller* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = controller->GetDeviceName();
|
name = controller->GetDeviceName();
|
||||||
vendor = "Logitech";
|
vendor = "Logitech";
|
||||||
type = DEVICE_TYPE_GAMEPAD;
|
type = DEVICE_TYPE_GAMEPAD;
|
||||||
description = "Logitech X56 Device";
|
description = "Logitech X56 Device";
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
serial = controller->GetSerialString();
|
serial = controller->GetSerialString();
|
||||||
|
|
||||||
mode Direct;
|
mode Direct;
|
||||||
Direct.name = "Direct";
|
Direct.name = "Direct";
|
||||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
|
||||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||||
|
Direct.brightness_min = 0x00;
|
||||||
|
Direct.brightness_max = 0x64;
|
||||||
|
Direct.brightness = 0x64;
|
||||||
modes.push_back(Direct);
|
modes.push_back(Direct);
|
||||||
|
|
||||||
SetupZones();
|
SetupZones();
|
||||||
@@ -75,7 +78,7 @@ void RGBController_LogitechX56::ResizeZone(int /*zone*/, int /*new_size*/)
|
|||||||
|
|
||||||
void RGBController_LogitechX56::DeviceUpdateLEDs()
|
void RGBController_LogitechX56::DeviceUpdateLEDs()
|
||||||
{
|
{
|
||||||
controller->SetColor(colors[0]);
|
controller->SetColor(colors[0], modes[active_mode].brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_LogitechX56::UpdateZoneLEDs(int /*zone*/)
|
void RGBController_LogitechX56::UpdateZoneLEDs(int /*zone*/)
|
||||||
@@ -103,3 +106,8 @@ void RGBController_LogitechX56::DeviceUpdateMode()
|
|||||||
{
|
{
|
||||||
DeviceUpdateLEDs();
|
DeviceUpdateLEDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RGBController_LogitechX56::DeviceSaveMode()
|
||||||
|
{
|
||||||
|
controller->Save();
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public:
|
|||||||
void UpdateZoneLEDs(int zone);
|
void UpdateZoneLEDs(int zone);
|
||||||
void UpdateSingleLED(int led);
|
void UpdateSingleLED(int led);
|
||||||
|
|
||||||
|
void DeviceSaveMode();
|
||||||
void SetCustomMode();
|
void SetCustomMode();
|
||||||
void DeviceUpdateMode();
|
void DeviceUpdateMode();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user