[Touch CDMA Android Development] endersm:
Thanks for all your help - I'm now able to build, package, and burn to my phone.

I've been fiddling around with drivers/usb/function/ether.c trying to get tethering to work. The snag I'm hitting is that while usb0 appears to android, the usb interface descriptor doesn't ever seem to show up on the host computer. It's like i'm not registering the device correctly or something. Patch attached, you can see what little I've done.

diff --git a/drivers/usb/function/ether.c b/drivers/usb/function/ether.c
index ec980fa..76c5578 100644
--- a/drivers/usb/function/ether.c
+++ b/drivers/usb/function/ether.c
@@ -25,6 +25,7 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
+#include <linux/platform_device.h>

#include "usb_function.h"

@@ -33,6 +34,8 @@
*/
#define USB_MTU 1536

+#define DRIVER_NAME "ether"
+
#define MAX_TX 64
#define MAX_RX 64

@@ -211,13 +214,13 @@ static struct usb_function usb_func_ether = {
.bind = ether_bind,
.configure = ether_configure,

-	.name = "ether",
+	.name = DRIVER_NAME,

.ifc_class = 0x02,
.ifc_subclass = 0x00,
.ifc_protocol = 0x00,

-	.ifc_name = "ether",
+	.ifc_name = DRIVER_NAME,

.ifc_ept_count = 2,
.ifc_ept_type = { EPT_BULK_OUT, EPT_BULK_IN },
@@ -280,6 +283,8 @@ static int usb_ether_xmit(struct sk_buff *skb, struct net_device *dev)

static int usb_ether_open(struct net_device *dev)
{
+ dev->watchdog_timeo = msecs_to_jiffies(5000);
+
return 0;
}

@@ -294,6 +299,13 @@ static struct net_device_stats *usb_ether_get_stats(struct net_device *dev)
return &ctxt->stats;
}

+static const struct net_device_ops usb_ether_ops = {
+ .ndo_open = usb_ether_open,
+ .ndo_stop = usb_ether_stop,
+ .ndo_start_xmit = usb_ether_xmit,
+ .ndo_get_stats = usb_ether_get_stats,
+};
+
static void __init usb_ether_setup(struct net_device *dev)
{
struct ether_context *ctxt = netdev_priv(dev);
@@ -305,21 +317,24 @@ static void __init usb_ether_setup(struct net_device *dev)
spin_lock_init(&ctxt->lock);
ctxt->dev = dev;

-	dev->open = usb_ether_open;
-	dev->stop = usb_ether_stop;
-	dev->hard_start_xmit = usb_ether_xmit;
-	dev->get_stats = usb_ether_get_stats;
-	dev->watchdog_timeo = 20;
+ dev->netdev_ops = &usb_ether_ops;

ether_setup(dev);

random_ether_addr(dev->dev_addr);
}

+static struct platform_driver usb_eth_driver = {
+ .driver = { .name = DRIVER_NAME, },
+};
+
static int __init ether_init(void)
{
struct net_device *dev;
int ret;
+ int usbret;
+
+ pr_info("usb_ether_init()\n");

dev = alloc_netdev(sizeof(struct ether_context),
"usb%d", usb_ether_setup);
@@ -328,12 +343,17 @@ static int __init ether_init(void)

ret = register_netdev(dev);
if (ret) {
+ pr_info("usb ethernet - register netdev failed\n");
free_netdev(dev);
} else {
+ pr_info("usb ethernet - register netdev ok\n");
struct ether_context *ctxt = netdev_priv(dev);
usb_func_ether.context = ctxt;
-	usb_function_register(&usb_func_ether);
+	usbret = usb_function_register(&usb_func_ether);
+ pr_info("usb ethernet - register status %d\n", usbret);
}
+ platform_driver_register(&usb_eth_driver);
+ pr_info("usb ethernet - returning...");
return ret;
}

from dmesg on the phone:

[ 3.837524] usb_ether_init()
[ 3.840148] usb_ether_setup()
[ 3.843780] usb ethernet - register netdev ok
[ 3.848632] usb_function_register() 'ether'
[ 3.853240] usb ethernet - register status 0
[ 3.860565] usb ethernet - returning..