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)"
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_tmp.o
+obj-$(CONFIG_USB_ANDROID_RNDIS) += f_rndis.o u_ether.o
{
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++;
#include <linux/slab.h>
#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"
/*
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;
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
return status;
}
+#ifdef CONFIG_USB_ANDROID_ACM
+
int acm_function_bind_config(struct usb_configuration *c)
{
int ret = acm_bind_config(c, 0);
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 */
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);
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 */
#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"
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) {
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/etherdevice.h>
+#include <linux/usb/android_composite.h>
#include <asm/atomic.h>
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;
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;
}
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 */
int ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);
int eem_bind_config(struct usb_configuration *c);
-#ifdef USB_ETH_RNDIS
+#if defined(USB_ETH_RNDIS) || defined(CONFIG_USB_ANDROID_RNDIS)
int rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);