]> err.no Git - systemd/commitdiff
logind: retrigger devices when we reassign them
authorLennart Poettering <lennart@poettering.net>
Tue, 28 Jun 2011 21:03:56 +0000 (23:03 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 28 Jun 2011 21:03:56 +0000 (23:03 +0200)
src/logind-dbus.c
src/logind.h

index 57ee2ee28d9fb1fe1d2259286011854146952a6f..5997fb5d7ad26b0648ab35ff5ecb80d89e584a38 100644 (file)
@@ -557,6 +557,8 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
         char *rule = NULL, *file = NULL;
         const char *id_for_seat;
         int r;
+        struct udev_enumerate *e;
+        struct udev_list_entry *first, *item;
 
         assert(m);
         assert(seat);
@@ -589,6 +591,38 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
 
         mkdir_p("/etc/udev/rules.d", 0755);
         r = write_one_line_file(file, rule);
+        if (r < 0)
+                goto finish;
+
+        e = udev_enumerate_new(m->udev);
+        if (!e) {
+                r = -ENOMEM;
+                goto finish;
+        }
+
+        if (udev_enumerate_scan_devices(e) < 0) {
+                r = -EIO;
+                goto finish;
+        }
+
+        first = udev_enumerate_get_list_entry(e);
+        udev_list_entry_foreach(item, first) {
+                char *t;
+                const char *p;
+
+                p = udev_list_entry_get_name(item);
+                if (!startswith(p, sysfs))
+                        continue;
+
+                t = strappend(p, "/uevent");
+                if (!t) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                write_one_line_file(t, "change");
+                free(t);
+        }
 
 finish:
         free(rule);
@@ -597,6 +631,9 @@ finish:
         if (d)
                 udev_device_unref(d);
 
+        if (e)
+                udev_enumerate_unref(e);
+
         return r;
 }
 
index 8702d1aed27247244ddd054e69377d53063dcc8b..309541415d2336c927f5ab8619b245cd7a5bd69c 100644 (file)
  * add configuration file
  * D-Bus method: AttachDevices(seat, devices[]);
  * use named pipes to detect when a session dies
+ * verify access to SetIdleHint
+ * drop redundant udev_device_get_is_initialized() use as soon as libudev is fixed
+ * properly escape/remove : and . from seat names in udev rules
+ * use device_has_tag() as soon as it is available
+ * trigger based on libudev if available
+ * enumerate recursively with libudev when triggering
+ * make sure IMPORT{parent}="ID_SEAT" works between usb hub and sound card
  *
  * non-local X11 server
  * reboot/shutdown halt management