X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/blobdiff_plain/25ba7a49098fb2f4c120293d8f7c7404e5d3687b..0c2db148a4e604ceeab5eda38efcf64d1ef25c76:/parport.c diff --git a/parport.c b/parport.c index 57ab083..b32b6e2 100644 --- 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");