# [solved]Android tethering woes

## Munin

Hi all!

I'm having quite a problem with my new HTC Wildfire concerning tethering.

I already mentioned it in another thread but I didn't get any replies there.

I bought an Android phone because I "knew" they support internet connection sharing out of the box and I would really need that feature now since I commute by train two and a half hours every morning and evening.

Indeed, the phone really offers me the option to share its internet connection when I connect it to a pc using a USB cable. Choosing that option doesn't suffice though, no matter what I try, I can't even ping a single host, not even the phone itself.

Reading the users' manual revealed that I need to install some program and that the installer can be found on the phone. A Windows installer -of course- so its of no use to me. However, it seems to me that some people have managed to share their Android phones' internet connections with their Linux machines and I'd really like to know what I have to do to get it working, too.

So far the phone is recognized as an Android phone and it shows up as usb0 and I can use dhcpcd to get an IP address and a gateway.

Which kernel modules do I need, which commands do I have to run?

What I didn't mention in that other thread is another problem: after I enabled cdc_ether and rndis_host the phone always shows up as usb0, no matter whether its online or offline or whether I chose to mount it as a drive, to only charge the battery or to share its internet connection.

Is there any way to fix that, apart from maybe rebuilding the kernel without those modules?

----------

## chithanh

The usb0 should only show up as long as you enable Internet sharing in the phone. Note that there are two such settings, one which pops up on USB connect, and another one buried in the settings menu.

----------

## rrbrussell

Quick note on how my Nexus One does things.

Android 2.2.1 will by default ask if I want to enable USB Disk mode when I plug in the USB cable.

To enable tethering I have to go into Settings->Wireless & Network Settings->Tethering & portable hot-spot and then select USB tethering. I have do this every time I plug my phone in and want to tether.

Your phone will/may vary a bit but you should have some idea where to look now.

I just added the following to /etc/conf.d/net and created a symlink between /etc/init.d/net.usb0 and /etc/init.d/net.lo.

/etc/init.d/net.usb0 start will now get me online through my phone after it is in tethering mode.

```
config_usb0=( "dhcp" )

dns_domain_usb0="localdomain"
```

Make sure to enable USB Modem (CDC ACM) support in your kernel.

----------

## Munin

thanks for your replies, guys  :Smile: 

I appreciate it, yet my problem still persists.

 *chithanh wrote:*   

> The usb0 should only show up as long as you enable Internet sharing in the phone. Note that there are two such settings, one which pops up on USB connect, and another one buried in the settings menu.

 

I know that usb0 should only show up as long as internet sharing is enabled in the phone, yet it still shows up everytime I connect the phone and so far I can't do a damn thing about it    :Confused: 

The option that pops up when I connect the phone to the computer is linked to the option burried in the settings menu, I just checked it: I enabled internet access, connected the phone, chose internet sharing from the popup and looked at the option in the settings menu.

 *rrbrussell wrote:*   

> Quick note on how my Nexus One does things.
> 
> Android 2.2.1 will by default ask if I want to enable USB Disk mode when I plug in the USB cable.
> 
> To enable tethering I have to go into Settings->Wireless & Network Settings->Tethering & portable hot-spot and then select USB tethering. I have do this every time I plug my phone in and want to tether.
> ...

 

I have to choose what I want to do everytime I connect the phone to a pc. If the phone is connected to the internet there is an option to share the internet connection, otherwise I can only choose between "only charge battery", "HTC sync" and "mount as drive" (the latter not working anymore, like I mentioned before)

 *rrbrussell wrote:*   

> 
> 
> I just added the following to /etc/conf.d/net and created a symlink between /etc/init.d/net.usb0 and /etc/init.d/net.lo.
> 
> /etc/init.d/net.usb0 start will now get me online through my phone after it is in tethering mode.
> ...

 

I checked my kernel once more, cdc_acm was a module, I marked it as built in and recompiled the kernel, just to make sure. After a reboot I enabled my phone's internet connection, connected the phone to my laptop and took a look at ifconfig. Your way seemed to work fine, usb0 was brought up automatically, I had to do it by hand before.

unfortunately bringing usb0 up automatically and getting an IP and a gateway via dhcp was about all that happened, no further changes, I still can't access the internet from my laptop   :Crying or Very sad: 

here's what I tried and what happened:

```
valgrind hugin # ifconfig

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  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:0

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

usb0      Link encap:Ethernet  HWaddr da:31:d1:16:bb:2d

          inet addr:192.168.100.100  Bcast:192.168.100.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:1152 (1.1 KiB)  TX bytes:4946 (4.8 KiB)

valgrind hugin # ping -c 3 heise.de

ping: unknown host heise.de

valgrind hugin # ping -c 3 -I usb0 8.8.8.8

PING 8.8.8.8 (8.8.8.8) from 192.168.100.100 usb0: 56(84) bytes of data.

--- 8.8.8.8 ping statistics ---

3 packets transmitted, 0 received, 100% packet loss, time 2016ms

valgrind hugin # ping -c 3 192.168.100.254

PING 192.168.100.254 (192.168.100.254) 56(84) bytes of data.

--- 192.168.100.254 ping statistics ---

3 packets transmitted, 0 received, 100% packet loss, time 2016ms

valgrind hugin # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 usb0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

0.0.0.0         192.168.100.254 0.0.0.0         UG    0      0        0 usb0
```

