mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-14 02:47:19 -04:00
scsiapi cleanup, add a non-functional MacOS version so it can build on all three platforms
This commit is contained in:
@@ -25,10 +25,13 @@ void DetectSeagateControllers()
|
||||
{
|
||||
scsi_device * dev = scsi_open_path(info->path);
|
||||
|
||||
SeagateController* controller = new SeagateController(dev, info->path);
|
||||
RGBController_Seagate* rgb_controller = new RGBController_Seagate(controller);
|
||||
if(dev)
|
||||
{
|
||||
SeagateController* controller = new SeagateController(dev, info->path);
|
||||
RGBController_Seagate* rgb_controller = new RGBController_Seagate(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
|
||||
32
OpenRGB.pro
32
OpenRGB.pro
@@ -79,6 +79,7 @@ INCLUDEPATH +=
|
||||
i2c_tools/ \
|
||||
net_port/ \
|
||||
pci_ids/ \
|
||||
scsiapi/ \
|
||||
serial_port/ \
|
||||
super_io/ \
|
||||
AutoStart/ \
|
||||
@@ -206,6 +207,7 @@ INCLUDEPATH +=
|
||||
Controllers/RedSquareKeyroxController/ \
|
||||
Controllers/RoccatController/ \
|
||||
Controllers/SapphireGPUController/ \
|
||||
Controllers/SeagateController/ \
|
||||
Controllers/SinowealthController/ \
|
||||
Controllers/SonyGamepadController/ \
|
||||
Controllers/SRGBmodsController/ \
|
||||
@@ -300,6 +302,7 @@ HEADERS +=
|
||||
qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.h \
|
||||
qt/OpenRGBZoneResizeDialog/OpenRGBZoneResizeDialog.h \
|
||||
qt/OpenRGBZonesBulkResizer/OpenRGBZonesBulkResizer.h \
|
||||
scsiapi/scsiapi.h \
|
||||
serial_port/find_usb_serial_port.h \
|
||||
serial_port/serial_port.h \
|
||||
StringUtils.h \
|
||||
@@ -688,6 +691,8 @@ 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 \
|
||||
@@ -1377,6 +1382,9 @@ 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 \
|
||||
@@ -1566,8 +1574,6 @@ win32:INCLUDEPATH +=
|
||||
wmi/ \
|
||||
Controllers/AsusTUFLaptopController \
|
||||
Controllers/NVIDIAIlluminationController \
|
||||
Controllers/SeagateController/ \
|
||||
scsiapi/ \
|
||||
|
||||
win32:SOURCES += \
|
||||
# dependencies/hidapi/hidapi.c \
|
||||
@@ -1662,6 +1668,7 @@ win32:SOURCES +=
|
||||
i2c_smbus/i2c_smbus_nct6775.cpp \
|
||||
i2c_smbus/i2c_smbus_nvapi.cpp \
|
||||
i2c_smbus/i2c_smbus_piix4.cpp \
|
||||
scsiapi/scsiapi_windows.c \
|
||||
serial_port/find_usb_serial_port_win.cpp \
|
||||
wmi/wmi.cpp \
|
||||
AutoStart/AutoStart-Windows.cpp \
|
||||
@@ -1676,10 +1683,6 @@ win32:SOURCES +=
|
||||
Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination.cpp \
|
||||
Controllers/OpenRazerController/OpenRazerWindowsDetect.cpp \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazerWindows.cpp \
|
||||
Controllers/SeagateController/SeagateController.cpp \
|
||||
Controllers/SeagateController/SeagateControllerDetect.cpp \
|
||||
Controllers/SeagateController/RGBController_Seagate.cpp \
|
||||
scsiapi/scsiapi_windows.c \
|
||||
|
||||
win32:HEADERS += \
|
||||
dependencies/display-library/include/adl_defines.h \
|
||||
@@ -1700,9 +1703,6 @@ win32:HEADERS +=
|
||||
Controllers/NVIDIAIlluminationController/NVIDIAIlluminationV1Controller.h \
|
||||
Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination.h \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazerWindows.h \
|
||||
Controllers/SeagateController/SeagateController.h \
|
||||
Controllers/SeagateController/RGBController_Seagate.h \
|
||||
scsiapi\scsiapi.h \
|
||||
|
||||
win32:contains(QMAKE_TARGET.arch, x86_64) {
|
||||
LIBS += \
|
||||
@@ -1791,8 +1791,6 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
INCLUDEPATH += \
|
||||
Controllers/FaustusController \
|
||||
Controllers/LinuxLEDController \
|
||||
Controllers/SeagateController/ \
|
||||
scsiapi/ \
|
||||
|
||||
HEADERS += \
|
||||
i2c_smbus/i2c_smbus_linux.h \
|
||||
@@ -1804,9 +1802,6 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
Controllers/LinuxLEDController/LinuxLEDController.h \
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.h \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.h \
|
||||
Controllers/SeagateController/SeagateController.h \
|
||||
Controllers/SeagateController/RGBController_Seagate.h \
|
||||
scsiapi/scsiapi.h \
|
||||
|
||||
LIBS += \
|
||||
-lusb-1.0 \
|
||||
@@ -1848,6 +1843,7 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
SOURCES += \
|
||||
dependencies/hueplusplus-1.0.0/src/LinHttpHandler.cpp \
|
||||
i2c_smbus/i2c_smbus_linux.cpp \
|
||||
scsiapi/scsiapi_linux.c \
|
||||
serial_port/find_usb_serial_port_linux.cpp \
|
||||
AutoStart/AutoStart-Linux.cpp \
|
||||
Controllers/AsusTUFLaptopController/AsusTUFLaptopLinuxController.cpp \
|
||||
@@ -1861,10 +1857,6 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.cpp \
|
||||
Controllers/OpenRazerController/OpenRazerDetect.cpp \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.cpp \
|
||||
Controllers/SeagateController/SeagateController.cpp \
|
||||
Controllers/SeagateController/SeagateControllerDetect.cpp \
|
||||
Controllers/SeagateController/RGBController_Seagate.cpp \
|
||||
scsiapi/scsiapi.c \
|
||||
|
||||
#-------------------------------------------------------------------------------------------#
|
||||
# Set up install paths #
|
||||
@@ -2057,6 +2049,9 @@ macx:contains(QMAKE_HOST.arch, arm64) {
|
||||
INCLUDEPATH += \
|
||||
/opt/homebrew/include \
|
||||
|
||||
SOURCES += \
|
||||
scsiapi/scsiapi_macos.c \
|
||||
|
||||
LIBS += \
|
||||
-L/opt/homebrew/lib \
|
||||
}
|
||||
@@ -2072,6 +2067,7 @@ macx:contains(QMAKE_HOST.arch, x86_64) {
|
||||
|
||||
SOURCES += \
|
||||
i2c_smbus/i2c_smbus_i801.cpp \
|
||||
scsiapi/scsiapi_macos.c \
|
||||
|
||||
HEADERS += \
|
||||
dependencies/macUSPCIO/macUSPCIOAccess.h \
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
#include <fileapi.h>
|
||||
#include <ntddscsi.h>
|
||||
#include "WinIoCtl.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
@@ -32,6 +34,9 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -57,8 +62,6 @@ struct scsi_device
|
||||
#else
|
||||
int fd;
|
||||
#endif
|
||||
char * vendor;
|
||||
char * product;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| scsiapi.c |
|
||||
| scsiapi_linux.c |
|
||||
| |
|
||||
| Cross-platform SCSI access library |
|
||||
| Linux implementation |
|
||||
| |
|
||||
| Adam Honse <calcprogrammer1@gmail.com> 7/28/2023 |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -178,9 +179,15 @@ void scsi_free_enumeration(struct scsi_device_info * devs)
|
||||
|
||||
struct scsi_device * scsi_open_path(const char *path)
|
||||
{
|
||||
struct scsi_device * device = malloc(sizeof(struct scsi_device));
|
||||
int device_fd = open(path, O_RDWR);
|
||||
|
||||
device->fd = open(path, O_RDWR);
|
||||
struct scsi_device * device = NULL;
|
||||
|
||||
if(device_fd > 0)
|
||||
{
|
||||
device = malloc(sizeof(struct scsi_device));
|
||||
device->fd = device_fd;
|
||||
}
|
||||
|
||||
return(device);
|
||||
}
|
||||
68
scsiapi/scsiapi_macos.c
Normal file
68
scsiapi/scsiapi_macos.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| scsiapi_macos.c |
|
||||
| |
|
||||
| Cross-platform SCSI access library |
|
||||
| MacOS implementation (NON-FUNCTIONAL) |
|
||||
| |
|
||||
| Adam Honse <calcprogrammer1@gmail.com> 7/28/2023 |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Includes |
|
||||
\*---------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "scsiapi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Functions |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
void scsi_close(struct scsi_device * dev)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
struct scsi_device_info * scsi_enumerate(const char * vendor, const char * product)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void scsi_free_enumeration(struct scsi_device_info * devs)
|
||||
{
|
||||
struct scsi_device_info * dev = devs;
|
||||
|
||||
while(dev)
|
||||
{
|
||||
struct scsi_device_info * next = dev->next;
|
||||
|
||||
free(dev->path);
|
||||
free(dev->vendor);
|
||||
free(dev->product);
|
||||
free(dev);
|
||||
|
||||
dev = next;
|
||||
}
|
||||
}
|
||||
|
||||
struct scsi_device * scsi_open_path(const char *path)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int scsi_write(struct scsi_device * dev, const unsigned char * data, size_t length)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
| scsiapi.c |
|
||||
| |
|
||||
| Cross-platform SCSI access library |
|
||||
| Windows implementation |
|
||||
| |
|
||||
| Adam Honse <calcprogrammer1@gmail.com> 7/28/2023 |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -164,9 +165,15 @@ void scsi_free_enumeration(struct scsi_device_info * devs)
|
||||
|
||||
struct scsi_device * scsi_open_path(const char *path)
|
||||
{
|
||||
struct scsi_device * device = malloc(sizeof(struct scsi_device));
|
||||
HANDLE device_fd = CreateFile(path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, (LPSECURITY_ATTRIBUTES)0x0, OPEN_EXISTING, 0x0, (HANDLE)0x0);
|
||||
|
||||
device->fd = CreateFile(path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, (LPSECURITY_ATTRIBUTES)0x0, OPEN_EXISTING, 0x0, (HANDLE)0x0);
|
||||
struct scsi_device * device = NULL;
|
||||
|
||||
if(device_fd != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
device = malloc(sizeof(struct scsi_device));
|
||||
device->fd = device_fd;
|
||||
}
|
||||
|
||||
return(device);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user