Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Universal udev rules file to set Android device permissions
# do not forget to run 'sudo udevadm control --reload-rules' after editing this file
ACTION!="add", GOTO="android_usb_rules_end"
SUBSYSTEM!="usb", GOTO="android_usb_rules_end"
ENV{DEVTYPE}!="usb_device", GOTO="android_usb_rules_end"
ENV{ID_SERIAL_SHORT}=="", GOTO="android_empty_serial"
ENV{ID_SERIAL_SHORT}=="0000:*", GOTO="android_empty_serial"
ENV{ID_SERIAL_SHORT}=="0123456789ABCDEF", GOTO="android_empty_serial"
ENV{ID_USB_INTERFACES}=="*ff4201*", SYMLINK+="adb/$env{ID_SERIAL_SHORT}", TAG+="android"
ENV{ID_USB_INTERFACES}=="*ff4203*", SYMLINK+="fastboot/$env{ID_SERIAL_SHORT}", TAG+="android"
GOTO="android_usb_rules_end"
LABEL="android_empty_serial"
ENV{ID_USB_INTERFACES}=="*ff4201*", SYMLINK+="adb/usb:%k", TAG+="android"
ENV{ID_USB_INTERFACES}=="*ff4203*", SYMLINK+="fastboot/usb:%k", TAG+="android"
LABEL="android_usb_rules_end"
# use your preferred way to set device permissions here
TAG=="android", MODE="0666"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.