From: Paul Kocialkowski Date: Tue, 6 Jun 2017 15:27:30 +0000 (+0300) Subject: sd-device: Try /sys/firmware for sysname to allow device-tree (#5837) X-Git-Tag: v234~144 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a918b6738a346516e1e89cd84b10d4ad1084372b;p=thirdparty%2Fsystemd.git sd-device: Try /sys/firmware for sysname to allow device-tree (#5837) This adds /sys/firmware lookup for sysname when creating a new device, which allows device-tree properties lookup. This look-up can then be used in udev rules, allowing device-tree-based model detection. --- diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index c56ae39c9fe..d65e716da56 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -324,6 +324,10 @@ _public_ int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *s if (access(syspath, F_OK) >= 0) return sd_device_new_from_syspath(ret, syspath); + syspath = strjoina("/sys/firmware/", subsystem, "/", sysname); + if (access(syspath, F_OK) >= 0) + return sd_device_new_from_syspath(ret, syspath); + return -ENODEV; }