----------

## Munin

Since nobody here seemed to be able to help me I contacted HTC and their reply at least brought some light to this:

Android 2.1 (which my Wildfire was running when it shipped and which was the latest release available) does not support native tethering, one has to use the program I mentioned in my first post.

Some internet research revealed that Android 2.2 was supposed to support native tethering via USB and WiFi.

It was not until yesterday that 2.2 became available to me, so all I could do was hope and wait - and it was worth waiting for, it just works like a charm.

long story short: Android 2.1 (at least on HTC phones) does not support tethering with Linux systems, Andoid 2.2 does

----------

## chithanh

I can attest that my HTC Hero supports tethering via USB (both with stock Android 1.5 and 2.1), as long as I enable the correct kernel options on my Gentoo system.

Tethering via Bluetooth is indeed not possible using the official firmware.

----------

## phd

 *Munin wrote:*   

> Since nobody here seemed to be able to help me I contacted HTC and their reply at least brought some light to this:
> 
> Android 2.1 (which my Wildfire was running when it shipped and which was the latest release available) does not support native tethering, one has to use the program I mentioned in my first post.
> 
> Some internet research revealed that Android 2.2 was supposed to support native tethering via USB and WiFi.
> ...

 

My HTC WildFire (Android 2.2) does not support USB tethering via "/etc/init.d/net.usb0 start". In my case the device usb0 does not exist as reported by ifconfig, in spite of I have loaded cdc_acm to kernel by modprobe cdc_acm. Maybe the device has a different name?Last edited by phd on Mon Mar 14, 2011 11:12 am; edited 2 times in total

----------

## cach0rr0

 *phd wrote:*   

> 
> 
> I can confirm that my HTC WildFire (Android 2,2) does not support USB tethering via "/etc/init.d/net.usb0 start". Maybe the device has a different name?

 

check /proc/net/dev ? 

if it's loading under a different name (e.g. wwan0) that name should be shown in dmesg output i would think.

----------

## phd

# modprobe cdc_acm

# cat /proc/net/dev

Inter-|   Receive                                                |  Transmit

 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed

    lo:    4676      76    0    0    0     0          0         0     4676      76    0    0    0     0       0          0

  sit0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

  eth0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

 wlan0:   18228      89    0    0    0     0          0         0     8376      82    0    0    0     0       0          0

I do not see any device related to HTC WildFire , nevertheless the first execution of

dmesg | grep -B5 -A10 -i htc 

gives

[    1.254160] usb 1-1: default language 0x0409

[    1.260167] usb 1-1: udev 2, busnum 1, minor = 1

[    1.260172] usb 1-1: New USB device found, idVendor=0bb4, idProduct=0ffe

[    1.260462] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3

[    1.260751] usb 1-1: Product: Android Phone

[    1.261050] usb 1-1: Manufacturer: HTC

[    1.261347] usb 1-1: SerialNumber: HT08VPY01301

[    1.261664] PM: Adding info for usb:1-1

[    1.261773] usb 1-1: usb_probe_device

[    1.261777] usb 1-1: configuration #1 chosen from 1 choice

[    1.261780] usb 1-1: __pm_runtime_resume()!

[    1.261782] usb 1-1: __pm_runtime_resume() returns 1!

