Skip to content

Instantly share code, notes, and snippets.

@ktnr74
Created July 19, 2018 16:03
Show Gist options
  • Save ktnr74/f749a4bc2aa13b190b46a8643d1b465d to your computer and use it in GitHub Desktop.
Save ktnr74/f749a4bc2aa13b190b46a8643d1b465d to your computer and use it in GitHub Desktop.
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