Reverse USB Tethering using a Snapdragon MDP

Wednesday 8/24/11 02:01pm
Posted By Brian Spencer
  • Up0
  • Down0

If you do not already own a Snapdragon Mobile Development Platform (MDP) then you may be missing out! The Snapdragon MDP can help you with application development and optimization for your Android apps, as well as optimizing your apps. You can play around with the source code on Code Aurora Forum and flash your own Android image to the device. You can also create innovative applications that take advantage of features not yet available in commercial devices such as sensors, and quad microphones.

One neat trick you can perform on a Snapdragon MDP is reverse USB tethering. Reverse USB tethering allows the Snapdragon MDP to use a PC’s Internet connection over the USB cord. The toughest part of the process is setting up your PC. For this post I will focus on a Windows machine, but the same process can be performed on a Linux environment for Internet sharing.

First you need to connect your Snapdragon MDP to your PC and ensure you have the adb driver installed. Now you have two options to turn on USB tethering:

  1. On the Snapdragon MDP, go into Settings -> Wireless & networks -> Tethering & portable hotspot -> USB tethering
  2. Issue ‘adb shell "echo 1 > /sys/class/usb_composite/rndis/enable"’ (ONLY on the Snapdragon MDP will this work)

Now, you will need to update the drivers on your PC to recognize the device. First let your PC install the RNDIS driver and then update your android_winusb.inf file to accept the new PID/VID change that will then allow you to issue adb commands while USB tethering is enabled. Most likely the change is to add a ‘&M0#’ (where # is usually 2 or 3) to your existing entry in the inf file.

On your PC go into your Network Connections window and share an active Internet connection with the RNDIS adapter. Once completed in the command line issue “ipconfig” and make note of the IpV4 addr of the RNDIS adapter.

IPv4 Address. . . . . . . . . . . : X.X.X.X

Now you can setup the device to use this connection. Perform the following adb commands replacing X.X.X.X with the value you have from above:

  1. adb shell netcfg usb0 up
  2. adb shell netcfg usb0 dhcp
  3. adb shell route add default gw X.X.X.X dev usb0
  4. adb shell setprop 2
  5. adb shell setprop net.dns1
  6. adb shell setprop net.dns2
  7. adb shell setprop "net.gprs.http-proxy" ""
  8. adb shell setprop net.usb0.dns1
  9. adb shell setprop net.usb0.dns2

Open the Web browser on the device and you should be up and running. If you encounter issues, check to ensure you can ping the host PC over the USB. Issue “adb shell ping X.X.X.X” and check that you get a response back. Again, the most difficult part of this process is setting up your host to share the Internet connection.