chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] fix unusual sysfs behavior for pcmcia_socket
[elogind.git]
/
wait_for_sysfs.c
diff --git
a/wait_for_sysfs.c
b/wait_for_sysfs.c
index c1d7aa0a0c045fcb06b2ecec07c1cfc11996ad67..292edfad13e4a1883f91db050d7ffc8e871d9c29 100644
(file)
--- a/
wait_for_sysfs.c
+++ b/
wait_for_sysfs.c
@@
-32,6
+32,7
@@
#include <sys/stat.h>
#include "logging.h"
#include <sys/stat.h>
#include "logging.h"
+#include "udev_version.h"
#include "libsysfs/sysfs/libsysfs.h"
#ifdef LOG
#include "libsysfs/sysfs/libsysfs.h"
#ifdef LOG
@@
-46,7
+47,7
@@
void log_message(int level, const char *format, ...)
}
#endif
}
#endif
-#define WAIT_MAX_SECONDS
5
+#define WAIT_MAX_SECONDS
10
#define WAIT_LOOP_PER_SECOND 20
/* wait for specific file to show up, normally the "dev"-file */
#define WAIT_LOOP_PER_SECOND 20
/* wait for specific file to show up, normally the "dev"-file */
@@
-59,7
+60,7
@@
static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev
{ .subsystem = "net", .file = "ifindex" },
{ .subsystem = "scsi_host", .file = "unique_id" },
{ .subsystem = "scsi_device", .file = NULL },
{ .subsystem = "net", .file = "ifindex" },
{ .subsystem = "scsi_host", .file = "unique_id" },
{ .subsystem = "scsi_device", .file = NULL },
- { .subsystem = "pcmcia_socket", .file =
"card_type" },
+ { .subsystem = "pcmcia_socket", .file =
NULL }, /* all files are unreadable in empty slot :( */
{ .subsystem = "usb_host", .file = NULL },
{ .subsystem = "bluetooth", .file = "address" },
{ .subsystem = "i2c-adapter", .file = NULL },
{ .subsystem = "usb_host", .file = NULL },
{ .subsystem = "bluetooth", .file = "address" },
{ .subsystem = "i2c-adapter", .file = NULL },
@@
-100,11
+101,11
@@
static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev
return -1;
}
return -1;
}
-/*
skip waiting for
physical device */
+/*
check if we need to wait for a
physical device */
static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev)
{
static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev)
{
- /*
List of devices without a "device" symlink
- *
set .device to NULL to accept all devices in that subsystem
*/
+ /*
list of devices without a "device" symlink to the physical device
+ *
if device is set to NULL, no devices in that subsystem has a link
*/
static struct class_device {
char *subsystem;
char *device;
static struct class_device {
char *subsystem;
char *device;
@@
-138,11
+139,15
@@
static int class_device_expect_no_device_link(struct sysfs_class_device *class_d
{ .subsystem = "misc", .device = NULL },
{ .subsystem = "msr", .device = NULL },
{ .subsystem = "netlink", .device = NULL },
{ .subsystem = "misc", .device = NULL },
{ .subsystem = "msr", .device = NULL },
{ .subsystem = "netlink", .device = NULL },
- { .subsystem = "net", .device = NULL },
+ { .subsystem = "net", .device = "sit" },
+ { .subsystem = "net", .device = "ppp" },
+ { .subsystem = "net", .device = "lo" },
+ { .subsystem = "net", .device = "tap" },
+ { .subsystem = "net", .device = "ipsec" },
{ .subsystem = "sound", .device = NULL },
{ .subsystem = "printer", .device = "lp" },
{ .subsystem = "nvidia", .device = NULL },
{ .subsystem = "sound", .device = NULL },
{ .subsystem = "printer", .device = "lp" },
{ .subsystem = "nvidia", .device = NULL },
- { .subsystem = "video4linux", .device =
NULL
},
+ { .subsystem = "video4linux", .device =
"vbi"
},
{ .subsystem = "lirc", .device = NULL },
{ .subsystem = "firmware", .device = NULL },
{ .subsystem = "drm", .device = NULL },
{ .subsystem = "lirc", .device = NULL },
{ .subsystem = "firmware", .device = NULL },
{ .subsystem = "drm", .device = NULL },
@@
-150,15
+155,15
@@
static int class_device_expect_no_device_link(struct sysfs_class_device *class_d
{ .subsystem = "ieee1394", .device = NULL },
{ .subsystem = "ieee1394_host", .device = NULL },
{ .subsystem = "ieee1394_node", .device = NULL },
{ .subsystem = "ieee1394", .device = NULL },
{ .subsystem = "ieee1394_host", .device = NULL },
{ .subsystem = "ieee1394_node", .device = NULL },
+ { .subsystem = "raw", .device = NULL },
{ NULL, NULL }
};
struct class_device *classdevice;
int len;
{ NULL, NULL }
};
struct class_device *classdevice;
int len;
- /* look if we want to look for another file instead of "dev" */
for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) {
if (strcmp(class_dev->classname, classdevice->subsystem) == 0) {
for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) {
if (strcmp(class_dev->classname, classdevice->subsystem) == 0) {
- /*
if device is NULL, all devices in this class are o
k */
+ /*
see if no device in this class is expected to have a device-lin
k */
if (classdevice->device == NULL)
return 1;
if (classdevice->device == NULL)
return 1;
@@
-168,11
+173,11
@@
static int class_device_expect_no_device_link(struct sysfs_class_device *class_d
if (strncmp(class_dev->name, classdevice->device, len) != 0)
continue;
if (strncmp(class_dev->name, classdevice->device, len) != 0)
continue;
- /* exact match */
+ /* exact
name
match */
if (strlen(class_dev->name) == len)
return 1;
if (strlen(class_dev->name) == len)
return 1;
- /*
instance numbers are matching too
*/
+ /*
name match with instance number
*/
if (isdigit(class_dev->name[len]))
return 1;
}
if (isdigit(class_dev->name[len]))
return 1;
}
@@
-407,9
+412,10
@@
exit:
if (rc == 0)
dbg("result: waiting for sysfs successful '%s'", devpath);
else
if (rc == 0)
dbg("result: waiting for sysfs successful '%s'", devpath);
else
- info("error: wait_for_sysfs needs an update to handle the device '%s' "
- "properly (%d), please report to <linux-hotplug-devel@lists.sourceforge.net>",
- devpath, rc);
+ 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, "
+ "please report to <linux-hotplug-devel@lists.sourceforge.net>",
+ UDEV_VERSION, devpath, rc);
return rc;
}
return rc;
}