aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/onetouch.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-02-12 14:48:33 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:20:35 -0400
commit9cfb95ef72c637bc9b90260e0f98a23f3f49b1bb (patch)
tree885a8e5fccf7f70ba09fb20c4ec365224da3f2d6 /drivers/usb/storage/onetouch.c
parentc10337846c93bd914dd3003ffb001adc583b313e (diff)
usb-storage: make onetouch a separate module
This patch (as1217) converts usb-storage's onetouch subdriver into a separate module. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/onetouch.c')
-rw-r--r--drivers/usb/storage/onetouch.c90
1 files changed, 88 insertions, 2 deletions
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index c7bf8954b4e4..8bd095635a99 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -35,9 +35,12 @@
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#define ONETOUCH_PKT_LEN 0x02
41#define ONETOUCH_BUTTON KEY_PROG1
42
43static int onetouch_connect_input(struct us_data *ss);
41static void onetouch_release_input(void *onetouch_); 44static void onetouch_release_input(void *onetouch_);
42 45
43struct usb_onetouch { 46struct usb_onetouch {
@@ -52,6 +55,46 @@ struct usb_onetouch {
52 unsigned int is_open:1; 55 unsigned int is_open:1;
53}; 56};
54 57
58
59/*
60 * The table of devices
61 */
62#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
63 vendorName, productName, useProtocol, useTransport, \
64 initFunction, flags) \
65{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
66 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
67
68struct usb_device_id onetouch_usb_ids[] = {
69# include "unusual_onetouch.h"
70 { } /* Terminating entry */
71};
72MODULE_DEVICE_TABLE(usb, onetouch_usb_ids);
73
74#undef UNUSUAL_DEV
75
76/*
77 * The flags table
78 */
79#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
80 vendor_name, product_name, use_protocol, use_transport, \
81 init_function, Flags) \
82{ \
83 .vendorName = vendor_name, \
84 .productName = product_name, \
85 .useProtocol = use_protocol, \
86 .useTransport = use_transport, \
87 .initFunction = init_function, \
88}
89
90static struct us_unusual_dev onetouch_unusual_dev_list[] = {
91# include "unusual_onetouch.h"
92 { } /* Terminating entry */
93};
94
95#undef UNUSUAL_DEV
96
97
55static void usb_onetouch_irq(struct urb *urb) 98static void usb_onetouch_irq(struct urb *urb)
56{ 99{
57 struct usb_onetouch *onetouch = urb->context; 100 struct usb_onetouch *onetouch = urb->context;
@@ -127,7 +170,7 @@ static void usb_onetouch_pm_hook(struct us_data *us, int action)
127} 170}
128#endif /* CONFIG_PM */ 171#endif /* CONFIG_PM */
129 172
130int onetouch_connect_input(struct us_data *ss) 173static int onetouch_connect_input(struct us_data *ss)
131{ 174{
132 struct usb_device *udev = ss->pusb_dev; 175 struct usb_device *udev = ss->pusb_dev;
133 struct usb_host_interface *interface; 176 struct usb_host_interface *interface;
@@ -236,3 +279,46 @@ static void onetouch_release_input(void *onetouch_)
236 onetouch->data, onetouch->data_dma); 279 onetouch->data, onetouch->data_dma);
237 } 280 }
238} 281}
282
283static int onetouch_probe(struct usb_interface *intf,
284 const struct usb_device_id *id)
285{
286 struct us_data *us;
287 int result;
288
289 result = usb_stor_probe1(&us, intf, id,
290 (id - onetouch_usb_ids) + onetouch_unusual_dev_list);
291 if (result)
292 return result;
293
294 /* Use default transport and protocol */
295
296 result = usb_stor_probe2(us);
297 return result;
298}
299
300static struct usb_driver onetouch_driver = {
301 .name = "ums-onetouch",
302 .probe = onetouch_probe,
303 .disconnect = usb_stor_disconnect,
304 .suspend = usb_stor_suspend,
305 .resume = usb_stor_resume,
306 .reset_resume = usb_stor_reset_resume,
307 .pre_reset = usb_stor_pre_reset,
308 .post_reset = usb_stor_post_reset,
309 .id_table = onetouch_usb_ids,
310 .soft_unbind = 1,
311};
312
313static int __init onetouch_init(void)
314{
315 return usb_register(&onetouch_driver);
316}
317
318static void __exit onetouch_exit(void)
319{
320 usb_deregister(&onetouch_driver);
321}
322
323module_init(onetouch_init);
324module_exit(onetouch_exit);