mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	udev: prefix vendor.id and product.id with 0x
They are hex strings so prefix them with 0x to make sure they get handled like that in properties. Fixes #2527
This commit is contained in:
		
							parent
							
								
									cbbc4baa3f
								
							
						
					
					
						commit
						03f918bf15
					
				
					 2 changed files with 8 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -279,11 +279,10 @@ static int emit_object_info(struct impl *this, struct device *device)
 | 
			
		|||
		items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_SUBSYSTEM, 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);
 | 
			
		||||
			char *dec = alloca(12); /* 0xffff is max */
 | 
			
		||||
			snprintf(dec, 12, "0x%04x", val);
 | 
			
		||||
			items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_ID, dec);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -302,11 +301,10 @@ static int emit_object_info(struct impl *this, struct device *device)
 | 
			
		|||
		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) {
 | 
			
		||||
		char *dec = alloca(6); /* 65535 is max */
 | 
			
		||||
		int32_t val;
 | 
			
		||||
 | 
			
		||||
		if (spa_atoi32(str, &val, 16)) {
 | 
			
		||||
			snprintf(dec, 6, "%d", val);
 | 
			
		||||
			char *dec = alloca(12); /* 0xffff is max */
 | 
			
		||||
			snprintf(dec, 12, "0x%04x", val);
 | 
			
		||||
			items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_ID, dec);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue