From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Tue, 06 Nov 2007 22:16:55 +0000 Subject: Re: USB hotplug Message-Id: <20071106221655.GA29308@kroah.com> List-Id: References: <58b503a50711052120o40a04dedk2ae53887a80c71ec@mail.gmail.com> In-Reply-To: <58b503a50711052120o40a04dedk2ae53887a80c71ec@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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