问题: 频繁插拔tf卡,需要插拔usb数据线或者输入otg主从切换命令。 解决方法: 1 修改/etc/udev/rules.d/automount.rules # Media automounting SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" SUBSYSTEM=="block", ACTION=="change", ENV{DISK_MEDIA_CHANGE}=="1" RUN+="/etc/udev/scripts/mount.sh" SUBSYSTEM=="block", KERNEL=="mmcblk1", ACTION=="add" RUN+="/etc/udev/scripts/1.sh" SUBSYSTEM=="block", KERNEL=="mmcblk1", ACTION=="remove" RUN+="/etc/udev/scripts/2.sh" 2 添加/etc/udev/scripts/1.sh #!/bin/bash modprobe g_mass_storage file=/dev/mmcblk1 luns=1 stall=0 removable=1 & echo host > /sys/devices/platform/fe8a0000.usb2-phy/otg_mode & echo peripheral > /sys/devices/platform/fe8a0000.usb2-phy/otg_mode & 3 添加/etc/udev/scripts/2.sh #!/bin/bash rmmod g_mass_storage 4 执行chmod +x /etc/udev/scripts/1.sh chmod +x /etc/udev/scripts/2.sh 5 插入TF卡电脑端会自动显示盘符,弹出TF卡需要先在电脑端弹出,再拔出TF卡。 |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-16 15:01
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.