]> cvs.zerfleddert.de Git - usb-driver/blobdiff - parport.c
Let usb-driver work with a no-module kernel by Gyorgy 'nog' Jeney
[usb-driver] / parport.c
index 57ab08355593964f4b15ed5f869dd1a9ec9f8cc5..b32b6e26f7947a0629d9ecc3caa90ee3eba24a00 100644 (file)
--- a/parport.c
+++ b/parport.c
@@ -20,6 +20,12 @@ int parport_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
        unsigned char val;
        static unsigned char last_pp_write = 0;
 
+       if (parportfd < 0)
+               return ret;
+
+       if (ioctl(parportfd, PPCLAIM) == -1)
+               return -1;
+
        for (i = 0; i < num; i++) {
                DPRINTF("dwPort: 0x%lx, cmdTrans: %lu, dwbytes: %ld, fautoinc: %ld, dwoptions: %ld\n",
                                (unsigned long)tr[i].dwPort, tr[i].cmdTrans, tr[i].dwBytes,
@@ -33,9 +39,6 @@ int parport_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
                        DPRINTF("write byte: %d\n", val);
 #endif
 
-               if (parportfd < 0)
-                       return ret;
-
                if (port == ppbase + PP_DATA) {
                        DPRINTF("data port\n");
                        switch(tr[i].cmdTrans) {
@@ -114,6 +117,8 @@ int parport_transfer(WD_TRANSFER *tr, int fd, unsigned int request, int ppbase,
 #endif
        }
 
+       ioctl(parportfd, PPRELEASE);
+
        return ret;
 }
 
@@ -139,6 +144,7 @@ int parport_open(int num) {
                if (ioctl(parportfd, PPNEGOT, &pmode) == -1)
                        return -1;
 
+               ioctl(parportfd, PPRELEASE);
 #if 0
                if (cr->Card.dwItems > 1 && cr->Card.Item[1].I.IO.dwAddr) {
                        DPRINTF("ECP mode requested\n");
Impressum, Datenschutz