1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-14 03:39:53 +03:00
aports/community/lcdproc/fix-lpt-port-detection.patch
2024-11-21 21:38:48 +00:00

72 lines
2.2 KiB
Diff

From 695aa0f76173a03295a6d897d7260a09951931bc Mon Sep 17 00:00:00 2001
From: Harald Geyer <harald@ccbib.org>
Date: Mon, 19 Jul 2021 23:38:05 +0200
Subject: [PATCH] Fix lpt port detection
The old detection logic was too greedy, claiming raw port access on
platforms like ARM, that don't follow x86 conventions.
Nowadays we have many platform independent drivers, so let's support
non-x86 platforms officially.
Closes: #137
Signed-off-by: Harald Geyer <harald@ccbib.org>
---
INSTALL.md | 7 +++----
server/drivers/port.h | 8 ++++++--
server/drivers/serialVFD_io.c | 6 ++++++
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/server/drivers/port.h b/server/drivers/port.h
index c584cd4e..f80a09d7 100644
--- a/server/drivers/port.h
+++ b/server/drivers/port.h
@@ -94,7 +94,7 @@ static inline int port_deny_multiple(unsigned short port, unsigned short count);
/* ---------------------------- Linux ------------------------------------ */
/* Use ioperm, inb and outb in <sys/io.h> (Linux) */
/* And iopl for higher addresses of PCI LPT cards */
-#if defined HAVE_IOPERM
+#if defined HAVE_IOPERM && (defined(__x86__) || defined(__x86_64__))
/* Glibc2 and Glibc1 */
# ifdef HAVE_SYS_IO_H
@@ -333,7 +333,7 @@ static inline int port_deny_multiple (unsigned short port, unsigned short count)
return i386_set_ioperm(port, count, 0);
}
-#else
+#elif (defined(__x86__) || defined(__x86_64__))
/* ------------------------- Everything else ----------------------------- */
/* Last chance! Use /dev/io and i386 ASM code (BSD4.3 ?) */
@@ -384,6 +384,10 @@ static inline int port_deny_multiple (unsigned short port, unsigned short count)
return 0;
}
+#else
+
+#error No low level lpt port access supported on this platform.
+
#endif
#endif /* PORT_H */
diff --git a/server/drivers/serialVFD_io.c b/server/drivers/serialVFD_io.c
index 8dbc3794..e20c0ea5 100644
--- a/server/drivers/serialVFD_io.c
+++ b/server/drivers/serialVFD_io.c
@@ -41,8 +41,14 @@
#include "lcd.h"
#include "shared/report.h"
+
+#ifdef HAVE_PCSTYLE_LPT_CONTROL
+
#include "lpt-port.h"
#include "port.h"
+
+#endif
+
#include "serialVFD_io.h"
#include "serialVFD.h"