From: Kay Sievers Date: Wed, 14 Mar 2007 23:10:22 +0000 (+0100) Subject: update internal variables if we see $DEVPATH during IMPORT X-Git-Tag: 174~2042 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=4a7e6bcef059af60baab92a3c0fbe01ed44465d5 update internal variables if we see $DEVPATH during IMPORT --- diff --git a/udev_device.c b/udev_device.c index 1eebd61cc..91fa65548 100644 --- a/udev_device.c +++ b/udev_device.c @@ -208,6 +208,10 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) info("device event will be ignored"); goto exit; } + if (udev->name[0] == '\0') { + info("device renaming supressed"); + goto exit; + } /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->dev->kernel) != 0) { diff --git a/udev_rules.c b/udev_rules.c index 200b4e702..7ab3bba71 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -186,7 +186,13 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu linepos = line; if (get_key(&linepos, &variable, &value) == 0) { dbg("import '%s=%s'", variable, value); - name_list_key_add(&udev->env_list, variable, value); + + /* handle device, renamed by external tool, returning new path */ + if (strcmp(variable, "DEVPATH") == 0) { + info("updating devpath from '%s' to '%s'", udev->dev->devpath, value); + sysfs_device_set_values(udev->dev, value, NULL, NULL); + } else + name_list_key_add(&udev->env_list, variable, value); setenv(variable, value, 1); } }