Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Auto mount SD Card and USB Thumb drives on AT91SAM9261(EK)
PostPosted: Tue Jan 01, 2008 7:06 am 
Offline

Joined: Wed Jul 04, 2007 8:01 am
Posts: 37
Hi,

Anyone has worked on auto mounting SD card (when inserted and removed) and/or auto mounting of USB thumbdrive (when inserted or removed without any command line entry) ?

I have made a custom AT91SAM9261 board with similar connections as that of the EK board. One main difference is an additional I/O pin as the Card detect pin for SD.

The SD card insertion and removal are detected correctly (through debug console output). However, I do not know how to make it auto mount.

In an actual Linux product, the debug console is not available and everything must be transparent to the user and hence auto mounting for USB thumbdrives and SD card are essential.

Appreciate any advise/help on the above.

Thanks in advance.

Sim CK


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 04, 2008 9:54 am 
Offline

Joined: Thu Aug 09, 2007 10:48 am
Posts: 106
Location: Artec Design LLC, Tallinn, Estonia
Well... unmounting the file system after it has been unplugged does not make sense anymore.
On our devices, the media is kept always unmounted and mounted only on file access. This keeps the mounted time minimal and so the threat of getting FAT messed up is minimal.
You can also mount stuff synchronously, then all I/O is done without caching.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 04, 2008 3:07 pm 
Offline

Joined: Wed Jul 04, 2007 8:01 am
Posts: 37
Hi AntiSullin,

Really appreciate your response.

For auto-mounting, I am not familiar with hotplug scripts and hotplug itself.

Are you able to provide a sample script (for mounting USB thumbdrives) and the steps in getting hotplug to auto-mount devices ?

Thanks in advance.

Sim CK


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 07, 2008 11:55 pm 
Offline

Joined: Thu Aug 09, 2007 10:48 am
Posts: 106
Location: Artec Design LLC, Tallinn, Estonia
As I said, automounting is NOT an option, because you'll get unmount event AFTER you should have unmounted and so you just censored your filesystem. So you must unmount it BEFORE the user yanks it out. You can keep it unmounted if it is not used. And mount it as read-only if you are using it for reading only (you can always remount it to rw without unmounting if you still want to do writes too). Keeping the partition mounted for the minimum time is the safest way to go.

So the easiest way is to mount the partition from your application before you open a file from there and unmount it right after.
It is difficult to give wise suggestions if i do not know why and how the usb disk is accessed.

If you really want to use hotplug events, then make a shell script at /sbin/hotplug and make it dumping its environment variables to a temp file. Do a couple of device insertions /removals and see what you've got. Or have a "tail -f filename" running on that temp file to see it on-the-fly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: