00101010

My blog on life the universe and everything…

How to configure HTC Desire HD for Android development on Gnu/Linux

[UPDATE 26-1-2011] I had to setup my Android phone to be used for development on another machine today, but although I followed the exact same steps that I describe in the post below (which have worked in the past),this time I was still getting

List of devices attached
???????????    insufficient permissions

when running ‘adb devices’ in the terminal. The solution it seems is to run ‘adb kill-server’ and ‘adb start-server’ as root. Then my device was sucessfuly recognized. Hope this helps anyone stuck in the same situation

——————————————————————————————————————

I’ve just recently received my new HTC Desire HD (DHD) and naturally I’m gonna be doing all my development on it from now on. The first time I tried to install one of my apps using [adb] on the DHD I got the notorious permissions error [error: insufficient permissions for device]. Here’s a detailed step-by-step guide to fix this for the DHD (works with other Android devices too).

1. Plug in the device 🙂

2. fire up a terminal and type [lsusb] (without the square brackets)

You should see something like the following:

Bus 002 Device 003: ID 046d:c00e Logitech, Inc. M-BJ58/M-BJ69 Optical Wheel Mouse
Bus 002 Device 002: ID 046d:c316 Logitech, Inc. HID-Compliant Keyboard
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 019: ID 0bb4:0ca2 High Tech Computer Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Your list will be different depending on the usb devices that you have plugged in on your PC at the time. The one line that you should see and that is important here is the one that says “Hight Tech Computer Corp” aka HTC! The part we are interested in is higlhighted in red. Keep this in mind and move to the next step.

3. Create a file with your favorite editor under /etc/udev/rules.d called 51-android.rules (so you’ll have /etc/udev/rules.d/51-android.rules)

4. Add the following line in that file

SUBSYSTEM==”usb”, ATTRS{idVendor}==”0bb4“, ATTRS{idProduct}==”0ca2“, MODE=”0666″ OWNER=”username

Notice the red highlighted parts? Those are taken from the listing that we got when we executed [lsbusb] on the terminal. For other android devices these should be filled in accordingly. Finally replace your username in the OWNER field and save the file.

5. Make sure the file is executable by typing [chmod a+rx 51-android.rules] in the terminal

6. If you have used root priviliges to create/edit the file under /etc/udev/rules.d you might need to change the owner and the group of the file to make sure that you can execute it from your normal user account. Run the following two commands in a terminal in that case

sudo chown username 51-android.rules

sudo chgrp username 51-android.rules

7. finally restart the udev service by typing [service udev restart] or [/etc/init.d/udev restart]. Will need root privileges to do that

8. run [adb devices] on the terminal to see your device name. If you see something like this

List of devices attached
HTXXXXXXXX    device

then it worked!. If you see something like this

List of devices attached
???????????    insufficient permissions

then something is still wrong and you might want to re-iterate over the steps above

Hope this helped someone out there in androidsphere!

4 responses to “How to configure HTC Desire HD for Android development on Gnu/Linux

  1. Alvar November 13, 2010 at 2:41 pm

    Hello, thanks for the howto. do i need specific drivers to use adb with dhd under linux?

    get some

    alvarhanso@alvarhanso:~$ adb devices
    List of devices attached
    ???????????? no permissions

    alvarhanso@alvarhanso:~$ adb kill-server
    alvarhanso@alvarhanso:~$ adb start-server
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    alvarhanso@alvarhanso:~$ adb devices
    List of devices attached
    ???????????? no permissions
    alvarhanso@alvarhanso:~$ adb devices
    List of devices attached
    ???????????? no permissions

    but really did every step exactly on the same way. controlled it several times.😦

    • serk01 November 30, 2010 at 12:43 pm

      I don’t think you need any specific drivers. I have never had to install any myself anyway. what gnu/linux distro are you using?

  2. KaHa6uc May 4, 2011 at 3:23 pm

    You need to issue the
    adb start-server
    command as root. If you see the “???????? no permissions” line, this means that the drivers are working.

  3. Joe October 24, 2011 at 9:04 pm

    I’m running mageia/mandrake and I have to agree with the original post. If you try run adb as a user, you seem to run into firewalls and blocking which does not happen with root. First time you run adb, it has to be run as root.

ξεφόρτωσε εδω

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: