[ Prev ] [ Index ] [ Next ]

adb

Created Sat 30/4/2011

The android debug bridge (adb) is used to control operations (list devices, push/pull content to devices) against an attached android device.

1. define udev usb driver rules

Need to define udev rules for the device (or run adb server as root, which is the less preferred option) otherwise performing adb operations will result in "error: insufficient permissions for device".

Replace the idVendor values with the relevant values for the device being attached (e.g., HTC=0bb4, Motorola=22b8, see developer.android.com Gude:Device)

Create a new file in the udev rules directory (e.g., /etc/udev/rules.d/99-android.rules)

bash #  cat << EOF > /etc/udev/rules.d/99-android.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", SYMLINK+="android_adb", MODE="0666" GROUP="mock"
EOF

Next, reload the new udev rules with:

bash # udevadm control --reload-rules 

See comments by rajeevvp in forum.xda-developers.com

2. Start ADB Server

Note: Be sure to define the udev usb rules (see #2)

    bash $ adb kill-server
    bash $ adb start-server
    bash $ adb devices
    List of devices attached 
    HT136R300158    device

2. Push/Pull content to sdcard

Sending content to the sdcard can be done with the push and pull adb commands. The sdcard is mounted to /sdcard so to write a file to the root of an sdcard


bash $ adb push some-flash.zip /sdcard/update.zip
bash $ adb pull /sdcard/update.zip foo.zip

3. ADB Port-fowarding

Telnet into device via a dynamically run adb shell. This provides command line editing, full-screen apps like less and vim and, on exit, everything is shut down cleanly. A version of busybox which has the telnetd applet compiled into it is required. Either install JRummy16's "BusyBox Installer" from the Market and select v1.19 (the beta version) or compile busybox from source.

bash $ adb -d forward tcp:4444 tcp:23
bash $ adb -d shell 'exec /system/xbin/telnetd -F -b 127.0.0.1 -l /system/xbin/ash' &
bash $ sleep 1
bash $ telnet localhost 4444
bash $ adb kill-server

4. See Also

Stuart Moorfoot © 30 April 2011 foo@bund.com.au


Backlinks: android htc desire