in android · debian · spica · tethering · usb

Connect your computer to the Internet doing USB Tethering with Android.

USB Tether Android with Linux

What we need is the application for Android: AziLink app, the “adb” program from the Android SDK, and OpenVPN. With this method “root” is not needed on the phone.

Install openvpn.

# apt-get install openvpn 

Install the Android SDK to get the adb program.

# cd /usr/local/
# wget http://dl.google.com/android/android-sdk_r10-linux_x86.tgz
# tar xzvf android-sdk_r10-linux_86.tgz
# ln -s android-sdk-linux_86/tools/adb /usr/local/bin/

Notify udev of the USB vendor ID of the phone. This is done by creating a udev rules file. Change USERNAME for your user name.

You can find out the USB vendor ID of your phone by typing “lsusb” once you have connected the phone with the USB cable. In the case of the Spica it is “04e8”

/etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"
# /etc/init.d/udev restart

Enable “USB debugging” on the phone in the menu Settings -> Applications -> Development -> USB debugging . Now connect the USB cable.

Check that the phone has been recognised

$ adb devices

Install AziLink on the phone through adb:

# cd /usr/local/bin/
# wget http://azilink.googlecode.com/files/azilink-2.0.2.apk
# wget http://azilink.googlecode.com/files/azilink.ovpn
# adb install -r azilink-2.0.2.apk

Create a dns configuration for the connection.

/etc/resolv.conf.azilink

domain lan
search lan
nameserver 192.168.56.1

Create a shell script to start adb and openvpn.

/usr/local/bin/azilink.sh

adb forward tcp:41927 tcp:41927
sudo cp /etc/resolv.conf.azilink /etc/resolv.conf
sudo openvpn --config /usr/local/bin/azilink.ovpn

Make the script executable:

# chmod +x /usr/local/bin/azilink.sh

Give sudo access to your user by adding the following line in /etc/sudoers, replacing USERNAME with your login.

USERNAME     ALL=(ALL)       ALL

After all this, you only have to disconnect any other cable or wifi connection the computer might have and start Azilink on the phone. Run azilink.sh on the computer with your usual user.

Source: http://idolinux.blogspot.com/2010/06/usb-tether-android-with-linux.html