Revert "spa: leave vendor.id and product.id in hex"

This reverts commit 0d33760b71.
This commit is contained in:
Wim Taymans 2022-07-11 11:23:08 +02:00
parent dd1d5960b4
commit bdfde2fdf0
2 changed files with 33 additions and 8 deletions

View file

@ -278,9 +278,15 @@ static int emit_object_info(struct impl *this, struct device *device)
if ((str = udev_device_get_property_value(dev, "SUBSYSTEM")) && *str) {
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_SUBSYSTEM, str);
}
if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && *str)
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_ID, str);
if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && *str) {
char *dec = alloca(6); /* 65535 is max */
int32_t val;
if (spa_atoi32(str, &val, 16)) {
snprintf(dec, 6, "%d", val);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_ID, dec);
}
}
str = udev_device_get_property_value(dev, "ID_VENDOR_FROM_DATABASE");
if (!(str && *str)) {
str = udev_device_get_property_value(dev, "ID_VENDOR_ENC");
@ -295,8 +301,15 @@ static int emit_object_info(struct impl *this, struct device *device)
if (str && *str) {
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_NAME, str);
}
if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str)
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_ID, str);
if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str) {
char *dec = alloca(6); /* 65535 is max */
int32_t val;
if (spa_atoi32(str, &val, 16)) {
snprintf(dec, 6, "%d", val);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_ID, dec);
}
}
str = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE");
if (!(str && *str)) {