Make all drivers using parallel port fail if they cannot get IO permission.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user