patch-2.4.2 linux/drivers/usb/printer.c

Next file: linux/drivers/usb/rio500.c
Previous file: linux/drivers/usb/pegasus.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.1/linux/drivers/usb/printer.c linux/drivers/usb/printer.c
@@ -17,6 +17,7 @@
  *	v0.4 - fixes in unidirectional mode
  *	v0.5 - add DEVICE_ID string support
  *	v0.6 - never time out
+ *	v0.? - fixed bulk-IN read and poll (David Paschal, paschal@rcsis.com)
  */
 
 /*
@@ -42,7 +43,7 @@
 #include <linux/signal.h>
 #include <linux/poll.h>
 #include <linux/init.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #include <linux/lp.h>
 #undef DEBUG
 #include <linux/usb.h>
@@ -256,8 +257,8 @@
 {
 	struct usblp *usblp = file->private_data;
 	poll_wait(file, &usblp->wait, wait);
-	return ((usblp->bidir || usblp->readurb.status  == -EINPROGRESS) ? 0 : POLLIN  | POLLRDNORM)
-	     		      | (usblp->writeurb.status == -EINPROGRESS  ? 0 : POLLOUT | POLLWRNORM);
+ 	return ((!usblp->bidir || usblp->readurb.status  == -EINPROGRESS) ? 0 : POLLIN  | POLLRDNORM)
+ 			       | (usblp->writeurb.status == -EINPROGRESS  ? 0 : POLLOUT | POLLWRNORM);
 }
 
 static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -404,6 +405,7 @@
 		err("usblp%d: error %d reading from printer",
 			usblp->minor, usblp->readurb.status);
 		usblp->readurb.dev = usblp->dev;
+ 		usblp->readcount = 0;
 		usb_submit_urb(&usblp->readurb);
 		return -EIO;
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)