Topic: android thetering setup

so, my cable provider is less reliable than AT&T... looking for workarounds for my downtime i've found this http://whats.all.this.brouhaha.com/2010 … rt-router/

USB tethering an Android phone to an OpenWRT router
...
I connected my Nexus One phone to the USB port of the DIR-825, and installed the following packages:

kmod-nls-base
kmod-usb2
kmod-usb-core
kmod-usb-net
kmod-usb-net-cdc-ether
kmod-usb-net-rndis
kmod-usb-ohci
kmod-usb-uhci
Once these were installed, I edited /etc/config/network, and under “config interface wan” replaced “option ifname eth1? with “option ifname usb0?.

I enabled USB tethering on the phone, and upon rebooting the router, it successfully set up the usb0 network interface and obtained its IP address, netmask, default gateway, etc. from the phone via DHCP.

At this point the only problem is that if I disconnect the phone (or disable tethering), then reconnect, the usb0 interface appears, but does not get configured by dhcp

i think he got everything right except the network config (and installing both ohci and uhci...)

Does anyone here have a better setup?  i'd really like to play with this later but can't risk the downtime right now. (on both cable and att)

Re: android thetering setup

You would need some kind of udev rules to start the connection when you plug the phone

Re: android thetering setup

with the latest release, i just installed all that +usbutils +udev

and it's working with hot plugging just fine!

all i needed to do is to replace the interface name on my wlan in /etc/config/network and i'm in business.

will try to make the button on my modem make that interface switch for wlan later. would be a good backup uplink solution that everyone can use without root password.

Re: android thetering setup

Like gcbwrt said, everything is working flawlessly for me too.  I'm using it as my primary internet connection at home now; I dropped my cable provider and switched to Dish, saving around $100/mo now.  The speedtest.net results are Sprint 3G with an average 2 or 3 signal bars on my EVO, I live in Dubuque, Iowa...

Speedtest.net:
    Ping = 125 ~ 142 ms
    Download Speed = 1.25 ~ 1.65 Mbps
    Upload Speed = 0.33 ~ 0.43 Mbps

Hardware:
    Sprint HTC EVO 4G:
        Hardware Version = 0002
        Android Version = 2.3.3
        Software number = 4.24.651.1
        Kernel version = 2.6.35.10
        Baseband version = 2.15.00.0808
        Build number = Synergy (RLS1+GodMode)
        PRI Verions = 2.15_003
        PRL Version = 60681
    Netgear N600 Wireless Dual Band Gigabit Router (WNDR3700v2)
        OpenWRT Version = 10.03.1-rc5

Complete Instructions (for WNDR3700v2 / EVO 4G):

    1. Install OpenWRT
        Download: http://downloads.openwrt.org/backfire/1 … ory-NA.img
        Flash the router using the Firmware Upgrade option in the Netgear admin web interface (Defaults: 192.168.1.1, admin/password).

    2. Navigate to the OpenWRT router web interface (Defaults: 192.168.1.1, root without a password) and set root password to enable SSH.

    3. Download the following files to your PC, from http://downloads.openwrt.org/backfire/10.03.1-rc5/ar71xx/packages/
        kmod-usb-net-cdc-ether_2.6.32.27-1_ar71xx.ipk
        kmod-usb-net-rndis_2.6.32.27-1_ar71xx.ipk
        kmod-usb-net_2.6.32.27-1_ar71xx.ipk
        libpthread_0.9.30.1-43.20_ar71xx.ipk
        librt_0.9.30.1-43.20_ar71xx.ipk
        libusb-1.0_1.0.8-1_ar71xx.ipk
        udev_142-1_ar71xx.ipk
        usbutils_003-1_ar71xx.ipk
        zlib_1.2.3-5_ar71xx.ipk
            Note: kmod-nls-base, kmod-usb2, kmod-usb-core, and kmod-usb-ohci packages are part of the base firmware.
            Note: kmod_usb-uhci is only needed for USB 1.0 devices, USB 1.1 devices uses OHCI and USB 2.0 uses EHCI.
            Note: libpthread, librt, libusb, and zlib are dependencies of usbutils.

    4. SCP the files you download on your computer to your router. The WinSCP program will work if you set the mode to SCP
        Note: SFTP does not work, you must use SCP to transfer the files.

    5. SSH to your router and install the packages using the following command: "opkg install *.ipk".

    6. Edited /etc/config/network, and under “config interface wan” replace “option ifname eth1? with “option ifname usb0?. Then reboot.

    7. Plug your phone into the router, you should get a pop-up on your phone asking what USB mode you want, select USB Tethering.

    8. SSH to your router and run "ifconfig usb0". If you see an IP address assigned your golden, otherwise look through dmesg for errors.

root@OpenWrt:~# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr AA:CC:B6:36:B3:97
          inet addr:192.168.42.65  Bcast:192.168.42.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:110 errors:0 dropped:0 overruns:0 frame:0
          TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32350 (31.5 KiB)  TX bytes:22395 (21.8 KiB)

