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