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.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 3faa7a7022df..37879af1c433 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 }
@@ -151,7 +159,6 @@ static struct usb_configuration serial_config_driver = {
151 /* .bConfigurationValue = f(use_acm) */ 159 /* .bConfigurationValue = f(use_acm) */
152 /* .iConfiguration = DYNAMIC */ 160 /* .iConfiguration = DYNAMIC */
153 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 161 .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
154 .bMaxPower = 1, /* 2 mA, minimal */
155}; 162};
156 163
157static int __init gs_bind(struct usb_composite_dev *cdev) 164static int __init gs_bind(struct usb_composite_dev *cdev)
@@ -249,6 +256,12 @@ static int __init init(void)
249 device_desc.bDeviceClass = USB_CLASS_COMM; 256 device_desc.bDeviceClass = USB_CLASS_COMM;
250 device_desc.idProduct = 257 device_desc.idProduct =
251 __constant_cpu_to_le16(GS_CDC_PRODUCT_ID); 258 __constant_cpu_to_le16(GS_CDC_PRODUCT_ID);
259 } else if (use_obex) {
260 serial_config_driver.label = "CDC OBEX config";
261 serial_config_driver.bConfigurationValue = 3;
262 device_desc.bDeviceClass = USB_CLASS_COMM;
263 device_desc.idProduct =
264 __constant_cpu_to_le16(GS_CDC_OBEX_PRODUCT_ID);
252 } else { 265 } else {
253 serial_config_driver.label = "Generic Serial config"; 266 serial_config_driver.label = "Generic Serial config";
254 serial_config_driver.bConfigurationValue = 1; 267 serial_config_driver.bConfigurationValue = 1;