aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
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
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')
-rw-r--r--drivers/usb/storage/Kconfig4
-rw-r--r--drivers/usb/storage/Makefile3
-rw-r--r--drivers/usb/storage/onetouch.c90
-rw-r--r--drivers/usb/storage/onetouch.h9
-rw-r--r--drivers/usb/storage/unusual_devs.h17
-rw-r--r--drivers/usb/storage/unusual_onetouch.h36
-rw-r--r--drivers/usb/storage/usb.c3
-rw-r--r--drivers/usb/storage/usual-tables.c1
8 files changed, 130 insertions, 33 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index 8adece1dd294..8a372bac0e43 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -131,7 +131,7 @@ config USB_STORAGE_ALAUDA
131 If this driver is compiled as a module, it will be named ums-alauda. 131 If this driver is compiled as a module, it will be named ums-alauda.
132 132
133config USB_STORAGE_ONETOUCH 133config USB_STORAGE_ONETOUCH
134 bool "Support OneTouch Button on Maxtor Hard Drives" 134 tristate "Support OneTouch Button on Maxtor Hard Drives"
135 depends on USB_STORAGE 135 depends on USB_STORAGE
136 depends on INPUT=y || INPUT=USB_STORAGE 136 depends on INPUT=y || INPUT=USB_STORAGE
137 help 137 help
@@ -143,6 +143,8 @@ config USB_STORAGE_ONETOUCH
143 this input in any keybinding software. (e.g. gnome's keyboard short- 143 this input in any keybinding software. (e.g. gnome's keyboard short-
144 cuts) 144 cuts)
145 145
146 If this driver is compiled as a module, it will be named ums-onetouch.
147
146config USB_STORAGE_KARMA 148config USB_STORAGE_KARMA
147 tristate "Support for Rio Karma music player" 149 tristate "Support for Rio Karma music player"
148 depends on USB_STORAGE 150 depends on USB_STORAGE
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index 870680ea3709..5be54c019662 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -10,7 +10,6 @@ EXTRA_CFLAGS := -Idrivers/scsi
10obj-$(CONFIG_USB_STORAGE) += usb-storage.o 10obj-$(CONFIG_USB_STORAGE) += usb-storage.o
11 11
12usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o 12usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
13usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
14 13
15usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ 14usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \
16 initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y) 15 initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y)
@@ -28,6 +27,7 @@ obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o
28obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o 27obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o
29obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += ums-jumpshot.o 28obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += ums-jumpshot.o
30obj-$(CONFIG_USB_STORAGE_KARMA) += ums-karma.o 29obj-$(CONFIG_USB_STORAGE_KARMA) += ums-karma.o
30obj-$(CONFIG_USB_STORAGE_ONETOUCH) += ums-onetouch.o
31obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o 31obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
32obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o 32obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
33obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o 33obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o
@@ -39,6 +39,7 @@ ums-freecom-objs := freecom.o
39ums-isd200-objs := isd200.o 39ums-isd200-objs := isd200.o
40ums-jumpshot-objs := jumpshot.o 40ums-jumpshot-objs := jumpshot.o
41ums-karma-objs := karma.o 41ums-karma-objs := karma.o
42ums-onetouch-objs := onetouch.o
42ums-sddr09-objs := sddr09.o 43ums-sddr09-objs := sddr09.o
43ums-sddr55-objs := sddr55.o 44ums-sddr55-objs := sddr55.o
44ums-usbat-objs := shuttle_usbat.o 45ums-usbat-objs := shuttle_usbat.o
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);
diff --git a/drivers/usb/storage/onetouch.h b/drivers/usb/storage/onetouch.h
deleted file mode 100644
index 41c7aa8f0446..000000000000
--- a/drivers/usb/storage/onetouch.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _ONETOUCH_H_
2#define _ONETOUCH_H_
3
4#define ONETOUCH_PKT_LEN 0x02
5#define ONETOUCH_BUTTON KEY_PROG1
6
7int onetouch_connect_input(struct us_data *ss);
8
9#endif
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 83e34a6ad59d..1c1f643e8a78 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1182,23 +1182,6 @@ UNUSUAL_DEV( 0x0c45, 0x1060, 0x0100, 0x0100,
1182 US_SC_DEVICE, US_PR_DEVICE, NULL, 1182 US_SC_DEVICE, US_PR_DEVICE, NULL,
1183 US_FL_SINGLE_LUN ), 1183 US_FL_SINGLE_LUN ),
1184 1184
1185/* Submitted by: Nick Sillik <n.sillik@temple.edu>
1186 * Needed for OneTouch extension to usb-storage
1187 *
1188 */
1189#ifdef CONFIG_USB_STORAGE_ONETOUCH
1190 UNUSUAL_DEV( 0x0d49, 0x7000, 0x0000, 0x9999,
1191 "Maxtor",
1192 "OneTouch External Harddrive",
1193 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
1194 0),
1195 UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999,
1196 "Maxtor",
1197 "OneTouch External Harddrive",
1198 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
1199 0),
1200#endif
1201
1202/* Submitted by Joris Struyve <joris@struyve.be> */ 1185/* Submitted by Joris Struyve <joris@struyve.be> */
1203UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff, 1186UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff,
1204 "Medion", 1187 "Medion",
diff --git a/drivers/usb/storage/unusual_onetouch.h b/drivers/usb/storage/unusual_onetouch.h
new file mode 100644
index 000000000000..bd9306b637df
--- /dev/null
+++ b/drivers/usb/storage/unusual_onetouch.h
@@ -0,0 +1,36 @@
1/* Unusual Devices File for the Maxtor OneTouch USB hard drive's button
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2, or (at your option) any
6 * later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#if defined(CONFIG_USB_STORAGE_ONETOUCH) || \
19 defined(CONFIG_USB_STORAGE_ONETOUCH_MODULE)
20
21/* Submitted by: Nick Sillik <n.sillik@temple.edu>
22 * Needed for OneTouch extension to usb-storage
23 */
24UNUSUAL_DEV( 0x0d49, 0x7000, 0x0000, 0x9999,
25 "Maxtor",
26 "OneTouch External Harddrive",
27 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
28 0),
29
30UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999,
31 "Maxtor",
32 "OneTouch External Harddrive",
33 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
34 0),
35
36#endif /* defined(CONFIG_USB_STORAGE_ONETOUCH) || ... */
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index c5abf9bbce16..8060b85fe1a3 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -66,9 +66,6 @@
66#include "debug.h" 66#include "debug.h"
67#include "initializers.h" 67#include "initializers.h"
68 68
69#ifdef CONFIG_USB_STORAGE_ONETOUCH
70#include "onetouch.h"
71#endif
72#include "sierra_ms.h" 69#include "sierra_ms.h"
73#include "option_ms.h" 70#include "option_ms.h"
74 71
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c
index bce086fcef5e..468bde7d1971 100644
--- a/drivers/usb/storage/usual-tables.c
+++ b/drivers/usb/storage/usual-tables.c
@@ -84,6 +84,7 @@ static struct ignore_entry ignore_ids[] = {
84# include "unusual_isd200.h" 84# include "unusual_isd200.h"
85# include "unusual_jumpshot.h" 85# include "unusual_jumpshot.h"
86# include "unusual_karma.h" 86# include "unusual_karma.h"
87# include "unusual_onetouch.h"
87# include "unusual_sddr09.h" 88# include "unusual_sddr09.h"
88# include "unusual_sddr55.h" 89# include "unusual_sddr55.h"
89# include "unusual_usbat.h" 90# include "unusual_usbat.h"