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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
60beed95e3
commit
3086775a49
@@ -43,6 +43,7 @@
|
||||
#include "epautoconf.c"
|
||||
|
||||
#include "f_acm.c"
|
||||
#include "f_obex.c"
|
||||
#include "f_serial.c"
|
||||
#include "u_serial.c"
|
||||
|
||||
@@ -56,6 +57,7 @@
|
||||
#define GS_VENDOR_ID 0x0525 /* NetChip */
|
||||
#define GS_PRODUCT_ID 0xa4a6 /* Linux-USB Serial Gadget */
|
||||
#define GS_CDC_PRODUCT_ID 0xa4a7 /* ... as CDC-ACM */
|
||||
#define GS_CDC_OBEX_PRODUCT_ID 0xa4a9 /* ... as CDC-OBEX */
|
||||
|
||||
/* string IDs are assigned dynamically */
|
||||
|
||||
@@ -125,6 +127,10 @@ static int use_acm = true;
|
||||
module_param(use_acm, bool, 0);
|
||||
MODULE_PARM_DESC(use_acm, "Use CDC ACM, default=yes");
|
||||
|
||||
static int use_obex = false;
|
||||
module_param(use_obex, bool, 0);
|
||||
MODULE_PARM_DESC(use_obex, "Use CDC OBEX, default=no");
|
||||
|
||||
static unsigned n_ports = 1;
|
||||
module_param(n_ports, uint, 0);
|
||||
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)
|
||||
for (i = 0; i < n_ports && status == 0; i++) {
|
||||
if (use_acm)
|
||||
status = acm_bind_config(c, i);
|
||||
else if (use_obex)
|
||||
status = obex_bind_config(c, i);
|
||||
else
|
||||
status = gser_bind_config(c, i);
|
||||
}
|
||||
@@ -249,6 +257,12 @@ static int __init init(void)
|
||||
device_desc.bDeviceClass = USB_CLASS_COMM;
|
||||
device_desc.idProduct =
|
||||
__constant_cpu_to_le16(GS_CDC_PRODUCT_ID);
|
||||
} else if (use_obex) {
|
||||
serial_config_driver.label = "CDC OBEX config";
|
||||
serial_config_driver.bConfigurationValue = 3;
|
||||
device_desc.bDeviceClass = USB_CLASS_COMM;
|
||||
device_desc.idProduct =
|
||||
__constant_cpu_to_le16(GS_CDC_OBEX_PRODUCT_ID);
|
||||
} else {
|
||||
serial_config_driver.label = "Generic Serial config";
|
||||
serial_config_driver.bConfigurationValue = 1;
|
||||
|
Reference in New Issue
Block a user