aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/serial.c')
-rw-r--r--drivers/usb/gadget/serial.c14
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;
125module_param(use_acm, bool, 0); 127module_param(use_acm, bool, 0);
126MODULE_PARM_DESC(use_acm, "Use CDC ACM, default=yes"); 128MODULE_PARM_DESC(use_acm, "Use CDC ACM, default=yes");
127 129
130static int use_obex = false;
131module_param(use_obex, bool, 0);
132MODULE_PARM_DESC(use_obex, "Use CDC OBEX, default=no");
133
128static unsigned n_ports = 1; 134static unsigned n_ports = 1;
129module_param(n_ports, uint, 0); 135module_param(n_ports, uint, 0);
130MODULE_PARM_DESC(n_ports, "number of ports to create, default=1"); 136MODULE_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;