Publish LumaOps source
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesMouseController.cpp |
|
||||
| |
|
||||
| Driver for SteelSeries Mouse |
|
||||
| |
|
||||
| Chris M (Dr_No) 09 Jun 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "SteelSeriesMouseController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
SteelSeriesMouseController::SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
proto = proto_type;
|
||||
}
|
||||
|
||||
SteelSeriesMouseController::~SteelSeriesMouseController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string SteelSeriesMouseController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string SteelSeriesMouseController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string SteelSeriesMouseController::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));
|
||||
}
|
||||
|
||||
steelseries_type SteelSeriesMouseController::GetMouseType()
|
||||
{
|
||||
return proto;
|
||||
}
|
||||
|
||||
void SteelSeriesMouseController::Save()
|
||||
{
|
||||
const uint8_t SAVE_BUFFER_SIZE = 10;
|
||||
uint8_t usb_buf[SAVE_BUFFER_SIZE] = { 0x00, 0x09 };
|
||||
|
||||
hid_write(dev, usb_buf, SAVE_BUFFER_SIZE);
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesMouseController.h |
|
||||
| |
|
||||
| Driver for SteelSeries Mouse |
|
||||
| |
|
||||
| Chris M (Dr_No) 09 Jun 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <hidapi.h>
|
||||
#include "SteelSeriesGeneric.h"
|
||||
|
||||
#define STEELSERIES_MOUSE_BRIGHTNESS_MAX 0x64
|
||||
|
||||
/*-----------------------------------------------------------*\
|
||||
| Theses are the specific values that get sent to set a mode |
|
||||
\*-----------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
STEELSERIES_MOUSE_EFFECT_SPECTRUM_CYCLE = 0x00,
|
||||
STEELSERIES_MOUSE_EFFECT_BREATHING_MAX = 0x01,
|
||||
STEELSERIES_MOUSE_EFFECT_BREATHING_MID = 0x02,
|
||||
STEELSERIES_MOUSE_EFFECT_BREATHING_MIN = 0x03,
|
||||
STEELSERIES_MOUSE_EFFECT_DIRECT = 0x04,
|
||||
STEELSERIES_MOUSE_EFFECT_RAINBOW_BREATHING = 0x05,
|
||||
STEELSERIES_MOUSE_EFFECT_DISCO = 0x06
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
const int value;
|
||||
} led_info;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::vector<uint8_t> modes;
|
||||
std::vector<led_info> leds;
|
||||
} steelseries_mouse;
|
||||
|
||||
class SteelSeriesMouseController
|
||||
{
|
||||
public:
|
||||
SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name);
|
||||
virtual ~SteelSeriesMouseController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
steelseries_type GetMouseType();
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Save has a common function but can be overridden |
|
||||
\*-----------------------------------------------------------------*/
|
||||
virtual void Save();
|
||||
|
||||
virtual steelseries_mouse GetMouse() = 0;
|
||||
virtual std::string GetFirmwareVersion() = 0;
|
||||
virtual void SetLightEffectAll(uint8_t effect) = 0;
|
||||
virtual void SetColor
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue,
|
||||
unsigned char brightness
|
||||
) = 0;
|
||||
|
||||
protected:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
steelseries_type proto;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user