EmptyEpsilon: fix ioctl on musl
This commit is contained in:
parent
04d0c8eaf3
commit
b568ce7214
|
@ -1,10 +1,10 @@
|
|||
this fixes the serial driver on musl as well as on ppc
|
||||
|
||||
diff --git src/hardware/serialDriver.cpp src/hardware/serialDriver.cpp
|
||||
index 0bb0228..ece29ab 100644
|
||||
index 0bb0228..d935c63 100644
|
||||
--- src/hardware/serialDriver.cpp
|
||||
+++ src/hardware/serialDriver.cpp
|
||||
@@ -2,11 +2,14 @@
|
||||
@@ -2,20 +2,31 @@
|
||||
#ifdef __WIN32__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
@ -14,13 +14,17 @@ index 0bb0228..ece29ab 100644
|
|||
//#include <sys/ioctl.h>
|
||||
//#include <termios.h>
|
||||
#ifndef ANDROID
|
||||
+#ifndef __GLIBC__
|
||||
+#define __THROW
|
||||
+#endif
|
||||
extern "C" {
|
||||
+#ifdef __GLIBC__
|
||||
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
|
||||
extern int tcsendbreak (int __fd, int __duration) __THROW;
|
||||
@@ -16,6 +19,12 @@
|
||||
+#else
|
||||
+ extern int ioctl (int, int, ...);
|
||||
+ extern int tcsendbreak (int, int);
|
||||
+#endif
|
||||
}
|
||||
#endif
|
||||
#include <asm/termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
|
@ -33,7 +37,7 @@ index 0bb0228..ece29ab 100644
|
|||
#endif
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#include <IOKit/serial/ioss.h>
|
||||
@@ -57,7 +66,7 @@ SerialPort::SerialPort(string name)
|
||||
@@ -57,7 +68,7 @@ SerialPort::SerialPort(string name)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -42,7 +46,7 @@ index 0bb0228..ece29ab 100644
|
|||
if (!name.startswith("/dev/"))
|
||||
name = "/dev/" + name;
|
||||
handle = open(name.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
@@ -76,7 +85,7 @@ SerialPort::~SerialPort()
|
||||
@@ -76,7 +87,7 @@ SerialPort::~SerialPort()
|
||||
CloseHandle(handle);
|
||||
handle = INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
|
@ -51,7 +55,7 @@ index 0bb0228..ece29ab 100644
|
|||
close(handle);
|
||||
handle = 0;
|
||||
#endif
|
||||
@@ -87,7 +96,7 @@ bool SerialPort::isOpen()
|
||||
@@ -87,7 +98,7 @@ bool SerialPort::isOpen()
|
||||
#ifdef __WIN32__
|
||||
return handle != INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
|
@ -60,7 +64,7 @@ index 0bb0228..ece29ab 100644
|
|||
return handle;
|
||||
#endif
|
||||
return false;
|
||||
@@ -163,7 +172,7 @@ void SerialPort::configure(int baudrate, int databits, EParity parity, EStopBits
|
||||
@@ -163,7 +174,7 @@ void SerialPort::configure(int baudrate, int databits, EParity parity, EStopBits
|
||||
LOG(ERROR) << "SetCommState failed!" << error;
|
||||
}
|
||||
#endif
|
||||
|
@ -69,7 +73,7 @@ index 0bb0228..ece29ab 100644
|
|||
fsync(handle);
|
||||
|
||||
struct termios2 tio;
|
||||
@@ -317,7 +326,7 @@ void SerialPort::send(void* data, int data_size)
|
||||
@@ -317,7 +328,7 @@ void SerialPort::send(void* data, int data_size)
|
||||
data_size -= written;
|
||||
}
|
||||
#endif
|
||||
|
@ -78,7 +82,7 @@ index 0bb0228..ece29ab 100644
|
|||
while(data_size > 0)
|
||||
{
|
||||
int written = write(handle, data, data_size);
|
||||
@@ -345,7 +354,7 @@ int SerialPort::recv(void* data, int data_size)
|
||||
@@ -345,7 +356,7 @@ int SerialPort::recv(void* data, int data_size)
|
||||
}
|
||||
return read_size;
|
||||
#endif
|
||||
|
@ -87,7 +91,7 @@ index 0bb0228..ece29ab 100644
|
|||
int bytes_read = read(handle, data, data_size);
|
||||
if (bytes_read > 0)
|
||||
return bytes_read;
|
||||
@@ -361,7 +370,7 @@ void SerialPort::setDTR()
|
||||
@@ -361,7 +372,7 @@ void SerialPort::setDTR()
|
||||
#ifdef __WIN32__
|
||||
EscapeCommFunction(handle, SETDTR);
|
||||
#endif
|
||||
|
@ -96,7 +100,7 @@ index 0bb0228..ece29ab 100644
|
|||
int bit = TIOCM_DTR;
|
||||
ioctl(handle, TIOCMBIS, &bit);
|
||||
#endif
|
||||
@@ -377,7 +386,7 @@ void SerialPort::clearDTR()
|
||||
@@ -377,7 +388,7 @@ void SerialPort::clearDTR()
|
||||
#ifdef __WIN32__
|
||||
EscapeCommFunction(handle, CLRDTR);
|
||||
#endif
|
||||
|
@ -105,7 +109,7 @@ index 0bb0228..ece29ab 100644
|
|||
int bit = TIOCM_DTR;
|
||||
ioctl(handle, TIOCMBIC, &bit);
|
||||
#endif
|
||||
@@ -393,7 +402,7 @@ void SerialPort::setRTS()
|
||||
@@ -393,7 +404,7 @@ void SerialPort::setRTS()
|
||||
#ifdef __WIN32__
|
||||
EscapeCommFunction(handle, SETRTS);
|
||||
#endif
|
||||
|
@ -114,7 +118,7 @@ index 0bb0228..ece29ab 100644
|
|||
int bit = TIOCM_RTS;
|
||||
ioctl(handle, TIOCMBIS, &bit);
|
||||
#endif
|
||||
@@ -409,7 +418,7 @@ void SerialPort::clearRTS()
|
||||
@@ -409,7 +420,7 @@ void SerialPort::clearRTS()
|
||||
#ifdef __WIN32__
|
||||
EscapeCommFunction(handle, CLRRTS);
|
||||
#endif
|
||||
|
@ -123,7 +127,7 @@ index 0bb0228..ece29ab 100644
|
|||
int bit = TIOCM_RTS;
|
||||
ioctl(handle, TIOCMBIC, &bit);
|
||||
#endif
|
||||
@@ -425,7 +434,7 @@ void SerialPort::sendBreak()
|
||||
@@ -425,7 +436,7 @@ void SerialPort::sendBreak()
|
||||
Sleep(1);
|
||||
ClearCommBreak(handle);
|
||||
#endif
|
||||
|
@ -132,7 +136,7 @@ index 0bb0228..ece29ab 100644
|
|||
tcsendbreak(handle, 0);
|
||||
#endif
|
||||
}
|
||||
@@ -456,7 +465,7 @@ std::vector<string> SerialPort::getAvailablePorts()
|
||||
@@ -456,7 +467,7 @@ std::vector<string> SerialPort::getAvailablePorts()
|
||||
LOG(ERROR) << "Failed to open registry key for serial port list.";
|
||||
}
|
||||
#endif
|
||||
|
@ -141,7 +145,7 @@ index 0bb0228..ece29ab 100644
|
|||
DIR* dir = opendir("/dev/");
|
||||
if (dir)
|
||||
{
|
||||
@@ -511,7 +520,7 @@ string SerialPort::getPseudoDriverName(string port)
|
||||
@@ -511,7 +522,7 @@ string SerialPort::getPseudoDriverName(string port)
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,7 @@ _ver_major=2020
|
|||
_ver_minor=11
|
||||
_ver_patch=23
|
||||
version="${_ver_major}.${_ver_minor}.${_ver_patch}"
|
||||
revision=2
|
||||
revision=3
|
||||
wrksrc="EmptyEpsilon-EE-${version}"
|
||||
build_style=cmake
|
||||
configure_args="-DSERIOUS_PROTON_DIR=$XBPS_BUILDDIR/SeriousProton-EE-${version}
|
||||
|
|
Loading…
Reference in New Issue