USB Tethering on Gentoo using Cyanogenmod7

I had some trouble when setting up USB tethering on a Gentoo Linux 2.6.38-gentoo-r6. I setup genkernel following a post at forums.gentoo.org.

Device Drivers --->
  [*] Network device support --->
    USB Network Adapters --->
      [M] Multi-purpose USB Networking Framework
        <M> CDC Ethernet support
        <M> CDC EEM support
        <M> Simple USB Network Links (CDC Ethernet subset)
          [*] Embedded ARM Linux links
  [*] USB Support --->
    <*> USB Modem (CDC ACM) support
    <*> USB Wireless Device Management support

After re-building the kernel, we wondered why the module rndis_host was missing, which is required to recognize the USB ethernet device. After searching the kernel configuration we find out, that another option must enabled to compile this module:

Device Drivers --->
  [*] Network device support --->
    USB Network Adapters --->
      [M] Multi-purpose USB Networking Framework
        <M> Host for RNDIS and ActiveSync devices (EXPERIMENTAL)

We now can modprobe the rndis host module which also loads the dependent modules:

$ modprobe -v rndis_host
insmod /lib/modules/2.6.38-gentoo-r6/kernel/drivers/net/mii.ko
insmod /lib/modules/2.6.38-gentoo-r6/kernel/drivers/net/usb/usbnet.ko
insmod /lib/modules/2.6.38-gentoo-r6/kernel/drivers/net/usb/cdc_ether.ko
insmod /lib/modules/2.6.38-gentoo-r6/kernel/drivers/net/usb/rndis_host.ko

We were using the Google Nexus One with CyanogenMod-7.1.0-RC1-N1 and Android version 2.3.4. After attaching the device and enabling USB tethering, we got the following dmesg:

usb 2-1.8: new high speed USB device using ehci_hcd and address 8
usb 2-1.8: New USB device found, idVendor=18d1, idProduct=4e11
usb 2-1.8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1.8: Product: Nexus One
usb 2-1.8: Manufacturer: Google, Inc.
usb 2-1.8: SerialNumber: HT063P801456
usb 2-1.8: bad cdc descriptor

We expected a new USB ethernet device usb0 but got a bad cdc descriptor error instead. Googling the issue leads us to a wrong way: We found lots of posts and bug entries which indicates kernel bugs e.g. with non-unique USB id’s or even a not-working Cyanogenmod. Fortunately that does not apply to our issue since we have to enable another kernel setting to fix it:

Device Drivers --->
  [*] USB support  --->
    <*>   USB Gadget Support  --->
      <M>   USB Gadget Drivers
        <M>     Ethernet Gadget (with CDC Ethernet support)
        [*]       RNDIS support

After re-bulding the kernel, we got the following when attaching the N1 and enabling USB tethering:

usb 1-3: new high speed USB device using ehci_hcd and address 5
usb 1-3: New USB device found, idVendor=18d1, idProduct=4e13
usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-3: Product: Nexus One
usb 1-3: Manufacturer: Google, Inc.
usb 1-3: SerialNumber: HT063P801456
rndis_host 1-3:1.0: usb0: register 'rndis_host' at usb-0000:00:1a.7-3, RNDIS device, ae:b8:2a:f6:5f:b0

We now can run ifconfig or dhcpcd in order to configure the new ethernet device to establish a network connection:

$ dhcpcd usb0
dhcpcd[18640]: version 5.2.12 starting
dhcpcd[18640]: usb0: broadcasting for a lease
dhcpcd[18640]: usb0: offered 192.168.42.32 from 192.168.42.129
dhcpcd[18640]: usb0: acknowledged 192.168.42.32 from 192.168.42.129
dhcpcd[18640]: usb0: checking for 192.168.42.32
dhcpcd[18640]: usb0: leased 192.168.42.32 for 3600 seconds
dhcpcd[18640]: forked to background, child pid 18676
$ ping heise.de
PING heise.de (193.99.144.80) 56(84) bytes of data.
64 bytes from redirector.heise.de (193.99.144.80): icmp_req=1 ttl=248 time=21.9 ms
^C
--- heise.de ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 21.999/21.999/21.999/0.000 ms
  1. Pretty section of content. I just stumbled upon your web site and in accession capital to say that I get in fact enjoyed account your blog posts. Anyway I’ll be subscribing on your feeds or even I success you get entry to consistently quickly.

  2. […] You're gonna love this…: https://bbs.archlinux.org/viewtopic.php?pid=1124451 But they got it fixed. This method takes a different (better?) approach: http://www.danielmorlock.de/2011/usb…-cyanogenmod7/ […]

Leave a Reply

You must be logged in to post a comment.