Make all drivers using parallel port fail if they cannot get IO permission.

This commit is contained in:
mmdolze
2009-09-14 19:08:22 +00:00
parent 6e781ed0a0
commit 55a9795c8a
7 changed files with 34 additions and 12 deletions
+1
View File
@@ -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
+7 -2
View File
@@ -64,8 +64,9 @@
#include "hd44780-4bit.h"
#include "hd44780-low.h"
#include "lpt-port.h"
#include "port.h"
#include "report.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -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;
+7 -2
View File
@@ -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 <stdio.h>
#include <string.h>
#include <errno.h>
@@ -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;
+7 -2
View File
@@ -53,8 +53,9 @@
#include "hd44780-serialLpt.h"
#include "hd44780-low.h"
#include "lpt-port.h"
#include "port.h"
#include "report.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -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;
+5 -1
View File
@@ -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;
+5 -3
View File
@@ -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)",
+2 -2
View File
@@ -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;