udev-util: add generic device_get_{vendor,model}_string() helpers

We chck the same props in various places, add a single implementation of
a call to inquire this.
This commit is contained in:
Lennart Poettering
2023-11-13 16:24:17 +01:00
parent 7e91c97aff
commit 3cc7a9fd25
7 changed files with 49 additions and 41 deletions
+1 -3
View File
@@ -516,9 +516,7 @@ static int device_update_description(Unit *u, sd_device *dev, const char *path)
desc = path;
if (dev &&
(sd_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE", &model) >= 0 ||
sd_device_get_property_value(dev, "ID_MODEL", &model) >= 0)) {
if (dev && device_get_model_string(dev, &model) >= 0) {
desc = model;
/* Try to concatenate the device model string with a label, if there is one */