linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: USB card reader media detection
Date: Fri, 01 Apr 2005 14:40:11 +0000	[thread overview]
Message-ID: <1112366412.5681.16.camel@localhost.localdomain> (raw)
In-Reply-To: <000701c536af$9e5e8b20$f601a8c0@SenatorPalmer>

On Fri, 2005-04-01 at 12:40 +0100, Andrew Marshall wrote:
> 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.

> 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 don't remember the old 2.4 kernels, but I can't imagine how the kernel
could detect this.

> 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)...

Just poll continuously the main block device, which causes a re-read of
the partition table with every open(). There is no other way to do that.
Card-readers don't tell the kernel, if a media change happened.

Kay



-------------------------------------------------------
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

  reply	other threads:[~2005-04-01 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01 11:40 USB card reader media detection Andrew Marshall
2005-04-01 14:40 ` Kay Sievers [this message]
2005-04-05 17:51 ` Greg KH
2005-04-06 11:06 ` Andrew Marshall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1112366412.5681.16.camel@localhost.localdomain \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).