From: Michael Hamilton <michael@actrix.gen.nz>
To: linux-hotplug@vger.kernel.org
Subject: How to detect whether media is present in a reader?
Date: Wed, 09 Jun 2004 22:57:01 +0000 [thread overview]
Message-ID: <200406101057.01160.michael@actrix.gen.nz> (raw)
In-Reply-To: <200406101053.33097.michael@gentoo.co.nz>
I've attempted to develop a desktop integration script for usb
storage devices. ( http://freshmeat.net/projects/usbmount/ )
Before anyone reading this thinks this a trivial problem,
you should read the requirements/issues detailed at the bottom
of http://users.actrix.co.nz/michael/usbmount.html - many aspects
of the USB/SCSI system make this task much harder than it should
be. I would recommend anyone working on this area to take a look
at my script and see the fun currently involved - and then see
if what they're working on will make life easier.
In the mean time, working with what is available on current
distributions, I'm looking for a solution to one piece of the
puzzle...
I would like to be able to detect whether media is present
in a reader or not (eg Compact Flash Card reader). A small
piece of C for efficiently obtaining the media state would be
good. I would like a solution for both 2.4 and 2.6, but
I'll settle for what I can get. Does anyone have some sample
code?
From looking at what's available I get the impression that
some variant on polling is the only solution for such problems.
Is this really the case - even for USB?
I've looked at supermount and submount - I'm not sure they
offer a better solution than my own attempts thus far -
I don't think they can tackle all of the requirements listed
on my webpage.
I was also playing with sginfo from sg3_utils (
http://www.torque.net/sg/u_index.html ). But this can be
slow, and, in the absence of media, some of the sg3_utils
probes can get stuck in system calls (which requires a
reboot).
If I had a simple/efficient way to poll a device's media
insertion state, I think my script could then fully automate
almost all aspects of desktop integration of usb storage.
Thanks.
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
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
next prev parent reply other threads:[~2004-06-09 22:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-09 22:53 How to detect whether media is present in a reader? Michael Hamilton
2004-06-09 22:57 ` Michael Hamilton [this message]
2004-06-09 23:34 ` Greg KH
2004-06-11 21:01 ` David Zeuthen
2004-06-12 11:39 ` Michael Hamilton
2004-06-12 12:21 ` David Zeuthen
2004-06-14 20:33 ` Greg KH
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=200406101057.01160.michael@actrix.gen.nz \
--to=michael@actrix.gen.nz \
--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).