diff --git a/ChangeLog b/ChangeLog index 46b5d7c..f4cea76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ Key: v.0.5dev (ongoing development) * Update driver includes and LDFLAGS (fixed glk and bayrad binding error) * Modify all drivers to use server/drivers/report.h instead of shared/report.h + * Make all drivers using parallel port fail if they cannot get IO permission v0.5.3 + lcdexec: notification when called program finishes diff --git a/server/drivers/hd44780-4bit.c b/server/drivers/hd44780-4bit.c index 2640397..549b3e5 100644 --- a/server/drivers/hd44780-4bit.c +++ b/server/drivers/hd44780-4bit.c @@ -64,8 +64,9 @@ #include "hd44780-4bit.h" #include "hd44780-low.h" #include "lpt-port.h" - #include "port.h" +#include "report.h" + #include #include #include @@ -109,7 +110,11 @@ hd_init_4bit(Driver *drvthis) int enableLines = EN1 | EN2 | ((p->numDisplays == 3) ? EnMask[2] : 0); // Reserve the port registers - port_access_multiple(p->port,3); + if (port_access_multiple(p->port,3)) { + report(RPT_ERR, "%s: cannot get IO-permission for 0x%03X: %s", + drvthis->name, p->port, strerror(errno)); + return -1; + } hd44780_functions->senddata = lcdstat_HD44780_senddata; hd44780_functions->backlight = lcdstat_HD44780_backlight; diff --git a/server/drivers/hd44780-ext8bit.c b/server/drivers/hd44780-ext8bit.c index 694ab29..5235908 100644 --- a/server/drivers/hd44780-ext8bit.c +++ b/server/drivers/hd44780-ext8bit.c @@ -55,9 +55,10 @@ #include "hd44780-ext8bit.h" #include "hd44780-low.h" #include "lpt-port.h" - #include "port.h" #include "lcd_sem.h" +#include "report.h" + #include #include #include @@ -97,7 +98,11 @@ hd_init_ext8bit(Driver *drvthis) semid = sem_get(); // Reserve the port registers - port_access_multiple(p->port,3); + if (port_access_multiple(p->port,3)) { + report(RPT_ERR, "%s: cannot get IO-permission for 0x%03X: %s", + drvthis->name, p->port, strerror(errno)); + return -1; + } hd44780_functions->senddata = lcdtime_HD44780_senddata; hd44780_functions->backlight = lcdtime_HD44780_backlight; diff --git a/server/drivers/hd44780-serialLpt.c b/server/drivers/hd44780-serialLpt.c index 807e0b6..c921c31 100644 --- a/server/drivers/hd44780-serialLpt.c +++ b/server/drivers/hd44780-serialLpt.c @@ -53,8 +53,9 @@ #include "hd44780-serialLpt.h" #include "hd44780-low.h" #include "lpt-port.h" - #include "port.h" +#include "report.h" + #include #include #include @@ -89,7 +90,11 @@ hd_init_serialLpt(Driver *drvthis) unsigned char enableLines = EN1 | EN2; // Reserve the port registers - port_access_multiple(p->port,3); + if (port_access_multiple(p->port,3)) { + report(RPT_ERR, "%s: cannot get IO-permission for 0x%03X: %s", + drvthis->name, p->port, strerror(errno)); + return -1; + } hd44780_functions->senddata = lcdserLpt_HD44780_senddata; hd44780_functions->backlight = lcdserLpt_HD44780_backlight; diff --git a/server/drivers/hd44780-winamp.c b/server/drivers/hd44780-winamp.c index 25664e1..0731335 100644 --- a/server/drivers/hd44780-winamp.c +++ b/server/drivers/hd44780-winamp.c @@ -125,7 +125,11 @@ hd_init_winamp(Driver *drvthis) } // Reserve the port registers - port_access_multiple(p->port,3); + if (port_access_multiple(p->port,3)) { + report(RPT_ERR, "%s: cannot get IO-permission for 0x%03X: %s", + drvthis->name, p->port, strerror(errno)); + return -1; + } hd44780_functions->senddata = lcdwinamp_HD44780_senddata; hd44780_functions->backlight = lcdwinamp_HD44780_backlight; diff --git a/server/drivers/sed1330.c b/server/drivers/sed1330.c index 4f76ee9..5b46650 100644 --- a/server/drivers/sed1330.c +++ b/server/drivers/sed1330.c @@ -531,9 +531,11 @@ sed1330_init( Driver * drvthis ) // Arrange for access to port debug(RPT_DEBUG, "%s: getting port access", __FUNCTION__); - port_access(p->port); - port_access(p->port+1); - port_access(p->port+2); + if (port_access_multiple(p->port,3)) { + report(RPT_ERR, "%s: cannot get IO-permission for 0x%03X: %s", + drvthis->name, p->port, strerror(errno)); + return -1; + } if (timing_init() == -1) { report(RPT_ERR, "%s: timing_init() failed (%s)", diff --git a/server/drivers/t6963.c b/server/drivers/t6963.c index 3c0c159..8d88f47 100644 --- a/server/drivers/t6963.c +++ b/server/drivers/t6963.c @@ -119,13 +119,13 @@ t6963_init (Driver *drvthis) /* -- Get permission to parallel port --------------------------------------------*/ debug(RPT_DEBUG, "T6963: Getting permission to parallel port %d...", p->port); - if (port_access_multiple(p->port, 3)) { //ioperm(p->port, 3, 1)) { + if (port_access_multiple(p->port, 3)) { report(RPT_ERR, "%s: no permission to port 0x%03X: (%s)", drvthis->name, p->port, strerror(errno)); return -1; } - if (port_access(0x80)) { //ioperm(0x80, 1, 1)) { + if (port_access(0x80)) { report(RPT_ERR, "%s: no permission to port 0x80: (%s)", drvthis->name, strerror(errno)); return -1;