Saturday, April 27, 2013

Universal udev rule for all Android devices

When an Android device is plugged in to a linux system, by default only root has access to the device. In order for regular users to be able to access the device - the device permissions need to be changed. To automate this, Google recommends  adding Vendor ID of every Android device as a separate line per ID.
I thought that there has to be a better way to do it. Here is the rule I came up with:

ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:ff420?:*", MODE="0666"

This rule matches all adb and fastboot interfaces for any android device, no matter the Vendor ID.

No comments:

Post a Comment