Skip to content

Instantly share code, notes, and snippets.

@antage
Created October 4, 2012 18:32
Show Gist options
  • Save antage/3835493 to your computer and use it in GitHub Desktop.
Save antage/3835493 to your computer and use it in GitHub Desktop.
Automount Google Nexus 7 via udev & mtpfs
# Google Nexus 7 16 Gb
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e41", MODE="0777" # MTP media (multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0777" # MTP media with USB debug on(multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e43", MODE="0777" # PTP media (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e44", MODE="0777" # PTP media with USB debug on (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0777" # Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d001", MODE="0777" # Recovery
# Google Nexus 7 MTP mode : automatic umount & mount when plugged
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/bin/umount /media/nexus7"
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/usr/bin/sudo /usr/bin/mtpfs -o allow_other /media/nexus7"
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e42", ACTION=="add", RUN+="/bin/umount /media/nexus7"
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e42", ACTION=="add", RUN+="/usr/bin/sudo /usr/bin/mtpfs -o allow_other /media/nexus7"
# Google Nexus 7 MTP mode : automatic unmount when unplugged
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e41", ACTION=="remove", RUN+="/bin/umount /media/nexus7"
ENV{ID_MODEL}=="Nexus", ENV{ID_MODEL_ID}=="4e42", ACTION=="remove", RUN+="/bin/umount /media/nexus7"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment