Add Lexip Gaming mouse support - Closes #2245
This commit is contained in:
parent
8120fcdd5a
commit
ea0c19d31e
7 changed files with 272 additions and 0 deletions
|
|
@ -336,6 +336,11 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16e2", TAG+="uacces
|
|||
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="1705", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Lexip Gaming Mouse #
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d8", ATTR{idProduct}=="fd0a", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Lian Li Uni Hub #
|
||||
#---------------------------------------------------------------#
|
||||
|
|
|
|||
77
Controllers/LexipMouseController/LexipMouseController.cpp
Normal file
77
Controllers/LexipMouseController/LexipMouseController.cpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*-----------------------------------------*\
|
||||
| LexipMouseController.cpp |
|
||||
| |
|
||||
| Driver for Lexip mouse lighting |
|
||||
| controller |
|
||||
| |
|
||||
| Guimard Morgan (morg) 2/21/2022 |
|
||||
\*-----------------------------------------*/
|
||||
#include "LexipMouseController.h"
|
||||
#include <string.h>
|
||||
|
||||
LexipMouseController::LexipMouseController(hid_device* dev_handle, const hid_device_info& info)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
version = "";
|
||||
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
serial_number = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring return_wstring = serial_string;
|
||||
serial_number = std::string(return_wstring.begin(), return_wstring.end());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LexipMouseController::~LexipMouseController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LexipMouseController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string LexipMouseController::GetSerialString()
|
||||
{
|
||||
return(serial_number);
|
||||
}
|
||||
|
||||
std::string LexipMouseController::GetFirmwareVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
void LexipMouseController::SetDirect(RGBColor color)
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
| Send a change color packet |
|
||||
| |
|
||||
| URB INTERRUPT OUT, pad a leading zero |
|
||||
| |
|
||||
| 00 24 01 RR GG BB 00 64 80 00 .... 00 |
|
||||
\*-----------------------------------------*/
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = 0x24; // constant data
|
||||
usb_buf[0x02] = 0x01; // constant data
|
||||
|
||||
usb_buf[0x03] = RGBGetRValue(color); // red channel
|
||||
usb_buf[0x04] = RGBGetGValue(color); // green channel
|
||||
usb_buf[0x05] = RGBGetBValue(color); // blue channel
|
||||
|
||||
usb_buf[0x07] = 0x64; // constant data
|
||||
usb_buf[0x08] = 0x80; // constant data
|
||||
|
||||
hid_write(dev, usb_buf, PACKET_DATA_LENGTH);
|
||||
}
|
||||
35
Controllers/LexipMouseController/LexipMouseController.h
Normal file
35
Controllers/LexipMouseController/LexipMouseController.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*-----------------------------------------*\
|
||||
| LexipMouseController.h |
|
||||
| |
|
||||
| Driver for Lexip mouse lighting |
|
||||
| controller - header file |
|
||||
| |
|
||||
| Guimard Morgan (morg) 2/21/2022 |
|
||||
\*-----------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define PACKET_DATA_LENGTH 64
|
||||
|
||||
class LexipMouseController
|
||||
{
|
||||
public:
|
||||
LexipMouseController(hid_device* dev_handle, const hid_device_info& info);
|
||||
~LexipMouseController();
|
||||
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetFirmwareVersion();
|
||||
|
||||
void SetDirect(RGBColor color);
|
||||
protected:
|
||||
hid_device* dev;
|
||||
|
||||
private:
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
std::string version;
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#include "Detector.h"
|
||||
#include "LexipMouseController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_LexipMouse.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Lexip vendor ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define LEXIP_VID 0x04D8
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Product ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define LEXIP_NP93_ALPHA_PID 0xFD0A
|
||||
|
||||
void DetectLexipMouseControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
LexipMouseController* controller = new LexipMouseController(dev, *info);
|
||||
RGBController_LexipMouse* rgb_controller = new RGBController_LexipMouse(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("Np93 ALPHA - Gaming Mouse", DetectLexipMouseControllers, LEXIP_VID, LEXIP_NP93_ALPHA_PID, 0, 0x0001, 2);
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_LexipMouse.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Lexip mouse USB Driver |
|
||||
| |
|
||||
| Guimard Morgan (morg) 2/21/2022 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LexipMouse.h"
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
RGBController_LexipMouse::RGBController_LexipMouse(LexipMouseController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
name = "Lexip Gaming Mouse";
|
||||
vendor = "Lexip";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = name;
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0x00;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LexipMouse::~RGBController_LexipMouse()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_LexipMouse::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Mouse";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = 1;
|
||||
new_zone.leds_max = 1;
|
||||
new_zone.leds_count = 1;
|
||||
new_zone.matrix_map = nullptr;
|
||||
|
||||
zones.emplace_back(new_zone);
|
||||
|
||||
leds.resize(1);
|
||||
leds[0].name = "LED 1";
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LexipMouse::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LexipMouse::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_LexipMouse::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
controller->SetDirect(colors[0]);
|
||||
}
|
||||
|
||||
void RGBController_LexipMouse::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LexipMouse::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_LexipMouse::DeviceUpdateMode()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
31
Controllers/LexipMouseController/RGBController_LexipMouse.h
Normal file
31
Controllers/LexipMouseController/RGBController_LexipMouse.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_LexipMouse.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Lexip mouse RGB USB Driver |
|
||||
| |
|
||||
| Guimard Morgan (morg) 2/21/2022 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "LexipMouseController.h"
|
||||
|
||||
class RGBController_LexipMouse : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LexipMouse(LexipMouseController* controller_ptr);
|
||||
~RGBController_LexipMouse();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
void DeviceUpdateMode();
|
||||
void SetCustomMode();
|
||||
|
||||
private:
|
||||
LexipMouseController* controller;
|
||||
};
|
||||
|
|
@ -372,6 +372,8 @@ HEADERS +=
|
|||
Controllers/HyperXMousematController/RGBController_HyperXMousemat.h \
|
||||
Controllers/LEDStripController/LEDStripController.h \
|
||||
Controllers/LEDStripController/RGBController_LEDStrip.h \
|
||||
Controllers/LexipMouseController/LexipMouseController.h \
|
||||
Controllers/LexipMouseController/RGBController_LexipMouse.h \
|
||||
Controllers/LIFXController/LIFXController.h \
|
||||
Controllers/LIFXController/RGBController_LIFX.h \
|
||||
Controllers/LianLiController/LianLiUniHubController.h \
|
||||
|
|
@ -806,6 +808,9 @@ SOURCES +=
|
|||
Controllers/LEDStripController/LEDStripController.cpp \
|
||||
Controllers/LEDStripController/LEDStripControllerDetect.cpp \
|
||||
Controllers/LEDStripController/RGBController_LEDStrip.cpp \
|
||||
Controllers/LexipMouseController/LexipMouseController.cpp \
|
||||
Controllers/LexipMouseController/LexipMouseControllerDetect.cpp \
|
||||
Controllers/LexipMouseController/RGBController_LexipMouse.cpp \
|
||||
Controllers/LIFXController/LIFXController.cpp \
|
||||
Controllers/LIFXController/LIFXControllerDetect.cpp \
|
||||
Controllers/LIFXController/RGBController_LIFX.cpp \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue