# Android 2.2 USB Tethering Tips

## comprookie2000

With an Android 2.2 (Froyo) it is easy to tether your phone to your Gentoo box.

First enable the modules you need;

Device Drivers

USB Network Adaptors

```

Device Drivers --->

  [*] Network device support --->

    USB Network Adapters --->

      [*] Multi-purpose USB Networking Framework

        <*> CDC Ethernet support

        <*> CDC EEM support

        <*> Simple USB Network Links (CDC Ethernet subset)

          [*] Embedded ARM Linux links

  [*] USB Support --->

    <*> USB Modem (CDC ACM) support

    <*> USB Wireless Device Management support

```

```

lsmod

Module                  Size  Used by

rndis_host              5868  0 

cdc_ether               4265  1 rndis_host

usbnet                 16196  2 rndis_host,cdc_ether

mii                     4038  1 usbnet

```

The interface shows up as usb0

```

usb0      Link encap:Ethernet  HWaddr fa:c6:01:4c:4b:71  

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

```

dmesg

```

scsi 10:0:0:0: Direct-Access     Google,  Inc.Nexus One         PQ: 0 ANSI: 2

sd 10:0:0:0: Attached scsi generic sg3 type 0

sd 10:0:0:0: [sdc] Attached SCSI removable disk

usb 1-7: USB disconnect, address 10

usb 1-7: new high speed USB device using ehci_hcd and address 11

usbcore: registered new interface driver cdc_ether

rndis_host 1-7:1.0: usb0: register 'rndis_host' at usb-0000:00:02.1-7, RNDIS device, fa:c6:01:4c:4b:71

usbcore: registered new interface driver rndis_host

```

Next on your phone or device enable USB Tethering.

That is when you can see from dmesg that the device changed from a usb storage device to new interface driver.

Then it is as simple as;

```

dhcpcd usb0

```

Thanks to bugmenot  :Very Happy: 

https://forums.gentoo.org/viewtopic-t-843045-highlight-usb+tethering.html

----------

## likewhoa

thanks for this.

----------

## andriy155

Thanks a lot! This really helped me with my Nokia N900. Apparently, you need the same driver (enable the same module in kernel) for N900 and it works.

----------

## NeddySeagoon

comprookie2000,

Thanks - I was trying to use the USB Gadget Interface, which always failed to load.

----------

## billium

Thanks comprookie2000 .. this also worked for me on a Nexus One, Gingerbread.   :Smile: 

----------

## stemer

What about reverse USB tethering? Have anyone tried to do that with Network Manager? I.e. I want to share my wire connected laptop with my Android 2.2 phone through USB cable. I have HTC Desire Z and USB tethering works flawlessly, but I cannot do it in the other way.

PS. Sorry for my bad english  :Wink: 

----------

## tbD

I have enabled all the kernel option mentioned.  I first did them inline as the post showed * not M.

I also tried modules since the post showed lsmod.

In both cases the usb interface was not established (I did make the net.usb0-->net.lo symlink).

When I tell the phone to connect as a disk, that works perfectly.  But when I tell it to support mobile broadband, I do not get the dmesg output shown and dhcpcd usb0 fails.  I believe this is all due to my not getting the usb0 interface.  I am running 2.6.39 on a ~amd64 gentoo system.

My phone is an htc droid incredible.

Any help would be greatly appreciated.

allan

----------

## Gusar

Ah, so that's how this works with Android - rndis_host (with it's dependencies cdc_ether and usbnet). Good to know in case I'll need it. On my old Nokia phone you'd instead use usbserial, which would give you a /dev/ttyUSB0 and then you'd use ppp with that. Worked with bluetooth to, except the device was /dev/rfcomm0 in that case.

Quite funny, considering the text in the kernel config says rndis shouldn't be used because it's some evil Microsoft thingy.

----------

## swathe

I normally use the wifi tether but I will definitely give this a go, thanks.

----------

## Martux

Very nice, thanks. I also compiled everything into the kernel but usb0 isn't showing up.

Dmesg is not showing any switch when tethering is enabled.

Android 2.3.4 CM7 and gentoo-sources-2.6.39-r2 ~amd64 here.

Anything missing?

----------

## stelth

 *Martux wrote:*   

> Very nice, thanks. I also compiled everything into the kernel but usb0 isn't showing up.
> 
> Dmesg is not showing any switch when tethering is enabled.
> 
> Android 2.3.4 CM7 and gentoo-sources-2.6.39-r2 ~amd64 here.
> ...

 

I had enabled all of the modules in the original post and couldn't get usb0 to show up either. I slimmed it down to just:

```
CONFIG_USB_USBNET=m

CONFIG_USB_NET_CDCETHER=m

CONFIG_USB_NET_RNDIS_HOST=m
```

and it came right up.

They're the options under:

```
│     -> Device Drivers                                                            

│       -> Network device support (NETDEVICES [=y])

│         -> USB Network Adapters
```

EDIT:

If you get the choice on the phone for either Mac OSX or Windows tethering, choose Windows tethering.

----------

## Martux

Thanks!

Even if I compile in as modules, everything loads fine except rndis_host.

I cannot seem to find this one. Even a grep over the kernel config file showed no result. 

Where is this little bugger hidden?

----------

## Gusar

 *Martux wrote:*   

> Where is this little bugger hidden?

 

```
-> Device Drivers

  -> Network device support

    -> USB Network Adapters

      -> Multi-purpose USB Networking Framework

        -> Host for RNDIS and ActiveSync devices (EXPERIMENTAL)
```

----------

## Martux

There is no such option under my 2.6.39-gentoo-r2 kernel  :Sad: 

----------

## comprookie2000

How about this;

http://linuxcrazy.com/downloads/Screenshot-root@amd64testbox:-usr-src-linux.png

----------

## SlashBeast

Click '/' in menuconfig and type what you are looking for, like RNDIS_HOST then look at 'depends on' line, here you see what you need to enable to have it, sometimes option may be not visiable in menuconfig until you enable some deps. Very common.

----------

## phd

I confirm that the usb tethering from HTC WildFire works.

For a new udev I have a symlink net.lo to net.enp0s29f7u2 . I activate internet by means

```
dhcpcd enp0s29f7u2
```

 By the way, in my case the following options are not essential

 *Quote:*   

> 
> 
> [] USB Support --->
> 
>     <> USB Modem (CDC ACM) support
> ...

 Last edited by phd on Thu May 02, 2013 7:43 pm; edited 3 times in total

----------

## Martux

Back from vacation.

Well, I can search the kernel config for

CONFIG_USB_NET_RNDIS_HOST

and it will show where to find it:

```

Symbol: USB_NET_RNDIS_HOST [=n]                                            │   

  │ Type  : tristate                                                           │   

  │ Prompt: Host for RNDIS and ActiveSync devices (EXPERIMENTAL)               │   

  │   Defined at drivers/net/usb/Kconfig:277                                   │  

  │   Depends on: NETDEVICES [=y] && USB [=y] && NET [=y] && USB_USBNET [=y] & │   

  │   Location:                                                                │   

  │     -> Device Drivers                                                      │   

  │       -> Network device support (NETDEVICES [=y])                          │   

  │         -> USB Network Adapters                                            │   

  │           -> Multi-purpose USB Networking Framework (USB_USBNET [=y])      │   

  │   Selects: USB_NET_CDCETHER [=y]                                           │   

  │   Selected by: USB_NET_RNDIS_WLAN [=n] && NETDEVICES [=y] && WLAN [=y] 

```

But when I browse there, it isn't there  :Sad: 

I suppose my config is somewhat broken, I always generate a new kernel config with "make oldconfig".

Is there any way to repair it, without having to configure the whole kernel?

----------

## comprookie2000

Are you sure you are satisfying;

"Depends on: NETDEVICES [=y] && USB [=y] && NET [=y] && USB_USBNET [=y] "

----------

## Martux

Seems so:

cat/usr/src/linux/.config gave this:

```

CONFIG_USB_USBNET=y

CONFIG_NET=y

CONFIG_NETDEVICES=y

```

----------

## Martux

A grep for CONFIG_USB_NET_RNDIS_HOST gives nothing.

----------

## comprookie2000

try;

<M> Multi-purpose USB Networking Framework  

that should then open up so you can see;

<M>   Host for RNDIS and ActiveSync devices (EXPERIMENTAL)

This is from 3.0.0

----------

## Martux

Yes, I believe you that it should be there, but it isn't  :Sad: 

This is all I get to see under "USB Network Adapters ":

```

<M> Multi-purpose USB Networking Framework                                                           │ │   

  │ │                               < >   ASIX AX88xxx Based USB 2.0 Ethernet Adapters                                                   │ │   

  │ │                               <M>   CDC Ethernet support (smart devices such as cable modems)                                      │ │   

  │ │                               <M>   CDC NCM support                                                                                │ │   

  │ │                               < >   Davicom DM9601 based USB 1.1 10/100 ethernet devices                                           │ │   

  │ │                               < >   SMSC LAN75XX based USB 2.0 gigabit ethernet devices                                            │ │   

  │ │                               < >   SMSC LAN95XX based USB 2.0 10/100 ethernet devices                                             │ │   

  │ │                               < >   GeneSys GL620USB-A based cables                                                                │ │   

  │ │                               < >   NetChip 1080 based cables (Laplink, ...)                                                       │ │   

  │ │                               < >   MosChip MCS7830 based Ethernet adapters                                                        │ │   

  │ │                               <M>   Simple USB Network Links (CDC Ethernet subset)                                                 │ │   

  │ │                               [ ]     ALi M5632 based 'USB 2.0 Data Link' cables                                                   │ │   

  │ │                               [ ]     AnchorChips 2720 based cables (Xircom PGUNET, ...)                                           │ │   

  │ │                               [*]     eTEK based host-to-host cables (Advance, Belkin, ...)                                        │ │   

  │ │                               [*]     Embedded ARM Linux links (iPaq, ...)                                                         │ │   

  │ │                               [ ]     Epson 2888 based firmware (DEVELOPMENT)                                                      │ │   

  │ │                               < >   Sharp Zaurus (stock ROMs) and compatible                                                       │ │   

  │ │                               < >   Conexant CX82310 USB ethernet port                                                             │ │   

  │ │                               < >   Samsung Kalmia based LTE USB modem                                                             │ │   

  │ └───────────────────────────────v(+)───────────────────────────────────────────────────────────

< >   Samsung Kalmia based LTE USB modem                                                             │ │   

  │ │                               < > Option USB High Speed Mobile Devices                                                             │ │   

  │ │                               < > Intellon PLC based usb adapter                                                                   │ │   

  │ │                               < > Apple iPhone USB Ethernet driver                                                                 │ │   

  │ │                               < > USB-to-WWAN Driver for Sierra Wireless modems                                                    │ │   

  │ │                               < > LG VL600 modem dongle            

```

Probably my config is really messed, this is from 3.9 too... Is there a way to insert those options manually in the configuration file?

----------

## comprookie2000

do any  (EXPERIMENTAL) drivers show up, maybe there is an option to open them up not sure

----------

## Martux

There are only those options available that are shown in my last post  :Sad: 

----------

## comprookie2000

EXPERIMENTAL - Prompt for development and/or incomplete code/drivers

grep CONFIG_EXPERIMENTAL .config

----------

## Martux

Wow, great! That was it. After activating it also the RNDIS_HOST option showed up.

Thanks a lot!

----------

## Dave Nielsen

Thanks a lot,... interesting!

----------

## hujuice

For my experience (Android 2.2.1), it is possible to clean up a bit the needed kernel modules.

```
Device Drivers --->

    [*] Network device support --->

        USB Network Adapters --->

            [*] Multi-purpose USB Networking Framework

                <*> CDC Ethernet support

                <*> CDC EEM support

                <*> Simple USB Network Links (CDC Ethernet subset)

            [*] Embedded ARM Linux links
```

is enough for me.

As already said, CONFIG_USB_ACM and CONFIG_USB_WDM are NOT necessary.

Also, I DON'T need CONFIG_USB_NET_RNDIS_HOST.

Try yourself, but...

 *kernel comment to CONFIG_USB_NET_RNDIS_HOST wrote:*   

> This option enables hosting "Remote NDIS" USB networking links,
> 
> as encouraged by Microsoft (instead of CDC Ethernet!) for use in
> 
> various devices that may only support this protocol.  A variant
> ...

 

http://en.wikipedia.org/wiki/USB_communications_device_class

I wonder if a Linux-to-Android system needs this.

Regards,

HUjuice

----------

## comprookie2000

I just tried it and for my Nexus One I needed "CONFIG_USB_NET_RNDIS_HOST"

We should put together a wiki entry;

http://wiki.gentoo.org/wiki/Main_Page

----------

## comprookie2000

OK started the page.

https://wiki.gentoo.org/wiki/Android_USB_Tethering

----------

## hujuice

Ok, I added some more verbose informations to the wiki.

I mess it! I like it...  :Cool: 

Please, fix my English!  :Embarassed: 

Since I use tethering to skip my evil work firewall, I added some trick to fine tuning the DHCP behaviour, to have mixed network configurations.

Regards,

HUjuice

----------

## cach0rr0

i suppose i should set up a wiki account since i plan on adding stuff at some point

I'll be getting a Galaxy Nexus today, assuming the FedEx truck doesn't get lost. I assume the Nexus One steps should work for it too; I'll update the wiki if it works, unless of course I get lazy, then ill just post it here  :Laughing: 

I'm sure the wifi hotspot will work, but ive never tried via USB since wifi always worked.

----------

## hujuice

For a laptop usage, I agree, the wifi solution is preferable.

More than one device can be connected while your mobile phone is lodging in your pocket.

As said, I find useful the wired (USB) solution when I need some extra configuration and/or on a desktop device (with no wifi).

Yes, you'll need an account for the wiki  :Smile: 

Signing in is really quick.

Enjoy it  :Smile: 

Hujuice

----------

## cach0rr0

works just fine on the Galaxy Nexus

posting via USB tether

```

[10576.230731] usb 2-1: USB disconnect, device number 5

[10576.545706] usb 2-1: new high speed USB device number 6 using ehci_hcd

[10576.675388] usbcore: registered new interface driver cdc_ether

[10576.678039] rndis_host 2-1:1.0: usb0: register 'rndis_host' at usb-0000:00:1d.7-1, RNDIS device, 6e:ca:59:b7:5d:00

[10576.678204] usbcore: registered new interface driver rndis_host

```

```

usb0      Link encap:Ethernet  HWaddr 6e:ca:59:b7:5d:00  

          inet addr:192.168.42.201  Bcast:192.168.42.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:766 errors:4 dropped:6 overruns:0 frame:4

          TX packets:1161 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:126278 (123.3 KiB)  TX bytes:231561 (226.1 KiB)

```

was easy. modprobe usbnet, enable usb tether on the phone, dhcpcd usb0, and that's all she wrote.

EDIT: ok, I stopped being lazy, set up a wiki account, and updated it on the wiki. Works on ITL41D (Android 4.0.1), Samsung Galaxy Nexus.

----------

## kwispy

 *stelth wrote:*   

>  *Martux wrote:*   Very nice, thanks. I also compiled everything into the kernel but usb0 isn't showing up.
> 
> Dmesg is not showing any switch when tethering is enabled.
> 
> Android 2.3.4 CM7 and gentoo-sources-2.6.39-r2 ~amd64 here.
> ...

 

This worked for me, after the original (first post) kernel config failed to bring up usb0.  Didn't have to autoload modules.

Using: HTC Sensation (pyramid) with Android 2.3.4 rooted (Gingerbread)

Kernel: 2.6.30-gentoo-r7

If you use wicd like I do, just change the wired interface to usb0 instead of lan0.

----------

## snakeo2

Hello,

I'm trying to get my htc evo 4g to work and also compiled "usbnet, cdcether & rndis_host" as modules but during boot up i get errors that modules cant be loaded. I added the modules to my /etc/conf.d/modules....did I miss something? Thanks in advance.

----------

## Rolmo

 *stelth wrote:*   

> 
> 
> I had enabled all of the modules in the original post and couldn't get usb0 to show up either. I slimmed it down to just:
> 
> ```
> ...

 

I had to set the same like you. Options from original post and Gentoo Wiki didn't work for me.

----------

## logistiker

You might want to enable usb gadget support and related configs because these are the drivers that actually create the usb0 device.

CONFIG_USB_ETH

CONFIG_USB_ETH_RNDIS

CONFIG_USB_ETH_EEM

----------

