linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: USB hotplug
Date: Tue, 06 Nov 2007 22:16:55 +0000	[thread overview]
Message-ID: <20071106221655.GA29308@kroah.com> (raw)
In-Reply-To: <58b503a50711052120o40a04dedk2ae53887a80c71ec@mail.gmail.com>

On Mon, Nov 05, 2007 at 09:20:04PM -0800, Tom wrote:
> I'm trying to make sure that I fully understand how the uevents sent
> to userspace from the kernel occur when a device is hotplugged.
> 
> When looking through the drivers/usb/usb-skeleton.c driver, the init
> function calls usb_register(), which eventually leads to
> kobject_uevent(.., KOBJ_ADD) being called. However, this is just
> called when the driver is loaded, and not when a device is hotplugged,
> correct?

No, you also get a hotplug call when the device is added to the system.

Run udevmonitor and plug in a device and see all of the events that you
get, and which order they come in.

> There is also a call in drivers/usb/usb-skeleton.c probe() to
> usb_register_dev(). My understanding is that probe() gets called when
> the USB core thinks it has a device that the driver can handle.

Yes.

> Is this the point at which the uevent needs to be sent to notify
> userspace that a device has been hotplugged? (e.g.,
> video_register_device ends up triggering a kobject_uevent call when
> probe is called. However, I don't see usb_register_dev() resulting in
> kobject_uevent being called.)

It happens in device_create().

thanks,

greg k-h

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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:[~2007-11-06 22:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-06  5:20 USB hotplug Tom
2007-11-06 22:16 ` Greg KH [this message]

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=20071106221655.GA29308@kroah.com \
    --to=greg@kroah.com \
    --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).