USB Device mode, filesystem and inotify
by misteroy from LinuxQuestions.org on (#5T7X6)
I'm looking a solution for being notified about files and directories modifications using inotify or any other API when the files are located on a file-system on a custom board which is configured as a USB device. My Linux is buildroot and deployed on a custom board. I've connected the board to a Host machine running Ubuntu. After creating the file-system on the board I can copy files into the target board with no problems. What I would like to achieve is to get notifications about changes in files and directories on the Linux OS running on the board where the file-system is located. For example is someone is copying a txt file from the Ubuntu host into the mounted directory I will get a notification on the target board.
What I've been able to do so far is to be notified that a change on the file-system has occurred but could not achieve a specific notification about exactly what has changed. This is how I've accomplished that:
On the target board I've created a file based file-system using:
Code:dd if=/dev/zero of=/tmp/test bs=1M count=500Then I created a file based file system out of it:
Code:mkdosfs /tmp/testThen I then started to listen to file-system events (on the the target board) with:
Code:inotifywait /tmp/testThen I copied a foo.txt file onto the mounted directory on the Ubuntu Host side.
I then received a notification (on the target board) that /tmp/test has been modified.
What I want to achieve is to get a notification about foo.txt on the board. I have no problem if the final solution would be to get notifications about a predefined directory on the mounted file-system if that would be easier.
Is there any way to achieve what I'm asking?
Thanks!
What I've been able to do so far is to be notified that a change on the file-system has occurred but could not achieve a specific notification about exactly what has changed. This is how I've accomplished that:
On the target board I've created a file based file-system using:
Code:dd if=/dev/zero of=/tmp/test bs=1M count=500Then I created a file based file system out of it:
Code:mkdosfs /tmp/testThen I then started to listen to file-system events (on the the target board) with:
Code:inotifywait /tmp/testThen I copied a foo.txt file onto the mounted directory on the Ubuntu Host side.
I then received a notification (on the target board) that /tmp/test has been modified.
What I want to achieve is to get a notification about foo.txt on the board. I have no problem if the final solution would be to get notifications about a predefined directory on the mounted file-system if that would be easier.
Is there any way to achieve what I'm asking?
Thanks!