All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Phil Endecott" <phil_joqdm_endecott@chezphil.org>
To: linux-scsi@vger.kernel.org
Subject: Signal when device is disconnected
Date: Wed, 13 May 2009 18:49:05 +0100	[thread overview]
Message-ID: <1242236945846@dmwebmail.dmwebmail.chezphil.org> (raw)

Dear Experts,

The proc/bus/usb API has an ioctl that can arrange for the application 
to receive a signal when the device is disconnected.  Is there anything 
similar for the SCSI generic (or other SCSI) APIs?

Assuming that there isn't, I think I need to either poll the device to 
see if it's still there, or listen on a netlink socket for a removal 
uevent, or I need to find the USB device corresponding to the sg device 
that I'm using and use its signal-on-removal ioctl.  In the latter 
case, is there a way to traverse from an sg device's /sys directory to 
the corresponding usb device's /sys directory?  /sys seems to be full 
of symlinks but I can't find the one that I need in this case.

Basically I have a fairly simple user-space driver for a USB SCSI 
device that uses the SCSI-generic API, and I want it to terminate 
tidily when the device is detached.

Many thanks for any advice.


Phil.

(Please Cc: me in any replies.)




             reply	other threads:[~2009-05-13 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13 17:49 Phil Endecott [this message]
2009-05-13 20:08 ` Signal when device is disconnected Douglas Gilbert

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=1242236945846@dmwebmail.dmwebmail.chezphil.org \
    --to=phil_joqdm_endecott@chezphil.org \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.