SHOW:
|
|
- or go back to the newest paste.
1 | --- mceusb.c 2014-04-09 12:37:46.510492000 -0500 | |
2 | - | +++ mceusb_patched.c 2014-04-17 20:24:03.319805265 -0500 |
2 | + | +++ mceusb.c 2014-04-23 17:58:17.224854949 -0500 |
3 | - | @@ -761,11 +761,17 @@ |
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 ((ir->usb_ep_out->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
12 | + | + if (usb_endpoint_xfer_int(ir->usb_ep_out)) { |
13 | - | + == USB_ENDPOINT_XFER_INT) { |
13 | + | + pipe = usb_sndintpipe(ir->usbdev, |
14 | - | + pipe = usb_sndintpipe(ir->usbdev, ir->usb_ep_out->bEndpointAddress); |
14 | + | + ir->usb_ep_out->bEndpointAddress); |
15 | - | + usb_fill_int_urb(async_urb, ir->usbdev, pipe, async_buf, |
15 | + | + usb_fill_int_urb(async_urb, ir->usbdev, pipe, async_buf, |
16 | - | + size, mce_async_callback, ir, ir->usb_ep_out->bInterval); |
16 | + | + size, mce_async_callback, ir, |
17 | - | + |
17 | + | + ir->usb_ep_out->bInterval); |
18 | - | + } else { |
18 | + | + } else { |
19 | - | + pipe = usb_sndbulkpipe(ir->usbdev, ir->usb_ep_out->bEndpointAddress); |
19 | + | + pipe = usb_sndbulkpipe(ir->usbdev, |
20 | - | + usb_fill_bulk_urb(async_urb, ir->usbdev, pipe, async_buf, |
20 | + | + ir->usb_ep_out->bEndpointAddress); |
21 | - | + size, mce_async_callback, ir); |
21 | + | + usb_fill_bulk_urb(async_urb, ir->usbdev, pipe, async_buf, |
22 | - | + } |
22 | + | + size, mce_async_callback, ir); |
23 | + } | |
24 | memcpy(async_buf, data, size); | |
25 | ||
26 | - | @@ -1285,32 +1291,38 @@ |
26 | + | |
27 | @@ -1283,34 +1290,26 @@ static int mceusb_dev_probe(struct usb_i | |
28 | - | if ((ep_in == NULL) |
28 | + | for (i = 0; i < idesc->desc.bNumEndpoints; ++i) { |
29 | - | && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
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 | - | + == USB_DIR_IN)) { |
41 | + | |
42 | - | + if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
42 | + | |
43 | - | + == USB_ENDPOINT_XFER_BULK) { |
43 | + | |
44 | - | + ep_in = ep; |
44 | + | + if (ep_in == NULL) { |
45 | - | + mce_dbg(&intf->dev, "acceptable bulk inbound endpoint " |
45 | + | + if (usb_endpoint_is_bulk_in(ep)) { |
46 | - | + "found\n"); |
46 | + | + ep_in = ep; |
47 | - | + } |
47 | + | + mce_dbg(&intf->dev, "acceptable bulk inbound endpoint found\n"); |
48 | - | + if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
48 | + | + } else if (usb_endpoint_is_int_in(ep)) { |
49 | - | + == USB_ENDPOINT_XFER_INT) { |
49 | + | + ep_in = ep; |
50 | - | + ep_in = ep; |
50 | + | + ep_in->bInterval = 1; |
51 | - | + ep_in->bInterval = 1; |
51 | + | + mce_dbg(&intf->dev, "acceptable interrupt inbound endpoint found\n"); |
52 | - | + mce_dbg(&intf->dev, "acceptable interrupt inbound endpoint " |
52 | + | + } |
53 | - | + "found\n"); |
53 | + | |
54 | - | + } |
54 | + | |
55 | - if ((ep_out == NULL) | |
56 | - && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) | |
57 | - | if ((ep_out == NULL) |
57 | + | |
58 | - | && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
58 | + | |
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 | - | + == USB_DIR_OUT)) { |
70 | + | + ep_out = ep; |
71 | - | + if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
71 | + | + mce_dbg(&intf->dev, "acceptable bulk outbound endpoint found\n"); |
72 | - | + == USB_ENDPOINT_XFER_BULK) { |
72 | + | + } else if (usb_endpoint_is_int_out(ep)) { |
73 | - | + ep_out = ep; |
73 | + | + ep_out = ep; |
74 | - | + mce_dbg(&intf->dev, "acceptable bulk outbound endpoint " |
74 | + | + ep_out->bInterval = 1; |
75 | - | + "found\n"); |
75 | + | + mce_dbg(&intf->dev, "acceptable interrupt outbound endpoint found\n"); |
76 | - | + } |
76 | + | + } |
77 | - | + if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
77 | + | |
78 | - | + == USB_ENDPOINT_XFER_INT) { |
78 | + | |
79 | - | + ep_out = ep; |
79 | + | |
80 | - | + ep_out->bInterval = 1; |
80 | + | @@ -1318,7 +1317,11 @@ static int mceusb_dev_probe(struct usb_i |
81 | - | + mce_dbg(&intf->dev, "acceptable interrupt outbound endpoint " |
81 | + | |
82 | - | + "found\n"); |
82 | + | |
83 | - | + } |
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 | - | @@ -1318,7 +1330,13 @@ |
87 | + | + } else { |
88 | + pipe = usb_rcvbulkpipe(dev, ep_in->bEndpointAddress); | |
89 | + } | |
90 | maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); | |
91 | ||
92 | - | + if ((ep_in->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
92 | + | ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL); |