patch-2.3.16 linux/drivers/usb/printer.c
Next file: linux/drivers/usb/proc_usb.c
Previous file: linux/drivers/usb/acm.c
Back to the patch index
Back to the overall index
- Lines: 57
- Date:
Fri Aug 27 12:35:57 1999
- Orig file:
v2.3.15/linux/drivers/usb/printer.c
- Orig date:
Thu Aug 26 13:05:39 1999
diff -u --recursive --new-file v2.3.15/linux/drivers/usb/printer.c linux/drivers/usb/printer.c
@@ -163,6 +163,11 @@
unsigned long partial;
int result = USB_ST_NOERROR;
int maxretry;
+ int endpoint_num;
+ struct usb_interface_descriptor *interface;
+
+ interface = p->pusb_dev->config->interface->altsetting;
+ endpoint_num = (interface->endpoint[1].bEndpointAddress & 0x0f);
do {
char *obuf = p->obuf;
@@ -179,7 +184,8 @@
return bytes_written ? bytes_written : -EINTR;
}
result = p->pusb_dev->bus->op->bulk_msg(p->pusb_dev,
- usb_sndbulkpipe(p->pusb_dev, 1), obuf, thistime, &partial);
+ usb_sndbulkpipe(p->pusb_dev, endpoint_num),
+ obuf, thistime, &partial);
if (partial) {
obuf += partial;
thistime -= partial;
@@ -218,6 +224,11 @@
char buf[64];
unsigned long partial;
int result;
+ int endpoint_num;
+ struct usb_interface_descriptor *interface;
+
+ interface = p->pusb_dev->config->interface->altsetting;
+ endpoint_num = (interface->endpoint[0].bEndpointAddress & 0x0f);
if (p->noinput)
return -EINVAL;
@@ -232,7 +243,8 @@
this_read = (count > sizeof(buf)) ? sizeof(buf) : count;
result = p->pusb_dev->bus->op->bulk_msg(p->pusb_dev,
- usb_rcvbulkpipe(p->pusb_dev, 2), buf, this_read, &partial);
+ usb_rcvbulkpipe(p->pusb_dev, endpoint_num),
+ buf, this_read, &partial);
/* unlike writes, we don't retry a NAK, just stop now */
if (!result & partial)
@@ -276,10 +288,10 @@
return -1;
}
- if (interface->endpoint[0].bEndpointAddress != 0x01 ||
+ if ((interface->endpoint[0].bEndpointAddress & 0xf0) != 0x00 ||
interface->endpoint[0].bmAttributes != 0x02 ||
(interface->bNumEndpoints > 1 && (
- interface->endpoint[1].bEndpointAddress != 0x82 ||
+ (interface->endpoint[1].bEndpointAddress & 0xf0) != 0x80 ||
interface->endpoint[1].bmAttributes != 0x02))) {
return -1;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)