udev/udev-089-last_modalias.patch
Harald Hoyer 7206c443f2 - version 089
- do not force loading of parport_pc (bug #186850)
- manually load snd-powermac (bug #176761)
- added usb floppy symlink (bug #185171)
- start_udev uses udevtrigger now instead of udevstart
2006-04-13 08:46:43 +00:00

68 lines
1.5 KiB
Diff

--- udev-089/udevtrigger.c.last_modalias 2006-04-03 14:41:10.000000000 +0200
+++ udev-089/udevtrigger.c 2006-04-13 08:11:59.000000000 +0200
@@ -30,6 +30,7 @@
#include <syslog.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fnmatch.h>
#include "udev.h"
@@ -67,10 +68,46 @@
NULL
};
+/* list of devices whose modaliases we should run last */
+static char *last_modalias_list[] = {
+ "pci:v*d*sv*sd*bc0Csc03i*", /* USB controller */
+ "pci:v*d*sv*sd*bc0Csc00i10*", /* Firewire controller */
+ NULL,
+};
+
+
LIST_HEAD(device_first_list);
LIST_HEAD(device_default_list);
LIST_HEAD(device_last_list);
+
+static int modalias_is_greylisted(const char *path)
+{
+
+ char filename[PATH_SIZE];
+ char alias[PATH_SIZE];
+ int fd, i;
+
+ snprintf(filename,sizeof(filename),"%s/%s/modalias", sysfs_path, path);
+ filename[sizeof(filename)-1] = '\0';
+
+ fd = open(filename, O_RDONLY);
+ if (fd == -1)
+ return 0;
+ read(fd,alias,PATH_SIZE);
+ alias[sizeof(alias)-1] = '\0';
+ alias[strlen(alias)-1] = '\0';
+
+ for (i = 0; last_modalias_list[i] != NULL; i++)
+ if (!fnmatch(last_modalias_list[i], alias, 0)) {
+ close(fd);
+ return 1;
+ }
+
+ close(fd);
+ return 0;
+}
+
static int device_list_insert(const char *path)
{
struct list_head *device_list = &device_default_list;
@@ -87,6 +124,10 @@
device_list = &device_last_list;
break;
}
+ if (modalias_is_greylisted(path)) {
+ device_list = &device_last_list;
+ break;
+ }
}
dbg("add '%s'" , path);