Advertisement
Guest User

MCE USB patch 3.14.1

a guest
Apr 27th, 2014
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- mceusb.c    2014-04-09 12:37:46.510492000 -0500
  2. +++ mceusb.c    2014-04-23 17:58:17.224854949 -0500
  3. @@ -761,11 +761,18 @@ static void mce_request_packet(struct mc
  4.         }
  5.  
  6.         /* outbound data */
  7. -       pipe = usb_sndintpipe(ir->usbdev,
  8. -                     ir->usb_ep_out->bEndpointAddress);
  9. -       usb_fill_int_urb(async_urb, ir->usbdev, pipe,
  10. -           async_buf, size, mce_async_callback,
  11. -           ir, ir->usb_ep_out->bInterval);
  12. +       if (usb_endpoint_xfer_int(ir->usb_ep_out)) {
  13. +           pipe = usb_sndintpipe(ir->usbdev,
  14. +                    ir->usb_ep_out->bEndpointAddress);
  15. +           usb_fill_int_urb(async_urb, ir->usbdev, pipe, async_buf,
  16. +                    size, mce_async_callback, ir,
  17. +                    ir->usb_ep_out->bInterval);
  18. +       } else {
  19. +           pipe = usb_sndbulkpipe(ir->usbdev,
  20. +                    ir->usb_ep_out->bEndpointAddress);
  21. +           usb_fill_bulk_urb(async_urb, ir->usbdev, pipe, async_buf,
  22. +                    size, mce_async_callback, ir);
  23. +       }
  24.         memcpy(async_buf, data, size);
  25.  
  26.     } else if (urb_type == MCEUSB_RX) {
  27. @@ -1283,34 +1290,26 @@ static int mceusb_dev_probe(struct usb_i
  28.     for (i = 0; i < idesc->desc.bNumEndpoints; ++i) {
  29.         ep = &idesc->endpoint[i].desc;
  30.  
  31. -       if ((ep_in == NULL)
  32. -           && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
  33. -               == USB_DIR_IN)
  34. -           && (((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
  35. -               == USB_ENDPOINT_XFER_BULK)
  36. -           || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
  37. -               == USB_ENDPOINT_XFER_INT))) {
  38. -
  39. -           ep_in = ep;
  40. -           ep_in->bmAttributes = USB_ENDPOINT_XFER_INT;
  41. -           ep_in->bInterval = 1;
  42. -           mce_dbg(&intf->dev, "acceptable inbound endpoint "
  43. -               "found\n");
  44. +       if (ep_in == NULL) {
  45. +           if (usb_endpoint_is_bulk_in(ep)) {
  46. +               ep_in = ep;
  47. +               mce_dbg(&intf->dev, "acceptable bulk inbound endpoint found\n");
  48. +           } else if (usb_endpoint_is_int_in(ep)) {
  49. +               ep_in = ep;
  50. +               ep_in->bInterval = 1;
  51. +               mce_dbg(&intf->dev, "acceptable interrupt inbound endpoint found\n");
  52. +           }
  53.         }
  54.  
  55. -       if ((ep_out == NULL)
  56. -           && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
  57. -               == USB_DIR_OUT)
  58. -           && (((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
  59. -               == USB_ENDPOINT_XFER_BULK)
  60. -           || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
  61. -               == USB_ENDPOINT_XFER_INT))) {
  62. -
  63. -           ep_out = ep;
  64. -           ep_out->bmAttributes = USB_ENDPOINT_XFER_INT;
  65. -           ep_out->bInterval = 1;
  66. -           mce_dbg(&intf->dev, "acceptable outbound endpoint "
  67. -               "found\n");
  68. +       if (ep_out == NULL) {
  69. +           if (usb_endpoint_is_bulk_out(ep)) {
  70. +               ep_out = ep;
  71. +               mce_dbg(&intf->dev, "acceptable bulk outbound endpoint found\n");
  72. +           } else if (usb_endpoint_is_int_out(ep)) {
  73. +               ep_out = ep;
  74. +               ep_out->bInterval = 1;
  75. +               mce_dbg(&intf->dev, "acceptable interrupt outbound endpoint found\n");
  76. +           }
  77.         }
  78.     }
  79.     if (ep_in == NULL) {
  80. @@ -1318,7 +1317,11 @@ static int mceusb_dev_probe(struct usb_i
  81.         return -ENODEV;
  82.     }
  83.  
  84. -   pipe = usb_rcvintpipe(dev, ep_in->bEndpointAddress);
  85. +   if (usb_endpoint_xfer_int(ep_in)) {
  86. +       pipe = usb_rcvintpipe(dev, ep_in->bEndpointAddress);
  87. +   } else {
  88. +       pipe = usb_rcvbulkpipe(dev, ep_in->bEndpointAddress);
  89. +   }
  90.     maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
  91.  
  92.     ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement