diff options
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/onetouch.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 07fd29ceb347..2c9402dc702b 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Copyright (c) 2005 Nick Sillik <n.sillik@temple.edu> | 5 | * Copyright (c) 2005 Nick Sillik <n.sillik@temple.edu> |
6 | * | 6 | * |
7 | * Initial work by: | 7 | * Initial work by: |
8 | * Copyright (c) 2003 Erik Thyrén <erth7411@student.uu.se> | 8 | * Copyright (c) 2003 Erik Thyren <erth7411@student.uu.se> |
9 | * | 9 | * |
10 | * Based on usbmouse.c (Vojtech Pavlik) and xpad.c (Marko Friedemann) | 10 | * Based on usbmouse.c (Vojtech Pavlik) and xpad.c (Marko Friedemann) |
11 | * | 11 | * |
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
38 | #include <linux/usb_ch9.h> | ||
39 | #include <linux/usb_input.h> | ||
38 | #include "usb.h" | 40 | #include "usb.h" |
39 | #include "onetouch.h" | 41 | #include "onetouch.h" |
40 | #include "debug.h" | 42 | #include "debug.h" |
@@ -116,10 +118,14 @@ int onetouch_connect_input(struct us_data *ss) | |||
116 | 118 | ||
117 | interface = ss->pusb_intf->cur_altsetting; | 119 | interface = ss->pusb_intf->cur_altsetting; |
118 | 120 | ||
121 | if (interface->desc.bNumEndpoints != 3) | ||
122 | return -ENODEV; | ||
123 | |||
119 | endpoint = &interface->endpoint[2].desc; | 124 | endpoint = &interface->endpoint[2].desc; |
120 | if(!(endpoint->bEndpointAddress & 0x80)) | 125 | if(!(endpoint->bEndpointAddress & USB_DIR_IN)) |
121 | return -ENODEV; | 126 | return -ENODEV; |
122 | if((endpoint->bmAttributes & 3) != 3) | 127 | if((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
128 | != USB_ENDPOINT_XFER_INT) | ||
123 | return -ENODEV; | 129 | return -ENODEV; |
124 | 130 | ||
125 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); | 131 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); |
@@ -128,7 +134,8 @@ int onetouch_connect_input(struct us_data *ss) | |||
128 | if (!(onetouch = kcalloc(1, sizeof(struct usb_onetouch), GFP_KERNEL))) | 134 | if (!(onetouch = kcalloc(1, sizeof(struct usb_onetouch), GFP_KERNEL))) |
129 | return -ENOMEM; | 135 | return -ENOMEM; |
130 | 136 | ||
131 | onetouch->data = usb_buffer_alloc(udev, ONETOUCH_PKT_LEN, SLAB_ATOMIC, &onetouch->data_dma); | 137 | onetouch->data = usb_buffer_alloc(udev, ONETOUCH_PKT_LEN, |
138 | SLAB_ATOMIC, &onetouch->data_dma); | ||
132 | if (!onetouch->data){ | 139 | if (!onetouch->data){ |
133 | kfree(onetouch); | 140 | kfree(onetouch); |
134 | return -ENOMEM; | 141 | return -ENOMEM; |
@@ -137,7 +144,8 @@ int onetouch_connect_input(struct us_data *ss) | |||
137 | onetouch->irq = usb_alloc_urb(0, GFP_KERNEL); | 144 | onetouch->irq = usb_alloc_urb(0, GFP_KERNEL); |
138 | if (!onetouch->irq){ | 145 | if (!onetouch->irq){ |
139 | kfree(onetouch); | 146 | kfree(onetouch); |
140 | usb_buffer_free(udev, ONETOUCH_PKT_LEN, onetouch->data, onetouch->data_dma); | 147 | usb_buffer_free(udev, ONETOUCH_PKT_LEN, |
148 | onetouch->data, onetouch->data_dma); | ||
141 | return -ENODEV; | 149 | return -ENODEV; |
142 | } | 150 | } |
143 | 151 | ||
@@ -152,16 +160,13 @@ int onetouch_connect_input(struct us_data *ss) | |||
152 | onetouch->dev.open = usb_onetouch_open; | 160 | onetouch->dev.open = usb_onetouch_open; |
153 | onetouch->dev.close = usb_onetouch_close; | 161 | onetouch->dev.close = usb_onetouch_close; |
154 | 162 | ||
155 | usb_make_path(udev, path, 64); | 163 | usb_make_path(udev, path, sizeof(path)); |
156 | sprintf(onetouch->phys, "%s/input0", path); | 164 | sprintf(onetouch->phys, "%s/input0", path); |
157 | 165 | ||
158 | onetouch->dev.name = onetouch->name; | 166 | onetouch->dev.name = onetouch->name; |
159 | onetouch->dev.phys = onetouch->phys; | 167 | onetouch->dev.phys = onetouch->phys; |
160 | 168 | ||
161 | onetouch->dev.id.bustype = BUS_USB; | 169 | usb_to_input_id(udev, &onetouch->dev.id); |
162 | onetouch->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
163 | onetouch->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
164 | onetouch->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
165 | 170 | ||
166 | onetouch->dev.dev = &udev->dev; | 171 | onetouch->dev.dev = &udev->dev; |
167 | 172 | ||
@@ -199,7 +204,7 @@ void onetouch_release_input(void *onetouch_) | |||
199 | usb_free_urb(onetouch->irq); | 204 | usb_free_urb(onetouch->irq); |
200 | usb_buffer_free(onetouch->udev, ONETOUCH_PKT_LEN, | 205 | usb_buffer_free(onetouch->udev, ONETOUCH_PKT_LEN, |
201 | onetouch->data, onetouch->data_dma); | 206 | onetouch->data, onetouch->data_dma); |
202 | printk(KERN_INFO "Maxtor Onetouch %04x:%04x Deregistered\n", | 207 | printk(KERN_INFO "usb-input: deregistering %s\n", |
203 | onetouch->dev.id.vendor, onetouch->dev.id.product); | 208 | onetouch->dev.name); |
204 | } | 209 | } |
205 | } | 210 | } |