diff options
Diffstat (limited to 'drivers/usb/storage/onetouch.c')
-rw-r--r-- | drivers/usb/storage/onetouch.c | 94 |
1 files changed, 92 insertions, 2 deletions
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index c7bf8954b4e4..380233bd6a39 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c | |||
@@ -35,9 +35,16 @@ | |||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/usb/input.h> | 36 | #include <linux/usb/input.h> |
37 | #include "usb.h" | 37 | #include "usb.h" |
38 | #include "onetouch.h" | ||
39 | #include "debug.h" | 38 | #include "debug.h" |
40 | 39 | ||
40 | MODULE_DESCRIPTION("Maxtor USB OneTouch hard drive button driver"); | ||
41 | MODULE_AUTHOR("Nick Sillik <n.sillik@temple.edu>"); | ||
42 | MODULE_LICENSE("GPL"); | ||
43 | |||
44 | #define ONETOUCH_PKT_LEN 0x02 | ||
45 | #define ONETOUCH_BUTTON KEY_PROG1 | ||
46 | |||
47 | static int onetouch_connect_input(struct us_data *ss); | ||
41 | static void onetouch_release_input(void *onetouch_); | 48 | static void onetouch_release_input(void *onetouch_); |
42 | 49 | ||
43 | struct usb_onetouch { | 50 | struct usb_onetouch { |
@@ -52,6 +59,46 @@ struct usb_onetouch { | |||
52 | unsigned int is_open:1; | 59 | unsigned int is_open:1; |
53 | }; | 60 | }; |
54 | 61 | ||
62 | |||
63 | /* | ||
64 | * The table of devices | ||
65 | */ | ||
66 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | ||
67 | vendorName, productName, useProtocol, useTransport, \ | ||
68 | initFunction, flags) \ | ||
69 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | ||
70 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | ||
71 | |||
72 | struct usb_device_id onetouch_usb_ids[] = { | ||
73 | # include "unusual_onetouch.h" | ||
74 | { } /* Terminating entry */ | ||
75 | }; | ||
76 | MODULE_DEVICE_TABLE(usb, onetouch_usb_ids); | ||
77 | |||
78 | #undef UNUSUAL_DEV | ||
79 | |||
80 | /* | ||
81 | * The flags table | ||
82 | */ | ||
83 | #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ | ||
84 | vendor_name, product_name, use_protocol, use_transport, \ | ||
85 | init_function, Flags) \ | ||
86 | { \ | ||
87 | .vendorName = vendor_name, \ | ||
88 | .productName = product_name, \ | ||
89 | .useProtocol = use_protocol, \ | ||
90 | .useTransport = use_transport, \ | ||
91 | .initFunction = init_function, \ | ||
92 | } | ||
93 | |||
94 | static struct us_unusual_dev onetouch_unusual_dev_list[] = { | ||
95 | # include "unusual_onetouch.h" | ||
96 | { } /* Terminating entry */ | ||
97 | }; | ||
98 | |||
99 | #undef UNUSUAL_DEV | ||
100 | |||
101 | |||
55 | static void usb_onetouch_irq(struct urb *urb) | 102 | static void usb_onetouch_irq(struct urb *urb) |
56 | { | 103 | { |
57 | struct usb_onetouch *onetouch = urb->context; | 104 | struct usb_onetouch *onetouch = urb->context; |
@@ -127,7 +174,7 @@ static void usb_onetouch_pm_hook(struct us_data *us, int action) | |||
127 | } | 174 | } |
128 | #endif /* CONFIG_PM */ | 175 | #endif /* CONFIG_PM */ |
129 | 176 | ||
130 | int onetouch_connect_input(struct us_data *ss) | 177 | static int onetouch_connect_input(struct us_data *ss) |
131 | { | 178 | { |
132 | struct usb_device *udev = ss->pusb_dev; | 179 | struct usb_device *udev = ss->pusb_dev; |
133 | struct usb_host_interface *interface; | 180 | struct usb_host_interface *interface; |
@@ -236,3 +283,46 @@ static void onetouch_release_input(void *onetouch_) | |||
236 | onetouch->data, onetouch->data_dma); | 283 | onetouch->data, onetouch->data_dma); |
237 | } | 284 | } |
238 | } | 285 | } |
286 | |||
287 | static int onetouch_probe(struct usb_interface *intf, | ||
288 | const struct usb_device_id *id) | ||
289 | { | ||
290 | struct us_data *us; | ||
291 | int result; | ||
292 | |||
293 | result = usb_stor_probe1(&us, intf, id, | ||
294 | (id - onetouch_usb_ids) + onetouch_unusual_dev_list); | ||
295 | if (result) | ||
296 | return result; | ||
297 | |||
298 | /* Use default transport and protocol */ | ||
299 | |||
300 | result = usb_stor_probe2(us); | ||
301 | return result; | ||
302 | } | ||
303 | |||
304 | static struct usb_driver onetouch_driver = { | ||
305 | .name = "ums-onetouch", | ||
306 | .probe = onetouch_probe, | ||
307 | .disconnect = usb_stor_disconnect, | ||
308 | .suspend = usb_stor_suspend, | ||
309 | .resume = usb_stor_resume, | ||
310 | .reset_resume = usb_stor_reset_resume, | ||
311 | .pre_reset = usb_stor_pre_reset, | ||
312 | .post_reset = usb_stor_post_reset, | ||
313 | .id_table = onetouch_usb_ids, | ||
314 | .soft_unbind = 1, | ||
315 | }; | ||
316 | |||
317 | static int __init onetouch_init(void) | ||
318 | { | ||
319 | return usb_register(&onetouch_driver); | ||
320 | } | ||
321 | |||
322 | static void __exit onetouch_exit(void) | ||
323 | { | ||
324 | usb_deregister(&onetouch_driver); | ||
325 | } | ||
326 | |||
327 | module_init(onetouch_init); | ||
328 | module_exit(onetouch_exit); | ||