1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

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.
This commit is contained in:
Paul Kocialkowski 2017-06-06 18:27:30 +03:00 committed by Zbigniew Jędrzejewski-Szmek
parent be5bd2ec62
commit a918b6738a

View File

@ -324,6 +324,10 @@ _public_ int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *s
if (access(syspath, F_OK) >= 0) if (access(syspath, F_OK) >= 0)
return sd_device_new_from_syspath(ret, syspath); 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; return -ENODEV;
} }