spa/v4l2: better device product names on current kernels

udev/kernel sometimes give "Video Capture N" as ID_V4L_PRODUCT, which is
bogus as a device product name.  The ID_MODEL* field seem to always have
a sensible product name.

Get device.product.name always from ID_MODEL*, and use ID_V4L_PRODUCT
only as the last fallback.
This commit is contained in:
Pauli Virtanen 2022-01-23 01:39:13 +02:00 committed by Wim Taymans
parent e1bc1c4569
commit a67f38f790

View file

@ -311,18 +311,17 @@ static int emit_object_info(struct impl *this, struct device *device)
} }
} }
str = udev_device_get_property_value(dev, "ID_V4L_PRODUCT"); str = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE");
if (!(str && *str)) { if (!(str && *str)) {
str = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE"); str = udev_device_get_property_value(dev, "ID_MODEL_ENC");
if (!(str && *str)) { if (!(str && *str)) {
str = udev_device_get_property_value(dev, "ID_MODEL_ENC"); str = udev_device_get_property_value(dev, "ID_MODEL");
if (!(str && *str)) { if (!(str && *str))
str = udev_device_get_property_value(dev, "ID_MODEL"); str = udev_device_get_property_value(dev, "ID_V4L_PRODUCT");
} else { } else {
char *t = alloca(strlen(str) + 1); char *t = alloca(strlen(str) + 1);
unescape(str, t); unescape(str, t);
str = t; str = t;
}
} }
} }
if (str && *str) if (str && *str)