parport: ECR = 0x00
[lptgpib.git] / parport.c
index 7167477..798cf30 100644 (file)
--- a/parport.c
+++ b/parport.c
@@ -8,6 +8,7 @@
 #include <poll.h>
 
 static const int port=0x37a;
+static const int port_ecr=0x37a+0x400;
 
 #define LENGTH(x) (sizeof(x)/sizeof(*(x)))
 
@@ -19,10 +20,11 @@ static void cleanup(void) {
 
 int main(void) {
   uint8_t out=0x24;
-  if (ioperm(port,1,1)!=0) {
-    fprintf(stderr,"ioperm 0x%x: %m\n",port);
+  if (iopl(3)!=0) {
+    fprintf(stderr,"iopl 3: %m\n");
     exit(EXIT_FAILURE);
   }
+  outb(0x00,port_ecr); // Standard Mode
   int i=tcgetattr(0,(struct termios *)&tios);
   assert(i==0);
   atexit(cleanup);