28 January 2011

HTC G1 adb "No Permissions"

Update:  After I wrote this post, I had the No permissions and a device name of ???????? all over again.  After spending yet more time on this, I found that the key is to kill and restart the server as root (sudo).  See commands at end of this post.

--------------------------------------------------------
I bought a used HTC G1 from eBay so I could prototype a droid interface to a custom sensor.  I didn't want to brick my daily use DroidX and heard that the G1 had a pretty decent serial interface ability.

I paid a little more than I wanted but those suckers are selling for about $125 which ain't bad (for the seller) for a 2+ year old phone.  After a week or so of bidding, I ended up with a decent condition phone for $83 including shipping.

The phone is locked to T-Mobile and has no sim card but that's okay because I plan to use this as wifi only.  Unfortunately I haven't been able to run the Android Debug Bridge (adb) or use the Android Development Tools (ADT) plugin for Eclipse.

At first I thought my problem with getting the adb "no permission error" was because my phone wasn't activated.



I read thru a few links on how to activate a no sim card phone and decided that it wasn't the issue and needed to keep investigating other causes.

Squirrel.  Before I go into a little more detail, let me share a quick story.  My shiny used G1  didn't come with a USB cable so I bought a cable (also from eBay) for about $1.78 including shipping.  Unfortunately for that screaming deal, it was being shipped from a country far far away.  A few days after I paid (mid January), I received this email:

"we have sent the item you ordered from us today.It would take you 25-35
working days to get it.because of near merry christmas,at the airport were
plied so many package ,plane is not ebough ,every package are slow,hopey
you can understanding ,If you haven't got it within 35 days,please let me
know.,And"

And a week later, my package arrived.  That was a fast 35 days, I guess they found "ebough" planes ...  But the cable didn't work.  I looked at the auction again to make sure that it said it was for a G1.  Sure enough, it states:


USB Sync Data Cord Cable For GOOGLE HTC G1 Android

But in small print, says:


Compatible with: HTC G1(not include the cell phone)

Ok, so what's an HTC G1 that's not a cell phone?


I wasn't going to even waste my time for $1.78 to contact the seller, chalk it up as another buyer beware.


But I did what I should've done next.  Use my leftover unused Blackberry cable.  Fits perfect, charge light goes on and I can mount the G1's SD card. 

Back to the main story.

Besides the "no permissions" error with adb, I can't communicate via the Eclipse plug-in. 




I checked the devices android version to make sure that I had the corresponding SDK platform revision, which I did.

Mr Google yielded some ideas.  One hit suggested that I use sudo with adb.  I don't think that'll help but sure let's try.



Then came across a useful hit Using ADB in Linux that describes that we need to create a file to change permissions and ownership of a device node.  Here's how:

  • Create a file /etc/udev/rules.d/50-android.rules with this command:
sudo gedit /etc/udev/rules.d/51-android.rules
  •  Type in the contents of the file.  The version of linux may cause the syntax to differ slightly.  I'm using Ubuntu 11.04 Natty Narwhal and my contents are in the pic below.


    I've also seen instructions to use this:


    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c01″, MODE=”0666″  

    Note the diff between what I used SUBSYSTEM vs SUBSYSTEMS and ATTRS


    Here's an interesting read on Writing udev Rules.
  •  Change permissions of the file
sudo chmod a+r /etc/udev/rules.d/51-android.rules
  • Restart udev
    sudo restart udev
  • Stop and restart adb
sudo ./adb kill-server
sudo ./adb start-server
  • List the devices

Sweet!


What do you think? Leave a comment.

No comments: