From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sat, 16 Oct 2004 02:40:51 +0000 Subject: Re: wait_for_sysfs messages (more debugging info) Message-Id: <20041016024051.GA2950@vrfy.org> MIME-Version: 1 Content-Type: multipart/mixed; boundary="xHFwDpU9dbj6ez1V" List-Id: References: <416F09EE.9050205@gwi.net> In-Reply-To: <416F09EE.9050205@gwi.net> To: linux-hotplug@vger.kernel.org --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 15, 2004 at 10:00:47PM -0400, Jeff wrote: > Kay Sievers wrote: > >On Fri, 2004-10-15 at 01:42 +0200, Kay Sievers wrote: > > > >>On Thu, Oct 14, 2004 at 07:21:18PM -0400, Jeff wrote: > >> > >>>Sorry to double post but thought with the more verbose debugging this > >>>might help you more: > >>>Oct 14 16:04:00 [wait_for_sysfs] either wait_for_sysfs (udev 038) needs > >>>an update > >>>to handle the device '/class/vc/vcs2' properly (4) or the sysfs-support > >>>of your de > >>>vice's driver needs to be fixed, please report to > >>> >>>eforge.net> > >> > >>Seems like you have the /etc/hotplug.d/default/00-wait_for_sysfs.hotplug > >>symlink still installed. Removing this will cut the messages to the > >>half but not solve the problem, sorry. We are working on it, but currently > >>have absolutely no idea what's going wrong here. > > > > > >Sorry for the confusion. It seems that the kernel emits two events for > >every device, which is wrong. It's not a second symlink as I pointed out > >to you first. > > > >Thanks, > >Kay > > > > > > > Just an update-039 fixes the majority of the vcs messages. I've rebooted > a few times and now only get 1-3 of the messages. Example: > > Oct 15 21:46:28 [wait_for_sysfs] either wait_for_sysfs (udev 039) needs > an updat > e to handle the device '/class/vc/vcs8' properly (3) or the > sysfs-support of you > r device's driver needs to be fixed, please report to > .sourceforge.net> > > Always (3)'s now, no (4)'s (not that I'm really sure what that signifies). Ok, we need to cover the case, we can open the device but can't read anything, cause it's gone in the meantime. Here is a fix and it replaces the magic numbers with meaningful text. Kay --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="wait-error-log.patch" ===== wait_for_sysfs.c 1.20 vs edited ===== --- 1.20/wait_for_sysfs.c 2004-10-15 23:54:11 +02:00 +++ edited/wait_for_sysfs.c 2004-10-16 04:36:42 +02:00 @@ -56,7 +56,8 @@ #define WAIT_LOOP_PER_SECOND 20 /* wait for specific file to show up, normally the "dev"-file */ -static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev) +static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev, + const char **error) { static struct class_file { char *subsystem; @@ -103,7 +104,8 @@ struct stat stats; if (stat(class_dev->path, &stats) == -1) { - dbg("oops, the directory '%s' just disappeared.", class_dev->path); + dbg("we've opened the device '%s' but now it disappeared", class_dev->path); + *error = "device directory unavailable"; return -ENODEV; } @@ -116,6 +118,7 @@ } dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file); + *error = "class specific file unavailable"; return -ENOENT; } @@ -226,7 +229,8 @@ } /* wait for the bus and for a bus specific file to show up */ -static int wait_for_bus_device(struct sysfs_device *device_dev) +static int wait_for_bus_device(struct sysfs_device *device_dev, + const char **error) { static struct bus_file { char *bus; @@ -256,6 +260,7 @@ } if (loop == 0) { dbg("error: getting /bus-device link"); + *error = "no /bus-device link"; return -1; } dbg("/bus-device link found for bus '%s'", device_dev->bus); @@ -276,6 +281,7 @@ } } if (found == 0) { + *error = "unknown bus"; info("error: unknown bus, please report to " " '%s'", device_dev->bus); return -1; @@ -284,6 +290,7 @@ } dbg("error: getting bus '%s' specific file '%s'", device_dev->bus, busfile->file); + *error = "bus specific file unavailable"; return -1; } @@ -299,7 +306,7 @@ struct sysfs_device *device_dev = NULL; int loop; int retval; - int rc = 0; + const char *error = NULL; init_logging("wait_for_sysfs"); @@ -345,22 +352,19 @@ } if (class_dev == NULL) { dbg("error: getting class_device"); - rc = 3; + error = "device unavailable"; goto exit; } dbg("class_device opened '%s'", filename); - retval = wait_for_class_device_attributes(class_dev); - if (retval == -ENODEV) + retval = wait_for_class_device_attributes(class_dev, &error); + if (retval != 0) goto exit_class; - if (retval != 0) { - rc = 4; - goto exit_class; - } /* skip devices without /device-link */ if (class_device_expect_no_device_link(class_dev)) { dbg("no device symlink expected for '%s', ", class_dev->name); + error = "no device symlink"; goto exit_class; } @@ -384,8 +388,7 @@ usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } if (device_dev == NULL) { - dbg("error: getting /device-device"); - rc = 5; + error = "error: /device-device symlink"; goto exit_class; } dbg("device symlink found pointing to '%s'", device_dev->path); @@ -394,8 +397,7 @@ if (class_device_expect_no_bus(class_dev)) { dbg("no bus device expected for '%s', ", class_dev->classname); } else { - if (wait_for_bus_device(device_dev) != 0) - rc = 6; + wait_for_bus_device(device_dev, &error); } exit_class: @@ -415,15 +417,13 @@ usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } if (device_dev == NULL) { - dbg("error: getting /device-device"); - rc = 7; + error = "error: opening /device-device"; goto exit; } dbg("device_device opened '%s'", filename); /* wait for the bus value */ - if (wait_for_bus_device(device_dev) != 0) - rc = 8; + wait_for_bus_device(device_dev, &error); sysfs_close_device(device_dev); @@ -432,13 +432,13 @@ } exit: - if (rc == 0) + if (error == NULL) dbg("result: waiting for sysfs successful '%s'", devpath); else info("either wait_for_sysfs (udev %s) needs an update to handle the device '%s' " - "properly (%d) or the sysfs-support of your device's driver needs to be fixed, " + "properly (%s) or the sysfs-support of your device's driver needs to be fixed, " "please report to ", - UDEV_VERSION, devpath, rc); + UDEV_VERSION, devpath, error); - return rc; + return 3; } --xHFwDpU9dbj6ez1V-- ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ 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