20130314

adb setup linux debian based

Get the Android SDK Tools from http://developer.android.com/sdk/index.html

$ mkdir ~/android
$ cd ~/android/
$ wget  http://dl.google.com/android/android-sdk_r21.1-linux.tgz
$ tar xvzf android-sdk_r21.1-linux.tgz


Install the JDK.
$ sudo apt-get install openjdk-6-jdk 


Install the Android SDK Tools and Android SDK platform tools using the android SDK manager
$ ~/android/android-sdk-linux/tools/android
Check Android SDK Tools & Android SDK Platform-tools
Hit the Install ... Button ...

Optionally add the SDK tools and platform-tools directories to your path. ( I assume that you are using bash )
$ cd ~/android/android-sdk-linux/
$ echo "export PATH=${PATH}:$(pwd)/tools:$(pwd)/platform-tools" >> ~/.bashrc
$ source ~/.bashrc


Attach the Android operated device to the USB port and Set udev rules.
$ lsusb
Bus 001 Device 002: ID F000:DAFF Android Device
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
On the example above the Android Device is accessible by the kernel at
/dev/bus/usb/001/002.

Hence, we can see more stuff about it with udevadm using the following command.
 $ udevadm info -a path -n /dev/bus/usb/001/002 

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1d.7/usb1/1-5':
    KERNEL=="1-5"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{configuration}=="Android Device Config 142"
    ATTR{bNumInterfaces}==" 2"
    ATTR{bConfigurationValue}=="1"
    ATTR{bmAttributes}=="80"
    ATTR{bMaxPower}=="500mA"

    ...


The udev rules are put in their own file in /etc/udev/rules.d/. Our udev rule(s) need some distinct attribute(s) (eg: Vendor ID ) to kick on and set the mode-?umask? and group ownership. We may need more than one rule for more than one device.

An example rule seen at http://developer.android.com/tools/device.html
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" 


If you do not feel like scrolling use the following command to get the vendor ID --the first idVendor seen above the device-manufacturer of your android device.
$ udevadm info -a path -n /dev/bus/usb/001/002 |egrep -i "manufac|vendor"
    ATTR{idVendor}=="22b8"
    ATTR{manufacturer}=="Motobrickola "
    ATTRS{idVendor}=="1d69"
    ATTRS{manufacturer}=="Linux 3.2.0-32-generic-pae ehci_hcd"
    ATTRS{vendor}=="0x8086"
    ATTRS{subsystem_vendor}=="0x1028"
From above the Vendor ID of Motobrickola is 22b8.

Adding the Rule.
$ sudo -s
# echo '"SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev"' > /etc/udev/rules.d/09-android.rules
# chmod 755 /etc/udev/rules.d/09-android.rules
# /etc/init.d/udev restart


Check if it works.
# adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
TA19995RGH device



Get shell on the phone.
$ adb shell
$ cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 2 (v6l)
BogoMIPS : 122.77
Features : swp half thumb fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 2
Cache type : write-back
Cache clean : cp15 c7 ops
Cache lockdown : format C
Cache format : Harvard
I size  : 32768
I assoc  : 4
I line length : 32
I sets  : 256
D size  : 32768
D assoc  : 4
D line length : 32
D sets  : 256

Hardware : Morrison
Revision : 0a00
Serial  : 0000000000000000


A few --of the 1 gazillion relative resources-- that do not suck!
http://developer.android.com/tools/device.html





adb setup debian based linux