72 lines
1.5 KiB
Diff
72 lines
1.5 KiB
Diff
--- udev-103/udevtrigger.c.last_modalias 2006-10-20 14:43:35.000000000 +0200
|
|
+++ udev-103/udevtrigger.c 2006-11-07 14:16:52.000000000 +0100
|
|
@@ -30,6 +30,7 @@
|
|
#include <fnmatch.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
+#include <fnmatch.h>
|
|
|
|
#include "udev.h"
|
|
#include "udevd.h"
|
|
@@ -42,6 +43,13 @@
|
|
LIST_HEAD(filter_attr_match_list);
|
|
LIST_HEAD(filter_attr_nomatch_list);
|
|
|
|
+/* 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,
|
|
+};
|
|
+
|
|
#ifdef USE_LOG
|
|
void log_message(int priority, const char *format, ...)
|
|
{
|
|
@@ -72,6 +80,36 @@
|
|
return 0;
|
|
}
|
|
|
|
+
|
|
+
|
|
+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)
|
|
{
|
|
char filename[PATH_SIZE];
|
|
@@ -495,6 +533,10 @@
|
|
default:
|
|
goto exit;
|
|
}
|
|
+ if (modalias_is_greylisted(path)) {
|
|
+ device_list = &device_last_list;
|
|
+ break;
|
|
+ }
|
|
}
|
|
|
|
if (failed)
|