summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-07-21 12:41:47 -0400
committerMike Lockwood <lockwood@android.com>2009-07-21 14:18:45 -0400
commitd7b0b2043bd9bc5f15bf9a677d59d0d87dd045c2 (patch)
tree4cddc2be8aa09f8ddf0a1293369c22ce6a9fd520 /drivers/usb
parentf7f6469023c8c704157f9932a7639b70936d44b6 (diff)
usb gadget: android: Add helper function for usb_gadget_connect and disconnect.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/android.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index e76352418a54..2c175b04f62b 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -63,7 +63,6 @@ static const char longname[] = "Gadget Android";
#define ADB_PRODUCT_ID 0x0002
struct android_dev {
- struct usb_gadget *gadget;
struct usb_composite_dev *cdev;
int product_id;
@@ -113,6 +112,16 @@ static struct usb_device_descriptor device_desc = {
.bNumConfigurations = 1,
};
+void android_usb_set_connected(int connected)
+{
+ if (_android_dev && _android_dev->cdev && _android_dev->cdev->gadget) {
+ if (connected)
+ usb_gadget_connect(_android_dev->cdev->gadget);
+ else
+ usb_gadget_disconnect(_android_dev->cdev->gadget);
+ }
+}
+
static int __init android_bind_config(struct usb_configuration *c)
{
struct android_dev *dev = _android_dev;
@@ -250,7 +259,7 @@ static int adb_enable_release(struct inode *ip, struct file *fp)
return 0;
}
-static struct file_operations adb_enable_fops = {
+static const struct file_operations adb_enable_fops = {
.owner = THIS_MODULE,
.open = adb_enable_open,
.release = adb_enable_release,