Wednesday, December 23, 2009

Android debug bridge on ubuntu 9.10

It turns out the latest Ubuntu release makes it a bit more difficult to connect the multi purpose Android debug bridge to your Android device. The following is really just an update of my older entry, to remind myself of the changes in Ubuntu 9.10. This stuff is pieced together from various other sources online (mostly android-discuss) and thus not particularly original.

Ok so first of all, there are quite a few more vendors and devices now (yay). In order to identify your device, make sure your device is not connected and then execute the Linux command lsusb.


casper@workstation:~$ lsusb
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 07cc:0501 Carry Computer Eng., Co., Ltd Mass Storage
Bus 001 Device 002: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 046d:c51a Logitech, Inc. MX Revolution/G7 Cordless Mouse
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


Now connect the device and make sure USB debugging is enabled, and run the command again. You should have one more line:


casper@workstation:~$ lsusb
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 016: ID 0bb4:0c02 High Tech Computer Corp.
Bus 001 Device 004: ID 07cc:0501 Carry Computer Eng., Co., Ltd Mass Storage
Bus 001 Device 002: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 046d:c51a Logitech, Inc. MX Revolution/G7 Cordless Mouse
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub



So now we learned that HTC stands for High Tech Computer. :) We then need to install the rule for the device, by creating a file under /etc/udev/


gksudo gedit /etc/udev/rules.d/51.android.rules


Enter the following, but adjust vendor id and product ID according to what you just found out in the previous step. The device entry below will likely only work if you also happen to have an HTC Magic/Saphire A6161/Nordic (32a).


SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c01", MODE="0666"


Make sure everyone can access and execute it:


sudo chmod a+rx /etc/udev/rules.d/51.android.rules


Now reload the udev service:


sudo service udev reload


Now you are ready to start the adb service. Note that due to a change/bug in the security policies of Ubuntu 9.10, you won't have access to the device unless you execute adb (or rather, the adb service) as a super user. This is mildly annoying:


casper@workstation:~/development/android-sdk-linux/tools$ adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
???????????? no permissions


Instead what you will have to do is start the server manually in super user mode (make sure to kill any existing server first, with sudo adb kill-server):


casper@workstation:~/development/android-sdk-linux/tools$ sudo ./adb start-server
* daemon not running. starting it now *
* daemon started successfully *


And now you may use adb as per usual:


casper@workstation:~/development/android-sdk-linux/tools$ adb devices
List of devices attached
HT95PKF00221 device


Not really groundbreaking stuff, but I thought it might be useful and save time for others running Ubuntu 9.10 and wanting to get ADB up and running.


Update
The Nexus One, Google's latest Android beast, appears to be identified as 18d1:4e11 but without any vendor string. Interesting since the Nexus One is also hardware produced by HTC. However using adb, it will list with serialid: HT9CRP805273 so HTC is not entirely hidden. It appears that internally the phone is referenced as the Passion and/or Mahimahi.

Post a Comment