[    1.262920] usb 1-1: adding 1-1:1.0 (config #1, interface 0)

[    1.262955] PM: Adding info for usb:1-1:1.0

[    1.264312] PM: Adding info for No Bus:ep_82

[    1.264319] usb 1-1: adding 1-1:1.1 (config #1, interface 1)

[    1.264369] PM: Adding info for usb:1-1:1.1

[    1.266306] PM: Adding info for No Bus:ep_81

[    1.266331] PM: Adding info for No Bus:ep_01

[    1.266337] drivers/usb/core/inode.c: creating file '002'

[    1.266373] PM: Adding info for No Bus:ep_00

[    1.266382] hub 1-0:1.0: port 5, status 0501, change 0000, 480 Mb/s

[    1.274063] REISERFS (device sda3): Using r5 hash to sort names

[    1.274404] VFS: Mounted root (reiserfs filesystem) readonly on device 8:3.

[    1.274710] Freeing unused kernel memory: 504k freed

[    1.275205] Write protecting the kernel read-only data: 10240k

[    1.275768] Freeing unused kernel memory: 1568k freed

[    1.276910] Freeing unused kernel memory: 2004k freed

[    1.317270] ehci_hcd 0000:00:1d.7: port 5 full speed --> companion

[    1.317283] ehci_hcd 0000:00:1d.7: GetStatus port:5 status 003801 0  ACK POWER OWNER sig=j CONNECT

[    1.317293] hub 1-0:1.0: port 5 not reset yet, waiting 50ms

[    1.368049] ehci_hcd 0000:00:1d.7: GetStatus port:5 status 003002 0  ACK POWER OWNER sig=se0 CSC

[    1.368088] hub 1-0:1.0: port 6, status 0501, change 0000, 480 Mb/s

[    1.419266] ehci_hcd 0000:00:1d.7: port 6 high speed

[    1.419277] ehci_hcd 0000:00:1d.7: GetStatus port:6 status 001005 0  ACK POWER sig=se0 PE CONNECT

[    1.470054] usb 1-6: new high speed USB device using ehci_hcd and address 4

[    1.521269] ehci_hcd 0000:00:1d.7: port 6 high speed

[    1.521279] ehci_hcd 0000:00:1d.7: GetStatus port:6 status 001005 0  ACK POWER sig=se0 PE CONNECT

[    1.584295] usb 1-6: __pm_runtime_resume()!

[    1.584301] usb 1-6: __pm_runtime_resume() returns -11!

[    1.587925] usb 1-6: skipped 1 descriptor after configuration

[    1.588000] usb 1-6: skipped 5 descriptors after interface

[    1.588013] usb 1-6: skipped 1 descriptor after endpoint

[    1.588016] usb 1-6: skipped 7 descriptors after interface

[    1.588022] usb 1-6: udev 4, busnum 1, minor = 3

[    1.588024] usb 1-6: New USB device found, idVendor=05ca, idProduct=1835

[    1.588300] usb 1-6: New USB device strings: Mfr=0, Product=0, SerialNumber=0

[    1.594386] PM: Adding info for usb:1-6

[    1.702743] kworker/u:0 used greatest stack depth: 4760 bytes left

[    1.702773] usb 1-6: usb_probe_device

[    1.702780] usb 1-6: configuration #1 chosen from 1 choice

[    1.702787] usb 1-6: __pm_runtime_resume()!

[    1.702791] usb 1-6: __pm_runtime_resume() returns 1!

[    1.703081] usb 1-6: adding 1-6:1.0 (config #1, interface 0)

[    1.703102] PM: Adding info for usb:1-6:1.0

[    1.703174] PM: Adding info for No Bus:ep_82

[    1.703178] usb 1-6: adding 1-6:1.1 (config #1, interface 1)

[    1.703194] PM: Adding info for usb:1-6:1.1

[    1.703278] drivers/usb/core/inode.c: creating file '004'

[    1.703303] PM: Adding info for No Bus:ep_00

[    1.703310] hub 1-0:1.0: port 8, status 0501, change 0000, 480 Mb/s

[    1.754269] ehci_hcd 0000:00:1d.7: port 8 full speed --> companion

[    1.754280] ehci_hcd 0000:00:1d.7: GetStatus port:8 status 003801 0  ACK POWER OWNER sig=j CONNECT

[    1.754288] hub 1-0:1.0: port 8 not reset yet, waiting 50ms

[    1.805073] ehci_hcd 0000:00:1d.7: GetStatus port:8 status 003002 0  ACK POWER OWNER sig=se0 CSC

[    1.805102] hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0100

[    1.805107] hub 1-0:1.0: __pm_runtime_resume()!

[    1.805112] hub 1-0:1.0: __pm_runtime_resume() returns 1!

[    1.805121] hub 1-0:1.0: __pm_runtime_suspend()!

[    1.805126] hub 1-0:1.0: __pm_runtime_suspend() returns 0!

[    3.222641] consoletype used greatest stack depth: 4656 bytes left

[    3.506594] stty used greatest stack depth: 4048 bytes left

[    5.890457] udev: starting version 151

[    5.890517] udevd (958): /proc/958/oom_adj is deprecated, please use /proc/958/oom_score_adj instead.

[    5.890521] udevd used greatest stack depth: 3968 bytes left

[    6.012320] ACPI: resource 0000:00:1f.3 [io  0x18e0-0x18ff] conflicts with ACPI region SMBI [io  0x18e0-0x18ef 64bit pref window disabled]

[    6.012324] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver

[    6.126566] scsi host0: __pm_runtime_resume()!

[    6.126570] scsi host0: __pm_runtime_resume() returns 1!

[    6.126762] sd 2:0:0:0: __pm_runtime_resume()!

[    6.126764] sd 2:0:0:0: __pm_runtime_resume() returns 1!

[    6.128017] scsi host0: __pm_runtime_resume()!

[    6.128021] scsi host0: __pm_runtime_resume() returns 1!

Next time, I cannot even rerun dmsg. I got only messages like this

dmesg | less

5.755168] scsi host0: __pm_runtime_resume()!

[  575.755174] scsi host0: __pm_runtime_resume() returns 1!

[  575.756278] scsi host0: __pm_runtime_resume()!

[  575.756284] scsi host0: __pm_runtime_resume() returns 1!

etc.

----------

