Skip to content

Instantly share code, notes, and snippets.

@weedy
Forked from ktnr74/99-android.rules
Created April 6, 2019 06:43
Show Gist options
  • Save weedy/5f7a42e9f34e310127f224bc7006140e to your computer and use it in GitHub Desktop.
Save weedy/5f7a42e9f34e310127f224bc7006140e 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