mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-11-28 03:14:46 -05:00
Initial Linux support
This commit is contained in:
1 parent
a58925ebb5
commit
c8b73c6749
7 files changed
+220
-6
No files matched your search
@@ -0,0 +1,112 @@
|
||||
/*-----------------------------------------*\
|
||||
| SeagateController.cpp |
|
||||
| |
|
||||
| Code for Seagate Firecuda External HDD |
|
||||
| RGB controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/15/2023 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "SeagateController.h"
|
||||
|
||||
SeagateController::SeagateController(int fd, char* path)
|
||||
{
|
||||
this->fd = fd;
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
SeagateController::~SeagateController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string SeagateController::GetLocation()
|
||||
{
|
||||
std::string str(path.begin(), path.end());
|
||||
return("SCSI: " + str);
|
||||
}
|
||||
|
||||
void SeagateController::SetLED
|
||||
(
|
||||
unsigned char led_id,
|
||||
unsigned char r,
|
||||
unsigned char g,
|
||||
unsigned char b,
|
||||
bool save
|
||||
)
|
||||
{
|
||||
/*-----------------------------------------------------------------------------*\
|
||||
| Create buffer to hold RGB control data |
|
||||
\*-----------------------------------------------------------------------------*/
|
||||
unsigned char data[14] = {0};
|
||||
data[0] = 0x0E; // size of data packet
|
||||
data[1] = 0x00;
|
||||
data[2] = 0x01;
|
||||
data[3] = 0x09;
|
||||
data[4] = 0x01;
|
||||
data[5] = 0x06;
|
||||
data[6] = led_id;
|
||||
data[7] = 0x01;
|
||||
if(save)
|
||||
{
|
||||
data[8] = 0x03; // 0x00 for no save, 0x03 for save
|
||||
}
|
||||
else
|
||||
{
|
||||
data[8] = 0x00;
|
||||
}
|
||||
data[9] = r;
|
||||
data[10] = g;
|
||||
data[11] = b;
|
||||
data[12] = 0xFF;
|
||||
data[13] = 0xFF;
|
||||
|
||||
SendPacket(data, 14);
|
||||
}
|
||||
|
||||
void SeagateController::SendPacket
|
||||
(
|
||||
void * packet,
|
||||
unsigned char packet_sz
|
||||
)
|
||||
{
|
||||
/*-----------------------------------------------------------------------------*\
|
||||
| Create buffers to hold header, cdb, and sense |
|
||||
\*-----------------------------------------------------------------------------*/
|
||||
unsigned char cdb[12];
|
||||
unsigned char sense[32];
|
||||
sg_io_hdr header;
|
||||
|
||||
/*-----------------------------------------------------------------------------*\
|
||||
| Set up pass through command |
|
||||
\*-----------------------------------------------------------------------------*/
|
||||
header.interface_id = 'S';
|
||||
header.dxfer_direction = SG_DXFER_TO_DEV;
|
||||
header.cmd_len = sizeof(cdb);
|
||||
header.mx_sb_len = sizeof(sense);
|
||||
header.iovec_count = 0;
|
||||
header.dxfer_len = packet_sz;
|
||||
header.dxferp = packet;
|
||||
header.cmdp = cdb;
|
||||
header.sbp = sense;
|
||||
header.timeout = 20000;
|
||||
header.flags = 0;
|
||||
|
||||
cdb[0] = 0xD2;
|
||||
cdb[1] = 0x53;
|
||||
cdb[2] = 0x65;
|
||||
cdb[3] = 0x74;
|
||||
cdb[4] = 0x4C;
|
||||
cdb[5] = 0x65;
|
||||
cdb[6] = 0x64;
|
||||
cdb[7] = 0x00;
|
||||
cdb[8] = 0x00;
|
||||
cdb[9] = 0x30;
|
||||
cdb[10] = packet_sz;
|
||||
cdb[11] = 0x00;
|
||||
|
||||
/*-----------------------------------------------------------------------------*\
|
||||
| Send pass through command |
|
||||
\*-----------------------------------------------------------------------------*/
|
||||
ioctl(fd, SG_IO, &header);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*-----------------------------------------*\
|
||||
| SeagateController.h |
|
||||
| |
|
||||
| Definitions for Seagate Firecuda |
|
||||
| External HDD RGB controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/15/2023 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <scsi/sg.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
class SeagateController
|
||||
{
|
||||
public:
|
||||
SeagateController(int fd, char* path);
|
||||
~SeagateController();
|
||||
|
||||
std::string GetLocation();
|
||||
|
||||
void SetLED
|
||||
(
|
||||
unsigned char led_id,
|
||||
unsigned char r,
|
||||
unsigned char g,
|
||||
unsigned char b,
|
||||
bool save
|
||||
);
|
||||
|
||||
private:
|
||||
int fd;
|
||||
std::string path;
|
||||
|
||||
void SendPacket
|
||||
(
|
||||
void * packet,
|
||||
unsigned char packet_sz
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
#include "Detector.h"
|
||||
#include "SeagateController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Seagate.h"
|
||||
#include <vector>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectSeagateControllers *
|
||||
* *
|
||||
* Detects ENE SMBus controllers on XPG Spectrix S40G NVMe devices *
|
||||
* *
|
||||
* Tests for the existance of a file descriptor matching *
|
||||
* SCSI#Disk&Ven_NVMe&Prod_XPG_SPECTRIX_S40# on Windows machines *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectSeagateControllers()
|
||||
{
|
||||
int fd = open("/dev/sdb", O_RDWR);
|
||||
|
||||
if(fd > 0)
|
||||
{
|
||||
SeagateController* controller = new SeagateController(fd, "/dev/sdb");
|
||||
RGBController_Seagate* rgb_controller = new RGBController_Seagate(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
||||
} /* DetectSpectrixS40GControllers() */
|
||||
|
||||
REGISTER_DETECTOR( "Seagate Firecuda HDD", DetectSeagateControllers);
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+14
-6
@@ -206,7 +206,6 @@ INCLUDEPATH +=
|
||||
Controllers/RedSquareKeyroxController/ \
|
||||
Controllers/RoccatController/ \
|
||||
Controllers/SapphireGPUController/ \
|
||||
Controllers/SeagateController/ \
|
||||
Controllers/SinowealthController/ \
|
||||
Controllers/SonyGamepadController/ \
|
||||
Controllers/SRGBmodsController/ \
|
||||
@@ -689,8 +688,6 @@ HEADERS +=
|
||||
Controllers/SapphireGPUController/SapphireNitroGlowV3Controller.h \
|
||||
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV1.h \
|
||||
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV3.h \
|
||||
Controllers/SeagateController/SeagateController.h \
|
||||
Controllers/SeagateController/RGBController_Seagate.h \
|
||||
Controllers/SinowealthController/SinowealthController.h \
|
||||
Controllers/SinowealthController/SinowealthController1007.h \
|
||||
Controllers/SinowealthController/SinowealthGMOWController.h \
|
||||
@@ -1380,9 +1377,6 @@ SOURCES +=
|
||||
Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp \
|
||||
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV1.cpp \
|
||||
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV3.cpp \
|
||||
Controllers/SeagateController/SeagateController.cpp \
|
||||
Controllers/SeagateController/SeagateControllerDetect.cpp \
|
||||
Controllers/SeagateController/RGBController_Seagate.cpp \
|
||||
Controllers/SinowealthController/SinowealthController.cpp \
|
||||
Controllers/SinowealthController/SinowealthController1007.cpp \
|
||||
Controllers/SinowealthController/SinowealthGMOWController.cpp \
|
||||
@@ -1572,6 +1566,8 @@ win32:INCLUDEPATH +=
|
||||
wmi/ \
|
||||
Controllers/AsusTUFLaptopController \
|
||||
Controllers/NVIDIAIlluminationController \
|
||||
Controllers/SeagateController/ \
|
||||
Controllers/SeagateController/SeagateControllerWindows \
|
||||
|
||||
win32:SOURCES += \
|
||||
# dependencies/hidapi/hidapi.c \
|
||||
@@ -1680,6 +1676,9 @@ win32:SOURCES +=
|
||||
Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination.cpp \
|
||||
Controllers/OpenRazerController/OpenRazerWindowsDetect.cpp \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazerWindows.cpp \
|
||||
Controllers/SeagateController/SeagateControllerWindows/SeagateController.cpp \
|
||||
Controllers/SeagateController/SeagateControllerWindows/SeagateControllerDetect.cpp \
|
||||
Controllers/SeagateController/RGBController_Seagate.cpp \
|
||||
|
||||
win32:HEADERS += \
|
||||
dependencies/display-library/include/adl_defines.h \
|
||||
@@ -1700,6 +1699,8 @@ win32:HEADERS +=
|
||||
Controllers/NVIDIAIlluminationController/NVIDIAIlluminationV1Controller.h \
|
||||
Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination.h \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazerWindows.h \
|
||||
Controllers/SeagateController/SeagateControllerWindows/SeagateController.h \
|
||||
Controllers/SeagateController/RGBController_Seagate.h \
|
||||
|
||||
win32:contains(QMAKE_TARGET.arch, x86_64) {
|
||||
LIBS += \
|
||||
@@ -1788,6 +1789,8 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
INCLUDEPATH += \
|
||||
Controllers/FaustusController \
|
||||
Controllers/LinuxLEDController \
|
||||
Controllers/SeagateController/ \
|
||||
Controllers/SeagateController/SeagateControllerLinux/ \
|
||||
|
||||
HEADERS += \
|
||||
i2c_smbus/i2c_smbus_linux.h \
|
||||
@@ -1799,6 +1802,8 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
Controllers/LinuxLEDController/LinuxLEDController.h \
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.h \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.h \
|
||||
Controllers/SeagateController/SeagateControllerLinux/SeagateController.h \
|
||||
Controllers/SeagateController/RGBController_Seagate.h \
|
||||
|
||||
LIBS += \
|
||||
-lusb-1.0 \
|
||||
@@ -1853,6 +1858,9 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.cpp \
|
||||
Controllers/OpenRazerController/OpenRazerDetect.cpp \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.cpp \
|
||||
Controllers/SeagateController/SeagateControllerLinux/SeagateController.cpp \
|
||||
Controllers/SeagateController/SeagateControllerLinux/SeagateControllerDetect.cpp \
|
||||
Controllers/SeagateController/RGBController_Seagate.cpp \
|
||||
|
||||
#-------------------------------------------------------------------------------------------#
|
||||
# Set up install paths #
|
||||
|
||||
Reference in new issue
Block a user