From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Marshall Date: Fri, 01 Apr 2005 11:40:34 +0000 Subject: USB card reader media detection Message-Id: <000701c536af$9e5e8b20$f601a8c0@SenatorPalmer> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Hi all, I would very much appreciate any assistance anyone can offer on the following: I am currently running version 2.4.22 of the Kernel and am writing an application that needs to cope with the removal of card media form a USB flash card reader. Hotplug informs me when the card reader itself is added with my intention being to scan for partition entries at the newly created dev/scsi entry e.g /dev/scsi/host0/bus0/target0/lun0/part1 and mount any partitions detected. This works fine -- but I also need to detect when a memory card has been removed. I have found that the block device file (part1) corresponding to my flash card's partition is appropriately updated (i.e removed from /dev/scsi/host0/bus0/target0/lun0/ when the test card is removed) -- but only if the partition is *not* currently mounted! I found that once I have mounted the partition, the devfs 'part1' block device perpetually remains -- even when the card is removed, thus making removal detection a tad tricky. OK, it seems to be possible to unmount the partition, poll the /dev/scsi/host0/bus0/target0/lun0 entry and then remount once the poller has determined that the partition is still present -- but this takes time... And also seems a little extreme (if not ridiculous)... Does anyone have any ideas on a fix or alternative way to determine removal of a flash card from a connected flash card reader. Any suggestions on this problem would be greatly appreciated. Many thanks! Andrew Marshall ------------------------------------------------------- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/info/Sentarus/hamr30 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel