diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-16 11:37:22 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-16 11:37:22 +0200 |
commit | 31f4b036ea97d87d3f094d6e5256976a25eac013 (patch) | |
tree | d900bb073c4e32235f58f516d6b6cb62cccdf40c /udev/lib/libudev-monitor.c | |
parent | 5c5cad796682d7f481d59ca495a1efa07fa013c7 (diff) |
libudev: device - export properties when values are set
Diffstat (limited to 'udev/lib/libudev-monitor.c')
-rw-r--r-- | udev/lib/libudev-monitor.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index dd8dfac323..382fbfac5f 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -245,6 +245,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito char buf[4096]; size_t bufpos; int devpath_set = 0; + int subsystem_set = 0; + int action_set = 0; int maj = 0; int min = 0; @@ -317,6 +319,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito devpath_set = 1; } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { udev_device_set_subsystem(udev_device, &key[10]); + subsystem_set = 1; } else if (strncmp(key, "DEVNAME=", 8) == 0) { udev_device_set_devnode(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { @@ -339,6 +342,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito udev_device_set_driver(udev_device, &key[7]); } else if (strncmp(key, "ACTION=", 7) == 0) { udev_device_set_action(udev_device, &key[7]); + action_set = 1; } else if (strncmp(key, "MAJOR=", 6) == 0) { maj = strtoull(&key[6], NULL, 10); } else if (strncmp(key, "MINOR=", 6) == 0) { @@ -351,12 +355,15 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito udev_device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); } else if (strncmp(key, "TIMEOUT=", 8) == 0) { udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); - } - if (strncmp(key, "PHYSDEV", 7) == 0) + } else if (strncmp(key, "PHYSDEV", 7) == 0) { + /* skip deprecated values */ continue; - udev_device_add_property_from_string(udev_device, key); + } else { + udev_device_add_property_from_string(udev_device, key); + } } - if (!devpath_set) { + if (!devpath_set || !subsystem_set || !action_set) { + info(udev_monitor->udev, "missing values, skip\n"); udev_device_unref(udev_device); return NULL; } |