From a67f38f79028ce4a0a0b7c3fa70624258e5a0b69 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 23 Jan 2022 01:39:13 +0200 Subject: [PATCH] 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. --- spa/plugins/v4l2/v4l2-udev.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/spa/plugins/v4l2/v4l2-udev.c b/spa/plugins/v4l2/v4l2-udev.c index 24adab704..d9d3c7a66 100644 --- a/spa/plugins/v4l2/v4l2-udev.c +++ b/spa/plugins/v4l2/v4l2-udev.c @@ -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)) { - str = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE"); + str = udev_device_get_property_value(dev, "ID_MODEL_ENC"); if (!(str && *str)) { - str = udev_device_get_property_value(dev, "ID_MODEL_ENC"); - if (!(str && *str)) { - str = udev_device_get_property_value(dev, "ID_MODEL"); - } else { - char *t = alloca(strlen(str) + 1); - unescape(str, t); - str = t; - } + str = udev_device_get_property_value(dev, "ID_MODEL"); + if (!(str && *str)) + str = udev_device_get_property_value(dev, "ID_V4L_PRODUCT"); + } else { + char *t = alloca(strlen(str) + 1); + unescape(str, t); + str = t; } } if (str && *str)