John Henry Posted June 29, 2020 Posted June 29, 2020 I have move system to emmc, and want to use sdcard to storage videos from camera. So I want to sdcard can automount/umount after hotplug. I have try to use udev to fulfill it. But it seems not work. I add a rules for udev at /etc/udev/rules.d: ACTION=="add",KERNEL=="mmcblk2p1",RUN+="/etc/udev/sdcard_hotplug.sh add /home/opi/Videos/sdcard %k" ACTION=="remove",KERNEL=="mmcblk2p1",RUN+="/etc/udev/sdcard_hotplug.sh remove /home/opi/Videos/sdcard %k" And add a shell file at /etc/udev/sdcard_hotplug.sh #!/bin/bash case $1 in add) mkdir -p $2 mount -t exfat -o iocharset=utf8,rw,sync,umask=0000,dmask=0000,fmask=0000 /dev/$3 $2 ;; remove) umount $2 rm -rf $2 ;; esac Add chmod a+x for it. Test it ok. But udev seems not work! I have use udev monitor to test if remove and insert sdcard can generate event. It works. And use udevadm test, and it also ok. Anybody can help me?
Recommended Posts