usb: gadget: adb: Add ADB function
Android Debug Bridge (adb) is a command line tool that lets
users communicate with a Android-powered device. It is used
mainly to debug applications and tranfer files. f_adb implements
the transport layer between the ADB Server (on the host) and the
ADBD daemon (on the device).
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index fe68844..b9cb65d 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -45,6 +45,7 @@
#include "f_mass_storage.c"
#include "u_serial.c"
#include "f_acm.c"
+#include "f_adb.c"
#include "f_mtp.c"
#define USB_ETH_RNDIS y
#include "f_rndis.c"
@@ -185,6 +186,33 @@
/*-------------------------------------------------------------------------*/
/* Supported functions initialization */
+static int
+adb_function_init(struct android_usb_function *f,
+ struct usb_composite_dev *cdev)
+{
+ return adb_setup();
+}
+
+static void adb_function_cleanup(struct android_usb_function *f)
+{
+ adb_cleanup();
+}
+
+static int
+adb_function_bind_config(struct android_usb_function *f,
+ struct usb_configuration *c)
+{
+ return adb_bind_config(c);
+}
+
+static struct android_usb_function adb_function = {
+ .name = "adb",
+ .init = adb_function_init,
+ .cleanup = adb_function_cleanup,
+ .bind_config = adb_function_bind_config,
+};
+
+
#define MAX_ACM_INSTANCES 4
struct acm_function_config {
int instances;
@@ -606,6 +634,7 @@
static struct android_usb_function *supported_functions[] = {
+ &adb_function,
&acm_function,
&mtp_function,
&ptp_function,