Skip to content

Commit 8d8f70b

Browse files
Only build PawnIO support in 64-bit builds, provide non-functional stub implementations in super_io.cpp for 32-bit builds
1 parent b349c3f commit 8d8f70b

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

OpenRGB.pro

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ HEADERS +=
198198
scsiapi/scsiapi.h \
199199
serial_port/find_usb_serial_port.h \
200200
serial_port/serial_port.h \
201+
super_io/super_io.h \
201202
StringUtils.h \
202203
SuspendResume/SuspendResume.h \
203204
AutoStart/AutoStart.h \
@@ -342,8 +343,6 @@ win32:SOURCES +=
342343
dependencies/NVFC/nvapi.cpp \
343344
i2c_smbus/Windows/i2c_smbus_amdadl.cpp \
344345
i2c_smbus/Windows/i2c_smbus_nvapi.cpp \
345-
i2c_smbus/Windows/i2c_smbus_pawnio.cpp \
346-
super_io/super_io_pawnio.cpp \
347346
scsiapi/scsiapi_windows.c \
348347
serial_port/find_usb_serial_port_win.cpp \
349348
SuspendResume/SuspendResume_Windows.cpp \
@@ -362,12 +361,15 @@ win32:HEADERS +=
362361
i2c_smbus/Windows/i2c_smbus_amdadl.h \
363362
i2c_smbus/Windows/i2c_smbus_nvapi.h \
364363
i2c_smbus/Windows/i2c_smbus_pawnio.h \
365-
super_io/super_io_pawnio.h \
366364
wmi/wmi.h \
367365
AutoStart/AutoStart-Windows.h \
368366
SuspendResume/SuspendResume_Windows.h \
369367

370368
win32:contains(QMAKE_TARGET.arch, x86_64) {
369+
win32:SOURCES += \
370+
i2c_smbus/Windows/i2c_smbus_pawnio.cpp \
371+
super_io/super_io_pawnio.cpp \
372+
371373
LIBS += \
372374
-lws2_32 \
373375
-liphlpapi \
@@ -378,6 +380,9 @@ win32:contains(QMAKE_TARGET.arch, x86_64) {
378380
}
379381

380382
win32:contains(QMAKE_TARGET.arch, x86) {
383+
win32:SOURCES += \
384+
super_io/super_io.cpp \
385+
381386
LIBS += \
382387
-lws2_32 \
383388
-liphlpapi \

super_io/super_io.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
\*---------------------------------------------------------*/
1111

1212
#include "super_io.h"
13-
#include "super_io_pawnio.h"
1413

15-
#if _MACOSX_X86_X64
14+
#if defined(_MACOSX_X86_X64)
1615
#include "macUSPCIOAccess.h"
16+
#elif defined(_WIN32)
1717
#else
1818
#include <unistd.h>
1919
#include <sys/types.h>
@@ -35,6 +35,13 @@ void superio_enter(int ioreg)
3535
#if defined(_MACOSX_X86_X64)
3636
WriteIoPortByte(ioreg, 0x87);
3737
WriteIoPortByte(ioreg, 0x87);
38+
#elif defined(_WIN32)
39+
/*-----------------------------------------------------*\
40+
| This function is not defined for Windows |
41+
| For 64-bit Windows, super_io_pawnio.cpp is used |
42+
| instead. For 32-bit Windows, this function provides|
43+
| a nonfunctional stub implementation. |
44+
\*-----------------------------------------------------*/
3845
#else
3946
unsigned char temp = 0x87;
4047
dev_port_fd = open("/dev/port", O_RDWR, "rw");
@@ -72,6 +79,13 @@ void superio_outb(int ioreg, int reg, int val)
7279
#if defined(_MACOSX_X86_X64)
7380
WriteIoPortByte(ioreg, reg);
7481
WriteIoPortByte(ioreg + 1, val);
82+
#elif defined(_WIN32)
83+
/*-----------------------------------------------------*\
84+
| This function is not defined for Windows |
85+
| For 64-bit Windows, super_io_pawnio.cpp is used |
86+
| instead. For 32-bit Windows, this function provides|
87+
| a nonfunctional stub implementation. |
88+
\*-----------------------------------------------------*/
7589
#else
7690
dev_port_fd = open("/dev/port", O_RDWR, "rw");
7791

@@ -107,6 +121,14 @@ int superio_inb(int ioreg, int reg)
107121
#if defined(_MACOSX_X86_X64)
108122
WriteIoPortByte(ioreg, reg);
109123
return ReadIoPortByte(ioreg + 1);
124+
#elif defined(_WIN32)
125+
/*-----------------------------------------------------*\
126+
| This function is not defined for Windows |
127+
| For 64-bit Windows, super_io_pawnio.cpp is used |
128+
| instead. For 32-bit Windows, this function provides|
129+
| a nonfunctional stub implementation. |
130+
\*-----------------------------------------------------*/
131+
return -1;
110132
#else
111133
unsigned char temp = 0;
112134
dev_port_fd = open("/dev/port", O_RDWR, "rw");

super_io/super_io_pawnio.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
| SPDX-License-Identifier: GPL-2.0-only |
1010
\*---------------------------------------------------------*/
1111

12-
#include "super_io_pawnio.h"
12+
#include "super_io.h"
1313

1414
#include <Windows.h>
1515
#include "PawnIOLib.h"
1616
#include "i2c_smbus_pawnio.h"
1717

18-
1918
static HANDLE pawnio_handle = NULL;
2019

2120
static int pawnio_chip_type = 0;

super_io/super_io_pawnio.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)