SHA256
1
0
forked from pool/systemd
Dr. Werner Fink 2014-08-28 10:09:25 +00:00 committed by Git OBS Bridge
parent 06461bb1ca
commit 3203574c4c
5 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,63 @@
From 77cf759ea05bea476cdcb8d0dcd04c4e6fb3b2ff Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Tue, 26 Aug 2014 18:27:36 +0200
Subject: [PATCH] udev: hwdb - do not look at "usb_device" parents
Based on a patch from Simon McVittie <simon.mcvittie@collabora.co.uk>.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758050
---
src/udev/udev-builtin-hwdb.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git src/udev/udev-builtin-hwdb.c src/udev/udev-builtin-hwdb.c
index cac97e7..695a31a 100644
--- src/udev/udev-builtin-hwdb.c
+++ src/udev/udev-builtin-hwdb.c
@@ -88,9 +88,10 @@ static int udev_builtin_hwdb_search(struct udev_device *dev, struct udev_device
const char *filter, bool test) {
struct udev_device *d;
char s[16];
- int n = 0;
+ bool last = false;
+ int r = 0;
- for (d = srcdev; d; d = udev_device_get_parent(d)) {
+ for (d = srcdev; d && !last; d = udev_device_get_parent(d)) {
const char *dsubsys;
const char *modalias = NULL;
@@ -104,19 +105,24 @@ static int udev_builtin_hwdb_search(struct udev_device *dev, struct udev_device
modalias = udev_device_get_property_value(d, "MODALIAS");
- /* the usb_device does not have a modalias, compose one */
- if (!modalias && streq(dsubsys, "usb"))
- modalias = modalias_usb(d, s, sizeof(s));
+ if (streq(dsubsys, "usb") && streq_ptr(udev_device_get_devtype(d), "usb_device")) {
+ /* if the usb_device does not have a modalias, compose one */
+ if (!modalias)
+ modalias = modalias_usb(d, s, sizeof(s));
+
+ /* avoid looking at any parent device, they are usually just a USB hub */
+ last = true;
+ }
if (!modalias)
continue;
- n = udev_builtin_hwdb_lookup(dev, prefix, modalias, filter, test);
- if (n > 0)
+ r = udev_builtin_hwdb_lookup(dev, prefix, modalias, filter, test);
+ if (r > 0)
break;
}
- return n;
+ return r;
}
static int builtin_hwdb(struct udev_device *dev, int argc, char *argv[], bool test) {
--
1.7.9.2

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Aug 28 10:07:10 UTC 2014 - werner@suse.de
- Add upstream patches
1064-udev-hwdb-do-not-look-at-usb_device-parents.patch
to avoid that hwdb ID's for unrecognised USB device are taken
from the USB hub.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Aug 27 16:01:17 UTC 2014 - werner@suse.de Wed Aug 27 16:01:17 UTC 2014 - werner@suse.de

View File

@ -939,6 +939,8 @@ Patch1061: 1061-rules-allow-systemd-to-manage-loop-device-partitions.patch
Patch1062: 1062-rules-set-default-permissions-for-GenWQE-devices.patch Patch1062: 1062-rules-set-default-permissions-for-GenWQE-devices.patch
# PATCH-FIX-UPSTREAM 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch # PATCH-FIX-UPSTREAM 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch
Patch1063: 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch Patch1063: 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch
# PATCH-FIX-UPSTREAM 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch
Patch1064: 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch
%description %description
Systemd is a system and service manager, compatible with SysV and LSB Systemd is a system and service manager, compatible with SysV and LSB
@ -1573,6 +1575,7 @@ cp %{SOURCE7} m4/
%patch1061 -p0 %patch1061 -p0
%patch1062 -p1 %patch1062 -p1
%patch1063 -p0 %patch1063 -p0
%patch1064 -p0
# remove patch backups # remove patch backups
find -name '*.orig' -exec rm -f '{}' \+ find -name '*.orig' -exec rm -f '{}' \+

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Aug 28 10:07:10 UTC 2014 - werner@suse.de
- Add upstream patches
1064-udev-hwdb-do-not-look-at-usb_device-parents.patch
to avoid that hwdb ID's for unrecognised USB device are taken
from the USB hub.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Aug 27 16:01:17 UTC 2014 - werner@suse.de Wed Aug 27 16:01:17 UTC 2014 - werner@suse.de

View File

@ -934,6 +934,8 @@ Patch1061: 1061-rules-allow-systemd-to-manage-loop-device-partitions.patch
Patch1062: 1062-rules-set-default-permissions-for-GenWQE-devices.patch Patch1062: 1062-rules-set-default-permissions-for-GenWQE-devices.patch
# PATCH-FIX-UPSTREAM 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch # PATCH-FIX-UPSTREAM 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch
Patch1063: 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch Patch1063: 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch
# PATCH-FIX-UPSTREAM 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch
Patch1064: 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch
%description %description
Systemd is a system and service manager, compatible with SysV and LSB Systemd is a system and service manager, compatible with SysV and LSB
@ -1568,6 +1570,7 @@ cp %{SOURCE7} m4/
%patch1061 -p0 %patch1061 -p0
%patch1062 -p1 %patch1062 -p1
%patch1063 -p0 %patch1063 -p0
%patch1064 -p0
# remove patch backups # remove patch backups
find -name '*.orig' -exec rm -f '{}' \+ find -name '*.orig' -exec rm -f '{}' \+