]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: use ID_MODEL_ENC is possible
authorKarel Zak <kzak@redhat.com>
Wed, 2 Jun 2021 11:32:43 +0000 (13:32 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 2 Jun 2021 11:32:43 +0000 (13:32 +0200)
Fix: https://github.com/karelzak/util-linux/issues/1098
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk-properties.c

index 6429db06e1183811bbeabaebaec39c7ae6a742f5..9ffe2e4afdb83108e9dd42e2288277f2c212329c 100644 (file)
@@ -10,6 +10,7 @@
 #include "mangle.h"
 #include "path.h"
 #include "nls.h"
+#include "strutils.h"
 
 #include "lsblk.h"
 
@@ -114,7 +115,11 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
                if (data)
                        prop->serial = xstrdup(data);
 
-               if ((data = udev_device_get_property_value(dev, "ID_MODEL")))
+               if ((data = udev_device_get_property_value(dev, "ID_MODEL_ENC"))) {
+                       prop->model = xstrdup(data);
+                       unhexmangle_string(prop->model);
+                       normalize_whitespace((unsigned char *) prop->model);
+               } else if ((data = udev_device_get_property_value(dev, "ID_MODEL")))
                        prop->model = xstrdup(data);
 
                udev_device_unref(dev);