mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 22:52:35 +02:00
USB: gadget: android: android USB gadget improvements:
usb: gadget: f_mass_storage: use dev_set_name() Replacing strcpy() to device->bus_id which no longer exists in 2.6.32 Change-Id: Id978c881f457044c750bfd62f4c5bcc35bcd4fc5 Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_adb: Claim endpoints so they are not reused by another function. Change-Id: Ic9536cca800162e701c81cab36054f51ea759b72 Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_acm: Fix crashes in acm_set_alt() Change-Id: I91b761d392f8b1ca8784c69069b43e402b90d6a4 Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_acm: Include android code only if CONFIG_USB_ANDROID_ACM is set. Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: Android support for RNDIS serial ethernet function. Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: android: Add function name to android_register_function printk. Change-Id: I38bf79d9b544cdeaec9385f7482a131417fc4b23 Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
parent
9bebaa516d
commit
0ab69f47e1
|
|
@ -789,22 +789,28 @@ config USB_ANDROID
|
|||
enabled and disabled dynamically.
|
||||
|
||||
config USB_ANDROID_ACM
|
||||
boolean "Android gadget ACM function"
|
||||
boolean "Android gadget ACM serial function"
|
||||
depends on USB_ANDROID
|
||||
help
|
||||
Provides adb function for adb gadget driver.
|
||||
Provides ACM serial function for android gadget driver.
|
||||
|
||||
config USB_ANDROID_ADB
|
||||
boolean "Android gadget adb function"
|
||||
depends on USB_ANDROID
|
||||
help
|
||||
Provides adb function for adb gadget driver.
|
||||
Provides adb function for android gadget driver.
|
||||
|
||||
config USB_ANDROID_MASS_STORAGE
|
||||
boolean "Android gadget mass storage function"
|
||||
depends on USB_ANDROID && SWITCH
|
||||
help
|
||||
Provides USB mass storage function for adb gadget driver.
|
||||
Provides USB mass storage function for android gadget driver.
|
||||
|
||||
config USB_ANDROID_RNDIS
|
||||
boolean "Android gadget RNDIS ethernet function"
|
||||
depends on USB_ANDROID
|
||||
help
|
||||
Provides RNDIS ethernet function for android gadget driver.
|
||||
|
||||
config USB_CDC_COMPOSITE
|
||||
tristate "CDC Composite Device (Ethernet and ACM)"
|
||||
|
|
|
|||
|
|
@ -55,4 +55,5 @@ obj-$(CONFIG_USB_ANDROID) += android.o
|
|||
obj-$(CONFIG_USB_ANDROID_ACM) += f_acm.o u_serial.o
|
||||
obj-$(CONFIG_USB_ANDROID_ADB) += f_adb.o
|
||||
obj-$(CONFIG_USB_ANDROID_MASS_STORAGE) += f_mass_storage.o
|
||||
obj-$(CONFIG_USB_ANDROID_RNDIS) += f_rndis.o u_ether.o
|
||||
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ void android_register_function(struct android_usb_function *f)
|
|||
{
|
||||
struct android_dev *dev = _android_dev;
|
||||
|
||||
printk(KERN_INFO "android_register_function\n");
|
||||
printk(KERN_INFO "android_register_function %s\n", f->name);
|
||||
list_add_tail(&f->list, &_functions);
|
||||
_registered_function_count++;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/usb/android_composite.h>
|
||||
|
||||
#include "u_serial.h"
|
||||
#include "gadget_chips.h"
|
||||
#include "linux/usb/android_composite.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -385,10 +385,10 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
|
|||
usb_ep_disable(acm->notify);
|
||||
} else {
|
||||
VDBG(cdev, "init acm ctrl interface %d\n", intf);
|
||||
acm->notify_desc = ep_choose(cdev->gadget,
|
||||
acm->hs.notify,
|
||||
acm->fs.notify);
|
||||
}
|
||||
acm->notify_desc = ep_choose(cdev->gadget,
|
||||
acm->hs.notify,
|
||||
acm->fs.notify);
|
||||
usb_ep_enable(acm->notify, acm->notify_desc);
|
||||
acm->notify->driver_data = acm;
|
||||
|
||||
|
|
@ -398,11 +398,11 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
|
|||
gserial_disconnect(&acm->port);
|
||||
} else {
|
||||
DBG(cdev, "activate acm ttyGS%d\n", acm->port_num);
|
||||
acm->port.in_desc = ep_choose(cdev->gadget,
|
||||
acm->hs.in, acm->fs.in);
|
||||
acm->port.out_desc = ep_choose(cdev->gadget,
|
||||
acm->hs.out, acm->fs.out);
|
||||
}
|
||||
acm->port.in_desc = ep_choose(cdev->gadget,
|
||||
acm->hs.in, acm->fs.in);
|
||||
acm->port.out_desc = ep_choose(cdev->gadget,
|
||||
acm->hs.out, acm->fs.out);
|
||||
gserial_connect(&acm->port, acm->port_num);
|
||||
|
||||
} else
|
||||
|
|
@ -763,6 +763,8 @@ int __init acm_bind_config(struct usb_configuration *c, u8 port_num)
|
|||
return status;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_ANDROID_ACM
|
||||
|
||||
int acm_function_bind_config(struct usb_configuration *c)
|
||||
{
|
||||
int ret = acm_bind_config(c, 0);
|
||||
|
|
@ -778,7 +780,10 @@ static struct android_usb_function acm_function = {
|
|||
|
||||
static int __init init(void)
|
||||
{
|
||||
printk(KERN_INFO "f_acm init\n");
|
||||
android_register_function(&acm_function);
|
||||
return 0;
|
||||
}
|
||||
module_init(init);
|
||||
|
||||
#endif /* CONFIG_USB_ANDROID_ACM */
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ static int __init create_bulk_endpoints(struct adb_dev *dev,
|
|||
return -ENODEV;
|
||||
}
|
||||
DBG(cdev, "usb_ep_autoconfig for ep_in got %s\n", ep->name);
|
||||
ep->driver_data = dev; /* claim the endpoint */
|
||||
dev->ep_in = ep;
|
||||
|
||||
ep = usb_ep_autoconfig(cdev->gadget, out_desc);
|
||||
|
|
@ -243,6 +244,7 @@ static int __init create_bulk_endpoints(struct adb_dev *dev,
|
|||
return -ENODEV;
|
||||
}
|
||||
DBG(cdev, "usb_ep_autoconfig for adb ep_out got %s\n", ep->name);
|
||||
ep->driver_data = dev; /* claim the endpoint */
|
||||
dev->ep_out = ep;
|
||||
|
||||
/* now allocate requests for our endpoints */
|
||||
|
|
|
|||
|
|
@ -69,10 +69,9 @@
|
|||
#include <linux/wakelock.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <linux/usb.h>
|
||||
#include <linux/usb_usual.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/composite.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
#include <linux/usb/android_composite.h>
|
||||
|
||||
#include "gadget_chips.h"
|
||||
|
|
@ -2756,8 +2755,7 @@ fsg_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
else
|
||||
curlun->dev.parent = &cdev->gadget->dev;
|
||||
dev_set_drvdata(&curlun->dev, fsg);
|
||||
snprintf(curlun->dev.bus_id, BUS_ID_SIZE,
|
||||
"lun%d", i);
|
||||
dev_set_name(&curlun->dev,"lun%d", i);
|
||||
|
||||
rc = device_register(&curlun->dev);
|
||||
if (rc != 0) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/usb/android_composite.h>
|
||||
|
||||
#include <asm/atomic.h>
|
||||
|
||||
|
|
@ -467,10 +468,10 @@ static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
|
|||
usb_ep_disable(rndis->notify);
|
||||
} else {
|
||||
VDBG(cdev, "init rndis ctrl %d\n", intf);
|
||||
rndis->notify_desc = ep_choose(cdev->gadget,
|
||||
rndis->hs.notify,
|
||||
rndis->fs.notify);
|
||||
}
|
||||
rndis->notify_desc = ep_choose(cdev->gadget,
|
||||
rndis->hs.notify,
|
||||
rndis->fs.notify);
|
||||
usb_ep_enable(rndis->notify, rndis->notify_desc);
|
||||
rndis->notify->driver_data = rndis;
|
||||
|
||||
|
|
@ -484,11 +485,11 @@ static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
|
|||
|
||||
if (!rndis->port.in) {
|
||||
DBG(cdev, "init rndis\n");
|
||||
rndis->port.in = ep_choose(cdev->gadget,
|
||||
rndis->hs.in, rndis->fs.in);
|
||||
rndis->port.out = ep_choose(cdev->gadget,
|
||||
rndis->hs.out, rndis->fs.out);
|
||||
}
|
||||
rndis->port.in = ep_choose(cdev->gadget,
|
||||
rndis->hs.in, rndis->fs.in);
|
||||
rndis->port.out = ep_choose(cdev->gadget,
|
||||
rndis->hs.out, rndis->fs.out);
|
||||
|
||||
/* Avoid ZLPs; they can be troublesome. */
|
||||
rndis->port.is_zlp_ok = false;
|
||||
|
|
@ -833,3 +834,33 @@ int __init rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN])
|
|||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_ANDROID_RNDIS
|
||||
#include "rndis.c"
|
||||
|
||||
// FIXME - using bogus MAC address for now
|
||||
|
||||
static u8 ethaddr[ETH_ALEN] = { 11, 22, 33, 44, 55, 66 };
|
||||
|
||||
int rndis_function_bind_config(struct usb_configuration *c)
|
||||
{
|
||||
int ret = gether_setup(c->cdev->gadget, ethaddr);
|
||||
if (ret == 0)
|
||||
ret = rndis_bind_config(c, ethaddr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct android_usb_function rndis_function = {
|
||||
.name = "rndis",
|
||||
.bind_config = rndis_function_bind_config,
|
||||
};
|
||||
|
||||
static int __init init(void)
|
||||
{
|
||||
printk(KERN_INFO "f_rndis init\n");
|
||||
android_register_function(&rndis_function);
|
||||
return 0;
|
||||
}
|
||||
module_init(init);
|
||||
|
||||
#endif /* CONFIG_USB_ANDROID_RNDIS */
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ int geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);
|
|||
int ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);
|
||||
int eem_bind_config(struct usb_configuration *c);
|
||||
|
||||
#ifdef CONFIG_USB_ETH_RNDIS
|
||||
#if defined(CONFIG_USB_ETH_RNDIS) || defined(CONFIG_USB_ANDROID_RNDIS)
|
||||
|
||||
int rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user