From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: wait_for_sysfs messages (more debugging info)
Date: Sat, 16 Oct 2004 16:26:23 +0000 [thread overview]
Message-ID: <20041016162623.GA5010@vrfy.org> (raw)
In-Reply-To: <416F09EE.9050205@gwi.net>
[-- Attachment #1: Type: text/plain, Size: 2223 bytes --]
On Sat, Oct 16, 2004 at 04:40:51AM +0200, Kay Sievers wrote:
> 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
> > >>><linux-hotplug-devel@lists.sourc
> > >>>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
> > <linux-hotplug-devel@lists
> > .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.
Here is a better version. We return successful in the case, that the
advertised device does not appear within the timeout or goes completely
away while waiting for the attributes. All magic numbers should be
readable as a string now.
This hopefully fixes the last vc errors.
Thanks,
Kay
[-- Attachment #2: wait-error-log-02.patch --]
[-- Type: text/plain, Size: 6036 bytes --]
===== 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 18:20:23 +02:00
@@ -56,7 +56,8 @@ void log_message(int level, const char *
#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,11 +104,11 @@ static int wait_for_class_device_attribu
struct stat stats;
if (stat(class_dev->path, &stats) == -1) {
- dbg("oops, the directory '%s' just disappeared.", class_dev->path);
+ dbg("'%s' now disappeared (probably remove has beaten us)", class_dev->path);
return -ENODEV;
}
- if (stat(filename, &stats) == 0) {
+ if (stat(filename, &stats) == 0) {
dbg("class '%s' specific file '%s' found", class_dev->classname, file);
return 0;
}
@@ -116,6 +117,7 @@ static int wait_for_class_device_attribu
}
dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file);
+ *error = "class specific file unavailable";
return -ENOENT;
}
@@ -226,7 +228,8 @@ static int class_device_expect_no_bus(st
}
/* 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;
@@ -246,7 +249,7 @@ static int wait_for_bus_device(struct sy
struct bus_file *busfile;
int loop;
- /* wait for the /bus-device link to the /device-device */
+ /* wait for the /bus-device link to the /devices-device */
loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND;
while (--loop) {
if (sysfs_get_device_bus(device_dev) == 0)
@@ -256,6 +259,7 @@ static int wait_for_bus_device(struct sy
}
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 +280,7 @@ static int wait_for_bus_device(struct sy
}
}
if (found == 0) {
+ *error = "unknown bus";
info("error: unknown bus, please report to "
"<linux-hotplug-devel@lists.sourceforge.net> '%s'", device_dev->bus);
return -1;
@@ -284,6 +289,7 @@ static int wait_for_bus_device(struct sy
}
dbg("error: getting bus '%s' specific file '%s'", device_dev->bus, busfile->file);
+ *error = "bus specific file unavailable";
return -1;
}
@@ -298,8 +304,7 @@ int main(int argc, char *argv[], char *e
struct sysfs_class_device *class_dev_parent;
struct sysfs_device *device_dev = NULL;
int loop;
- int retval;
- int rc = 0;
+ const char *error = NULL;
init_logging("wait_for_sysfs");
@@ -344,21 +349,15 @@ int main(int argc, char *argv[], char *e
usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
}
if (class_dev == NULL) {
- dbg("error: getting class_device");
- rc = 3;
+ dbg("error: class_device unavailable (probably remove has beaten us)");
goto exit;
}
dbg("class_device opened '%s'", filename);
- retval = wait_for_class_device_attributes(class_dev);
- if (retval == -ENODEV)
+ if (wait_for_class_device_attributes(class_dev, &error) != 0)
goto exit_class;
- if (retval != 0) {
- rc = 4;
- goto exit_class;
- }
- /* skip devices without /device-link */
+ /* skip devices without devices-link */
if (class_device_expect_no_device_link(class_dev)) {
dbg("no device symlink expected for '%s', ", class_dev->name);
goto exit_class;
@@ -369,8 +368,8 @@ int main(int argc, char *argv[], char *e
if (class_dev_parent)
dbg("looking at parent device for device link '%s'", class_dev_parent->path);
- /* wait for the symlink to the /device-device */
- dbg("waiting for symlink to /device-device");
+ /* wait for the symlink to the devices-device */
+ dbg("waiting for symlink to devices-device");
loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND;
while (--loop) {
if (class_dev_parent)
@@ -384,19 +383,17 @@ int main(int argc, char *argv[], char *e
usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
}
if (device_dev == NULL) {
- dbg("error: getting /device-device");
- rc = 5;
+ dbg(" error: no devices-device symlink found");
+ error = "no device symlink";
goto exit_class;
}
dbg("device symlink found pointing to '%s'", device_dev->path);
/* wait for the bus value */
- if (class_device_expect_no_bus(class_dev)) {
+ 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;
- }
+ else
+ wait_for_bus_device(device_dev, &error);
exit_class:
sysfs_close_class_device(class_dev);
@@ -415,15 +412,13 @@ exit_class:
usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
}
if (device_dev == NULL) {
- dbg("error: getting /device-device");
- rc = 7;
+ error = "devices-device unavailable";
goto exit;
}
- dbg("device_device opened '%s'", filename);
+ dbg("devices-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 +427,13 @@ exit_class:
}
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 <linux-hotplug-devel@lists.sourceforge.net>",
- UDEV_VERSION, devpath, rc);
+ UDEV_VERSION, devpath, error);
- return rc;
+ return 3;
}
next prev parent reply other threads:[~2004-10-16 16:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-14 23:21 wait_for_sysfs messages (more debugging info) Jeff
2004-10-15 2:53 ` Jesse Stockall
2004-10-16 2:00 ` Jeff
2004-10-16 2:40 ` Kay Sievers
2004-10-16 16:26 ` Kay Sievers [this message]
2004-10-16 18:48 ` Jeff
2004-10-17 0:45 ` Kay Sievers
2004-10-17 1:55 ` Jeff
2004-10-17 14:04 ` Jeff
2004-10-18 17:17 ` Greg KH
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=20041016162623.GA5010@vrfy.org \
--to=kay.sievers@vrfy.org \
--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).