Unified · Split
| @@ -769,6 +769,15 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, · 768 unmodified lines | ||
| 769 | 769 | return ret; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | +static struct usb_host_endpoint *ep_to_host_endpoint(struct usb_device *dev, | |
| 773 | + unsigned char ep) | |
| 774 | +{ | |
| 775 | + if (ep & USB_ENDPOINT_DIR_MASK) | |
| 776 | + return dev->ep_in[ep & USB_ENDPOINT_NUMBER_MASK]; | |
| 777 | + else | |
| 778 | + return dev->ep_out[ep & USB_ENDPOINT_NUMBER_MASK]; | |
| 779 | +} | |
| 780 | + | |
| 772 | 781 | static int match_devt(struct device *dev, void *data) |
| 773 | 782 | { |
| 774 | 783 | return dev->devt == (dev_t) (unsigned long) data; |
| @@ -1230,15 +1239,10 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, · 455 unmodified lines | ||
| 1230 | 1239 | if (ret) |
| 1231 | 1240 | return ret; |
| 1232 | 1241 | } |
| 1233 | − if ((uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0) { | |
| 1234 | − is_in = 1; | |
| 1235 | − ep = ps->dev->ep_in[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK]; | |
| 1236 | − } else { | |
| 1237 | − is_in = 0; | |
| 1238 | − ep = ps->dev->ep_out[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK]; | |
| 1239 | − } | |
| 1242 | + ep = ep_to_host_endpoint(ps->dev, uurb->endpoint); | |
| 1240 | 1243 | if (!ep) |
| 1241 | 1244 | return -ENOENT; |
| 1245 | + is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0; | |
| 1242 | 1246 | |
| 1243 | 1247 | u = 0; |
| 1244 | 1248 | switch(uurb->type) { |