linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitri <dmitri@users.sourceforge.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: Which node has the device been bound to?
Date: Fri, 31 May 2002 17:12:46 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-102286520315105@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-102266789207618@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 2103 bytes --]

On Sun, 2002-06-02 at 08:21, Oliver Neukum wrote:
> Am Mittwoch, 29. Mai 2002 12:23 schrieb Kim Deokhwan:
> > Within a USB policy agent script, can we tell precisely which node the
> > device has been bound to?  According to
> > Documentation/usb/usb-serial.txt:
> >
> >   When the device is connected and recognized by the driver, the driver
> >   will print to the system log, which node(s) the device has been bound
> >   to.
> >
> > But the log message is too succint:
> >
> >   May 27 10:51:11 localhost kernel: usbserial.c: Compaq iPAQ converter
> >   now attached to ttyUSB0 (or usb/tts/0 for devfs)
> >
> > In case of one iPAQ, we can find the relevant log entry by grepping the
> > LAST matched line.  But if two iPAQs are attached nearly at the same
> > time, the last matched line may not be the relevant entry because
> > context switching may happen between two agent scripts.
> >
> > Do you have any method that can solve it?
> 
> At present I am afraid not.
> This is just the tip of the iceberg. Basically, even if you had that
> type of information, you cannot be sure that it stays valid
> while the script is running.

You need to tell the difference between the hardware devices, and you
need to know which identified device uses which device node.

Both can be done if the serial driver creates its own /proc/xxx entries.
It is quite simple, and can be easily added. Some webcams, for example,
offer this functionality for their own purposes. This will work on 2.4
kernel. The driver would, for example, create a text "file" (generated
with a callback within the driver), and each line of text would contain
serial number of the device (or hash of its descriptors) and the device
node ID.

Synchronization is, of course, a concern, since devices can be unplugged
and replugged, but if you read the file immediately before opening the
device it should be reasonably OK - users are not *that* fast ;-) You
can also reread the file after opening the device and verify that it
hasn't changed while you were blocked on open() call.

Dmitri


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2002-05-31 17:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-29 10:23 Which node has the device been bound to? Kim Deokhwan
2002-05-31 16:53 ` Oliver Neukum
2002-05-31 17:12 ` Dmitri [this message]
2002-05-31 18:26 ` Greg KH
2002-06-01  0:05 ` Oliver Neukum
2002-06-01  0:21 ` Greg KH
2002-06-01  1:14 ` Oliver Neukum
2002-06-03 18:00 ` Greg KH
2002-06-03 21:09 ` Oliver Neukum
2002-06-03 21:58 ` Greg KH
2002-06-03 22:43 ` Oliver Neukum
2002-06-03 22:46 ` Greg KH
2002-06-03 23:05 ` Oliver Neukum
2002-06-03 23:16 ` Greg KH
2002-06-03 23:37 ` Oliver Neukum
2002-06-03 23:50 ` Greg KH
2002-06-04 19:00 ` David Brownell

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=marc-linux-hotplug-102286520315105@msgid-missing \
    --to=dmitri@users.sourceforge.net \
    --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).