?

Log in

No account? Create an account

Previous Entry | Next Entry

(Also this probably applies to retail HTC Magic / T-Mobile G1 devices.) I am posting this so that someone else can find this without the massive amount of searching I had to do to get this to work. First of all, you should not use the udev rule that is floating around. udev is the wrong way to go about this; I've been using this method for nearly six months and its flaky and insecure. I decided to finally figure out how to do this correctly and that it what follows.

Create the following file as /etc/hal/fdi/policy/android.fdi:

<match key="usb_device.vendor_id" int="0x0bb4">
  <match key="usb_device.product_id" int_outof="0x0c01;0x0c02">
    <merge key="pda.platform" type="string">android</merge>
    <append key="info.capabilities" type="strlist">access_control</append>
    <merge key="access_control.file" type="copy_property">linux.device_file</merge>
    <merge key="access_control.type" type="string">pda</merge>
  </match>
</match>

hal's inotify support should magically discover it and the next time you plug in your phone, it will become ACL controlled. The output of ls -lR /dev/bus/usb/003 shows a "+" that indicates that an ACL is on the device node:

/dev/bus/usb/003/:
total 0
crw-rw-r--  1 root root 189, 256 2009-06-05 16:35 001
crw-rw-r--+ 1 root root 189, 257 2009-06-05 16:37 002

And now your adb command should just work and only for the currently logged in users. You can tweak the people who get access to pda devices using polkit-gnome-authorization and browsing to org.freedesktop.hal.device-access Directly access PDA devices.

You should note that as of the very moment of this writing this is all getting moved in to DeviceKit, though I suspect this hal method will continue to work for a few more years on most distributions.

Update 2009-07-06: All of this is broken on the latest versions of various parts as hal is in the process of being aggressively purged from the newest distros. The new, officially blessed method is to use udev-acl support which grants access to anyone who is in the ConsoleKit database at the time that the phone is attached to the computer. udev-acl was just moved to udev proper from a seperate module that was called udev-extras (now deprecated). So, you need at least udev-144 and the latest ConsoleKit to get this new method to work. I will update again once I have the new rules.

Comments

( 3 comments — Leave a comment )
(Anonymous)
Sep. 27th, 2009 02:49 pm (UTC)
Wrong directory?
On Ubuntu 9.04 I get an ACL on the device only the first time I attach the ADP1. When I attach the ADP1 a second or third time without an intervening reboot there's no ACL.

I had to resort to running ADB as super-user or change the owner of the ADB command to root and set the set-user-id on the file.

After some investigation into HAL I tried sticking the android.fdi file into the /etc/hal/fdi/information directory instead. Now I get an ACL on the device when I attach the ADP1, every time.

(Anonymous)
Nov. 4th, 2009 05:58 am (UTC)
polkit-gnome-authorization REMOVED from Ubuntu 9.10
It seems that upgrading to Ubuntu 9.10 / Karmic Koala sees the polkit-gnome-authorization GUI removed from the system. There doesn't appear to be any way to change these authorisations. I'm still Googling, but the upgrade to Ubuntu 9.10 broke my access to my Android phone. It sees it in ddms....but won't let me access it. The device ID is just "??????"
(Anonymous)
Nov. 4th, 2009 04:07 pm (UTC)
Works on Fedora 11 with Samsung Galaxy
I added galaxy.fdi in /etc/hal/fdi/information/
Containing http://www.swedroid.se/forum/showpost.php?p=32471&postcount=10
sudo service haldaemon restart and it works.
However you also need a patched adb binary from here to be able to use the Galaxy:
http://floe.butterbrot.org/external/adb.gz
Now everything works for me on Fedora 11.
( 3 comments — Leave a comment )

Profile

color, uphair, smile
jasondclinton
Jason D. Clinton

Latest Month

September 2011
S M T W T F S
    123
45678910
11121314151617
18192021222324
252627282930 

Tags

Powered by LiveJournal.com
Designed by Tiffany Chow