USB hotplug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB hotplug

905 Views
yuhundehao
Contributor III

我有个问题 我用的是ixm6q 文件系统支持优盘连接上后,拷贝和存储数据到优盘或者板子拔掉优盘数据不能保存

我自己做了个udev规则:

  

ACTION !="add",GOTO="farsight"
KERNEL=="sd[a-z][0-9]",RUN +="/sbin/mount-usb.sh %k"
LABEL="farsight"

ACTION !="remove",GOTO="farsight"
SUBSYSTEM !="block",GOTO="farsight"
KERNEL=="sd[a-z][0-9]",RUN +="/sbin/umount-usb.sh"
LABEL="farsight"

mount-usb.sh

#!/bin/sh
! test -d "/media/sda1" && mkdir -p "/media/sda1"
/bin/mount -t vfat /dev/$1 /media/sda1
sync

umount-usb.sh 
#!/bin/bash
sync
umount /media/sda1
cd /media
rm -rf sda1

但是在sync后拔掉优盘还是不能拷贝到优盘里的数据还是没有保存 rn -rf sda1都已经执行了

Labels (2)
0 Kudos
Reply
1 Reply

765 Views
igorpadykov
NXP Employee
NXP Employee

Hi yuhundehao

was bsp used in the case, please try with demo images from nxp official i.mx software link

http://www.nxp.com/webapp/Download?colCode=L4.1.15_2.0.0_MX6QDLSOLO&appType=license&location=null&Pa... 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply