ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Harald Hoyer fe20ad
From a6dfef02531465a318de68ac2cd3343250b9ef3a Mon Sep 17 00:00:00 2001
Harald Hoyer fe20ad
From: Kay Sievers <kay@vrfy.org>
Harald Hoyer fe20ad
Date: Wed, 7 Aug 2013 13:10:01 +0200
Harald Hoyer fe20ad
Subject: [PATCH] udev: hwdb - try reading modalias for usb before falling back
Harald Hoyer fe20ad
 to the composed one
Harald Hoyer fe20ad
Harald Hoyer fe20ad
---
Harald Hoyer fe20ad
 src/udev/udev-builtin-hwdb.c | 7 +++----
Harald Hoyer fe20ad
 1 file changed, 3 insertions(+), 4 deletions(-)
Harald Hoyer fe20ad
Harald Hoyer fe20ad
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
Harald Hoyer fe20ad
index f1c0ca9..d6aa96b 100644
Harald Hoyer fe20ad
--- a/src/udev/udev-builtin-hwdb.c
Harald Hoyer fe20ad
+++ b/src/udev/udev-builtin-hwdb.c
Harald Hoyer fe20ad
@@ -102,14 +102,13 @@ static int udev_builtin_hwdb_search(struct udev_device *dev, struct udev_device
Harald Hoyer fe20ad
                 if (subsystem && !streq(dsubsys, subsystem))
Harald Hoyer fe20ad
                         continue;
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
+                modalias = udev_device_get_property_value(d, "MODALIAS");
Harald Hoyer fe20ad
+
Harald Hoyer fe20ad
                 /* the usb_device does not have a modalias, compose one */
Harald Hoyer fe20ad
-                if (streq(dsubsys, "usb"))
Harald Hoyer fe20ad
+                if (!modalias && streq(dsubsys, "usb"))
Harald Hoyer fe20ad
                         modalias = modalias_usb(d, s, sizeof(s));
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
                 if (!modalias)
Harald Hoyer fe20ad
-                        modalias = udev_device_get_property_value(d, "MODALIAS");
Harald Hoyer fe20ad
-
Harald Hoyer fe20ad
-                if (!modalias)
Harald Hoyer fe20ad
                         continue;
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
                 n = udev_builtin_hwdb_lookup(dev, prefix, modalias, filter, test);