root@OpenWrt:~# dmesg |grep usb
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
usb usb1: configuration #1 chosen from 1 choice
usb usb2: configuration #1 chosen from 1 choice
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver rndis_host
usb 1-1: new high speed USB device using ar71xx-ehci and address 2
usb 1-1: configuration #1 chosen from 1 choice
usb 1-1: USB disconnect, address 2
usb 1-1: new high speed USB device using ar71xx-ehci and address 3
usb 1-1: configuration #1 chosen from 1 choice
usb0: register 'rndis_host' at usb-ar71xx-ehci-1, RNDIS device, aa:cc:b6:36:b3:97
usb 1-1: USB disconnect, address 3
usb0: unregister 'rndis_host' usb-ar71xx-ehci-1, RNDIS device
usb 1-1: new high speed USB device using ar71xx-ehci and address 4
usb 1-1: configuration #1 chosen from 1 choice
usb0: register 'rndis_host' at usb-ar71xx-ehci-1, RNDIS device, aa:cc:b6:36:b3:97
usb 1-1: USB disconnect, address 4
usb0: unregister 'rndis_host' usb-ar71xx-ehci-1, RNDIS device
usb 1-1: new high speed USB device using ar71xx-ehci and address 5
usb 1-1: configuration #1 chosen from 1 choice
usb 1-1: USB disconnect, address 5
usb 1-1: new high speed USB device using ar71xx-ehci and address 6
usb 1-1: configuration #1 chosen from 1 choice
usb0: register 'rndis_host' at usb-ar71xx-ehci-1, RNDIS device, aa:cc:b6:36:b3:97

root@OpenWrt:~# lsusb -v
Bus 001 Device 006: ID 0bb4:0ffe High Tech Computer Corp.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0bb4 High Tech Computer Corp.
  idProduct          0x0ffe
  bcdDevice            2.26
  iManufacturer           1 HTC
  iProduct                2 Android Phone
  iSerial                 3 HT05DHL08233
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           75
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       0 None
      iFunction               6 RNDIS
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol    255 Vendor Specific (MSFT RNDIS?)
      iInterface              4 RNDIS Communications Control
      CDC Header:
        bcdCDC               1.10
      CDC Call Management:
        bmCapabilities       0x00
        bDataInterface          1
      CDC ACM:
        bmCapabilities       0x00
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               9
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface              5 RNDIS Ethernet Data
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

Re: android thetering setup

If your router has a USB port, then why not just get a USB 3G/4G modem?

Mazi

Re: android thetering setup

mazilo wrote:

If your router has a USB port, then why not just get a USB 3G/4G modem?

Because it's fun to get it working without buying extra hardawre?

Re: android thetering setup

mazilo wrote:

If your router has a USB port, then why not just get a USB 3G/4G modem?

For a few reasons, according to a BestBuy sales rep...
1. A USB 3G adapter/plan on Sprint is an extra $50 a month, and their is a monthly 5GB data cap.
2. A USB 4G adapter/plan on Sprint is an extra $75 a month, but no monthly cap though.

Their are no additional costs or monthly data caps by simply using your Sprint phone. The inconvenience of having to plug your phone into the router is minimal because you have to plug it in anyways to recharge it. Since hot-plugging is working you can unplug it any time you need to. If your spouse and you both have EVO's you can use one for data and the other for calls. To me, saving $1200 a year is worth a little inconvenience.

Best Regards.

8 (edited by torontob 2012-07-27 02:11:19)

Re: android thetering setup

I got all needed packages installed and phone shows USB tether ON and interface comes up but then no IP is obtained by OpenWRT and I get the following erros (usb disconnected) continuously:

root@OpenWrt:~# dmesg |grep usb
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
usb usb1: configuration #1 chosen from 1 choice
usb 1-1: new high speed USB device using ehci_hcd and address 2
usb 1-1: configuration #1 chosen from 1 choice
usb usb2: configuration #1 chosen from 1 choice
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver rndis_host
usb 1-1: USB disconnect, address 2
usb 1-1: new high speed USB device using ehci_hcd and address 3
usb 1-1: configuration #1 chosen from 1 choice
usb0: register 'rndis_host' at usb-0000:00:0f.5-1, RNDIS device, 52:01:e2:2f:a3:9f
usb 1-1: USB disconnect, address 3
usb0: unregister 'rndis_host' usb-0000:00:0f.5-1, RNDIS device
usb 1-1: new high speed USB device using ehci_hcd and address 4
usb 1-1: configuration #1 chosen from 1 choice
usb 1-1: USB disconnect, address 4
usb 1-1: new high speed USB device using ehci_hcd and address 5
usb 1-1: configuration #1 chosen from 1 choice
usb0: register 'rndis_host' at usb-0000:00:0f.5-1, RNDIS device, 52:01:e2:2f:a3:9f

Phone: XT860 Android 2.3.3
OpenWRT: Alix2d3

Please guide.

Thanks

Re: android thetering setup

Turns out that it was the phone which was the issue. I test the phone with computer and it failed to provide an IP to computer. Factory reset the phone and then everything was all good.

10 (edited by gcbwrt 2013-02-13 01:07:08)

Re: android thetering setup

just tried to use it again... i don't get any rndis message in the logs...

usb 1-1: new high speed USB device using ar71xx-ehci and address 2
usb 1-1: configuration #1 chosen from 1 choice
usb 1-1: USB disconnect, address 2
usb 1-1: new high speed USB device using ar71xx-ehci and address 3
usb 1-1: configuration #1 chosen from 1 choice

and that's it. nothing else...

update: think it was also a phone issue as above. it was registering fine at my linux host. but as soon as i tried to use with windows7, it would go crazy. completely froze any window trying to get network stats.

i've updated cyanogenmod to the latest nightly and it's now getting the IP just fine on windows7, so i'm guessing it will go back to working on openwrt when i test it later.

Update 2:
ok, just plugged the reimaged phone and ... same thing hmm

also, checking my first post, there's no kmod-usb-net anymore. is there any updated documentation for this?
thanks!