maandag 21 december 2009

udev rules needed for your android device

This blogpost will contain the udev-rules needed for making adb work.

This information is partly copied from here. I've posted it here because that source wasn't available anymore, and it was for htc-devices only.

To add the rules file you must do the following steps:

1. Login as root and create this file: /etc/udev/rules.d/50-android.rules.
   For Gusty/Hardy/Intrepid/Jaunty/Karmic, edit the file to read:
     SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
   For Dapper and earlier, edit the file to read:
     SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
2. Now execute:
   chmod a+rx /etc/udev/rules.d/50-android.rules
3. And make the rule active by restarting udev:
   sudo /etc/init.d/udev restart

It is important to note that this only works for HTC-devices. However you can make it work for any device. You'll just have to change the value of SYSFS{idVendor} into another value (read further).

You can obtain the value of SYSFS{idVendor} by connecting your device via usb and launching the command lsusb:
an example output:

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
Bus 001 Device 003: ID 0bb4:0c02 High Tech Computer Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

As you can see this is for a HTC (High Tech Computer Corp.) Device. And you can read the id of the vendor after ID and before the colon. So if you have another device, just use the id printed out. This by putting it in the quotes, instead of 0bb4 in /etc/udev/rules.d/50-android.rules.