diff options
author | Felipe Balbi <felipe.balbi@nokia.com> | 2008-08-18 20:39:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-17 17:40:53 -0400 |
commit | 3086775a4916b0fe128d924d83f4e7d7c39e4d0e (patch) | |
tree | c4e7825ba74da1272d15ad0d61a311b84392b8b6 /drivers/usb/gadget/serial.c | |
parent | 60beed95e38793c0baff7f94433c1f639d8d5efd (diff) |
usb gadget: cdc obex glue
The following patch introduces a new f_obex.c function driver.
It allows userspace obex servers to use usb as transport layer
for their messages.
[ dbrownell@users.sourceforge.net: various fixes and cleanups ]
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/serial.c')
-rw-r--r-- | drivers/usb/gadget/serial.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 3faa7a7022df..2dee848b2f59 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "epautoconf.c" | 43 | #include "epautoconf.c" |
44 | 44 | ||
45 | #include "f_acm.c" | 45 | #include "f_acm.c" |
46 | #include "f_obex.c" | ||
46 | #include "f_serial.c" | 47 | #include "f_serial.c" |
47 | #include "u_serial.c" | 48 | #include "u_serial.c" |
48 | 49 | ||
@@ -56,6 +57,7 @@ | |||
56 | #define GS_VENDOR_ID 0x0525 /* NetChip */ | 57 | #define GS_VENDOR_ID 0x0525 /* NetChip */ |
57 | #define GS_PRODUCT_ID 0xa4a6 /* Linux-USB Serial Gadget */ | 58 | #define GS_PRODUCT_ID 0xa4a6 /* Linux-USB Serial Gadget */ |
58 | #define GS_CDC_PRODUCT_ID 0xa4a7 /* ... as CDC-ACM */ | 59 | #define GS_CDC_PRODUCT_ID 0xa4a7 /* ... as CDC-ACM */ |
60 | #define GS_CDC_OBEX_PRODUCT_ID 0xa4a9 /* ... as CDC-OBEX */ | ||
59 | 61 | ||
60 | /* string IDs are assigned dynamically */ | 62 | /* string IDs are assigned dynamically */ |
61 | 63 | ||
@@ -125,6 +127,10 @@ static int use_acm = true; | |||
125 | module_param(use_acm, bool, 0); | 127 | module_param(use_acm, bool, 0); |
126 | MODULE_PARM_DESC(use_acm, "Use CDC ACM, default=yes"); | 128 | MODULE_PARM_DESC(use_acm, "Use CDC ACM, default=yes"); |
127 | 129 | ||
130 | static int use_obex = false; | ||
131 | module_param(use_obex, bool, 0); | ||
132 | MODULE_PARM_DESC(use_obex, "Use CDC OBEX, default=no"); | ||
133 | |||
128 | static unsigned n_ports = 1; | 134 | static unsigned n_ports = 1; |
129 | module_param(n_ports, uint, 0); | 135 | module_param(n_ports, uint, 0); |
130 | MODULE_PARM_DESC(n_ports, "number of ports to create, default=1"); | 136 | MODULE_PARM_DESC(n_ports, "number of ports to create, default=1"); |
@@ -139,6 +145,8 @@ static int __init serial_bind_config(struct usb_configuration *c) | |||
139 | for (i = 0; i < n_ports && status == 0; i++) { | 145 | for (i = 0; i < n_ports && status == 0; i++) { |
140 | if (use_acm) | 146 | if (use_acm) |
141 | status = acm_bind_config(c, i); | 147 | status = acm_bind_config(c, i); |
148 | else if (use_obex) | ||
149 | status = obex_bind_config(c, i); | ||
142 | else | 150 | else |
143 | status = gser_bind_config(c, i); | 151 | status = gser_bind_config(c, i); |
144 | } | 152 | } |
@@ -249,6 +257,12 @@ static int __init init(void) | |||
249 | device_desc.bDeviceClass = USB_CLASS_COMM; | 257 | device_desc.bDeviceClass = USB_CLASS_COMM; |
250 | device_desc.idProduct = | 258 | device_desc.idProduct = |
251 | __constant_cpu_to_le16(GS_CDC_PRODUCT_ID); | 259 | __constant_cpu_to_le16(GS_CDC_PRODUCT_ID); |
260 | } else if (use_obex) { | ||
261 | serial_config_driver.label = "CDC OBEX config"; | ||
262 | serial_config_driver.bConfigurationValue = 3; | ||
263 | device_desc.bDeviceClass = USB_CLASS_COMM; | ||
264 | device_desc.idProduct = | ||
265 | __constant_cpu_to_le16(GS_CDC_OBEX_PRODUCT_ID); | ||
252 | } else { | 266 | } else { |
253 | serial_config_driver.label = "Generic Serial config"; | 267 | serial_config_driver.label = "Generic Serial config"; |
254 | serial_config_driver.bConfigurationValue = 1; | 268 | serial_config_driver.bConfigurationValue = 1; |