[PATCH] Re: ports/76434: sysutils/lcdproc coredumps when started with the HD44780 driver
Markus Dolze
bsdfan at nurfuerspam.de
Mon Mar 28 19:40:15 UTC 2005
The following reply was made to PR ports/76434; it has been noted by GNATS.
From: Markus Dolze <bsdfan at nurfuerspam.de>
To: freebsd-gnats-submit at FreeBSD.org, purple at fajita.org
Cc:
Subject: [PATCH] Re: ports/76434: sysutils/lcdproc coredumps when started
with the HD44780 driver
Date: Mon, 28 Mar 2005 21:38:56 +0200
This is a multi-part message in MIME format.
--------------040307040402080707010801
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Attached is the necessary patch for 0.4.5. I tested it on my hd44780
display. Please review.
--------------040307040402080707010801
Content-Type: text/plain;
name="patch-port.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="patch-port.h"
--- server/drivers/port.h.orig Mon Mar 28 20:50:31 2005
+++ server/drivers/port.h Mon Mar 28 20:50:50 2005
@@ -145,6 +145,8 @@
#include <machine/cpufunc.h>
#include <machine/sysarch.h>
+static FILE * port_access_handle = NULL ;
+
// Read a byte from port
static inline int port_in (unsigned short int port) {
return inb(port);
@@ -157,12 +159,22 @@
// Get access to a specific port
static inline int port_access (unsigned short int port) {
- return i386_set_ioperm(port, 1, 1);
+ if( port_access_handle
+ || (port_access_handle = fopen("/dev/io", "rw")) != NULL ) {
+ return i386_set_ioperm(port, 1, 1);
+ } else {
+ return( -1 ); /* Failure */
+ }
}
// Get access 3 to ports: port (CONTROL), port+1 (STATUS) and port+2 (DATA)
static inline int port_access_full (unsigned short int port) {
- return i386_set_ioperm(port, 3, 1);
+ if( port_access_handle
+ || (port_access_handle = fopen("/dev/io", "rw")) != NULL ) {
+ return i386_set_ioperm(port, 3, 1);
+ } else {
+ return( -1 ); /* Failure */
+ }
}
//#endif // defined HAVE_I386_IOPERM_FREEBSD && defined HAVE_MACHINE_SYSARCH_H
--------------040307040402080707010801--
More information about the freebsd-ports-bugs
mailing list