Date: Mon, 28 Mar 2005 19:40:15 GMT From: Markus Dolze <bsdfan@nurfuerspam.de> To: freebsd-ports-bugs@FreeBSD.org Subject: [PATCH] Re: ports/76434: sysutils/lcdproc coredumps when started with the HD44780 driver Message-ID: <200503281940.j2SJeFa9040775@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/76434; it has been noted by GNATS. From: Markus Dolze <bsdfan@nurfuerspam.de> To: freebsd-gnats-submit@FreeBSD.org, purple@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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503281940.j2SJeFa9040775>