Android ADB udev

This page gives the main steps in setting up a udev rule to bridge ports to/from your android phone using ADB.

= The Script = The script is called by udev and actually makes the bridge. You will need to adjust your path for adb on the bottom line. Name it /opt/google/phone_forward.sh

/opt/google/android-sdk/platform-tools/adb forward tcp:8080 tcp:8080 notify-send "HTC Desire Connected" "ADB was launched via UDEV" --icon "/usr/share/pixmaps/pidgin/emotes/default/phone.png"
 * 1) !/bin/bash
 * 2) Script to link ADB with my phone, to be called from udev.
 * 3) George Smart, M1GEO. 03/Oct/2011.
 * 1) Notifications requre "libnotify-bin" from repos.  Not Working Yet.

You will need to make it executable; sudo chmod a+x /opt/google/phone_forward.sh

= The udev Rule = We then made udev call this script whenever the phone is plugged in. This link shows you how to run external programs from udev rules. This link shows the vendor IDs, etc, for various phones.

The udev rule is as follows. Name it /etc/udev/rules.d/android_phone_adb.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" RUN+="/opt/google/phone_forward.sh"