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

Next file: linux/drivers/usb/stopusb
Previous file: linux/drivers/usb/ohci.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.5/linux/drivers/usb/printer.c linux/drivers/usb/printer.c
@@ -179,13 +179,14 @@
 			}
 			result = p->pusb_dev->bus->op->bulk_msg(p->pusb_dev,
 					 usb_sndbulkpipe(p->pusb_dev, 1), obuf, thistime, &partial);
-			if (result & 0x08) {	/* NAK - so hold for a while */
-				obuf += partial;
-				thistime -= partial;
+			if (result == USB_ST_TIMEOUT) {	/* NAK - so hold for a while */
 				if(!maxretry--)
 					return -ETIME;
                                 interruptible_sleep_on_timeout(&p->wait_q, NAK_TIMEOUT);
 				continue;
+			} else if (!result & partial) {
+				obuf += partial;
+				thistime -= partial;
 			} else
 				break;
 		};
@@ -230,7 +231,7 @@
 			  usb_rcvbulkpipe(p->pusb_dev, 2), buf, this_read, &partial);
 
 		/* unlike writes, we don't retry a NAK, just stop now */
-		if (result & 0x08)
+		if (!result & partial)
 			count = this_read = partial;
 		else if (result)
 			return -EIO;
@@ -260,7 +261,7 @@
 		return -1;
 	}
 
-	interface = dev->config->interface;
+	interface = dev->config->altsetting->interface;
 
 	/* Lets be paranoid (for the moment)*/
 	if (interface->bInterfaceClass != 7 ||

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