mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	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:
		
							parent
							
								
									e1bc1c4569
								
							
						
					
					
						commit
						a67f38f790
					
				
					 1 changed files with 9 additions and 10 deletions
				
			
		| 
						 | 
					@ -311,20 +311,19 @@ static int emit_object_info(struct impl *this, struct device *device)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	str = udev_device_get_property_value(dev, "ID_V4L_PRODUCT");
 | 
					 | 
				
			||||||
	if (!(str && *str)) {
 | 
					 | 
				
			||||||
	str = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE");
 | 
						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_ENC");
 | 
							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");
 | 
								str = udev_device_get_property_value(dev, "ID_MODEL");
 | 
				
			||||||
 | 
								if (!(str && *str))
 | 
				
			||||||
 | 
									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)
 | 
				
			||||||
		items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_NAME, str);
 | 
							items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_NAME, str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue