Publish LumaOps source
This commit is contained in:
+106
@@ -0,0 +1,106 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_SteelSeriesQCKMat.cpp |
|
||||
| |
|
||||
| RGBController for SteelSeries Mouse |
|
||||
| |
|
||||
| Edbgon 22 May 2021 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_SteelSeriesQCKMat.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Steel Series QCK Mat
|
||||
@category Mousemat
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :x:
|
||||
@detectors DetectSteelSeriesMousemat
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_SteelSeriesQCKMat::RGBController_SteelSeriesQCKMat(SteelSeriesQCKMatController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "SteelSeries";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "SteelSeries QCK Mat Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_SteelSeriesQCKMat::~RGBController_SteelSeriesQCKMat()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| QCK has two zones |
|
||||
\*---------------------------------------------------------*/
|
||||
zone mousemat_zone;
|
||||
mousemat_zone.name = "Mousemat";
|
||||
mousemat_zone.type = ZONE_TYPE_SINGLE;
|
||||
mousemat_zone.leds_min = 2;
|
||||
mousemat_zone.leds_max = 2;
|
||||
mousemat_zone.leds_count = 2;
|
||||
mousemat_zone.matrix_map = NULL;
|
||||
zones.push_back(mousemat_zone);
|
||||
|
||||
led bot_led;
|
||||
bot_led.name = "Mat Bottom LED";
|
||||
leds.push_back(bot_led);
|
||||
|
||||
led top_led;
|
||||
top_led.name = "Mat Top LED";
|
||||
leds.push_back(top_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetColors(colors);
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Packet expects both LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Packet expects both LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_SteelSeriesQCKMat.h |
|
||||
| |
|
||||
| RGBController for SteelSeries Mouse |
|
||||
| |
|
||||
| Edbgon 22 May 2021 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "SteelSeriesQCKMatController.h"
|
||||
|
||||
class RGBController_SteelSeriesQCKMat : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_SteelSeriesQCKMat(SteelSeriesQCKMatController* controller_ptr);
|
||||
~RGBController_SteelSeriesQCKMat();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
SteelSeriesQCKMatController* controller;
|
||||
};
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesQCKControllerMat.cpp |
|
||||
| |
|
||||
| Driver for SteelSeries Mouse |
|
||||
| |
|
||||
| Edbgon 22 May 2021 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "SteelSeriesQCKMatController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
SteelSeriesQCKMatController::SteelSeriesQCKMatController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
SteelSeriesQCKMatController::~SteelSeriesQCKMatController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string SteelSeriesQCKMatController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string SteelSeriesQCKMatController::GetDeviceName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string SteelSeriesQCKMatController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
void SteelSeriesQCKMatController::SetColors(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char buf[525];
|
||||
unsigned char cbuf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
memset(cbuf, 0x00, sizeof(cbuf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x00;
|
||||
buf[0x01] = 0x0E;
|
||||
buf[0x03] = 0x02;
|
||||
|
||||
buf[0x08] = 0xFF;
|
||||
buf[0x09] = 0x32;
|
||||
buf[0x0A] = 0xC8;
|
||||
buf[0x0E] = 0x01;
|
||||
|
||||
buf[0x14] = 0xFF;
|
||||
buf[0x15] = 0x32;
|
||||
buf[0x16] = 0xC8;
|
||||
buf[0x19] = 0x01;
|
||||
|
||||
buf[0x1A] = 0x01;
|
||||
buf[0x1C] = 0x01;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in color data |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x05] = RGBGetRValue(colors[0]);
|
||||
buf[0x06] = RGBGetGValue(colors[0]);
|
||||
buf[0x07] = RGBGetBValue(colors[0]);
|
||||
|
||||
buf[0x11] = RGBGetRValue(colors[1]);
|
||||
buf[0x12] = RGBGetGValue(colors[1]);
|
||||
buf[0x13] = RGBGetBValue(colors[1]);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 525);
|
||||
|
||||
cbuf[0x01] = 0x0D;
|
||||
hid_write(dev, cbuf, 65);
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesQCKControllerMat.h |
|
||||
| |
|
||||
| Driver for SteelSeries Mouse |
|
||||
| |
|
||||
| Edbgon 22 May 2021 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
class SteelSeriesQCKMatController
|
||||
{
|
||||
public:
|
||||
SteelSeriesQCKMatController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~SteelSeriesQCKMatController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetColors(std::vector<RGBColor> colors);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
Reference in New Issue
Block a user