mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	namehint: Evaluate more possibilities for hw devices
This tries to fix the issue when logical device indexes does not match the hardware device indexes (like hdmi -> 0:3, 1:7, 2:8, 3:9). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									18b377dec2
								
							
						
					
					
						commit
						97d25c0766
					
				
					 1 changed files with 13 additions and 5 deletions
				
			
		| 
						 | 
					@ -414,6 +414,7 @@ static int add_card(struct hint_list *list, int card)
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	char ctl_name[16];
 | 
						char ctl_name[16];
 | 
				
			||||||
	snd_ctl_card_info_t *info;
 | 
						snd_ctl_card_info_t *info;
 | 
				
			||||||
 | 
						int device, max_device = 0;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	snd_ctl_card_info_alloca(&info);
 | 
						snd_ctl_card_info_alloca(&info);
 | 
				
			||||||
	list->info = info;
 | 
						list->info = info;
 | 
				
			||||||
| 
						 | 
					@ -431,18 +432,25 @@ static int add_card(struct hint_list *list, int card)
 | 
				
			||||||
		n = snd_config_iterator_entry(i);
 | 
							n = snd_config_iterator_entry(i);
 | 
				
			||||||
		if (snd_config_get_id(n, &str) < 0)
 | 
							if (snd_config_get_id(n, &str) < 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		if (next_devices[list->iface] != NULL) {
 | 
							if (next_devices[list->iface] != NULL) {
 | 
				
			||||||
			list->card = card;
 | 
								list->card = card;
 | 
				
			||||||
			list->device = -1;
 | 
								device = max_device = -1;
 | 
				
			||||||
			err = next_devices[list->iface](list->ctl, &list->device);
 | 
								err = next_devices[list->iface](list->ctl, &device);
 | 
				
			||||||
			if (list->device < 0)
 | 
								if (device < 0)
 | 
				
			||||||
				err = -EINVAL;
 | 
									err = -EINVAL;
 | 
				
			||||||
 | 
								while (err >= 0 && device >= 0) {
 | 
				
			||||||
 | 
									err = next_devices[list->iface](list->ctl, &device);
 | 
				
			||||||
 | 
									if (device > max_device)
 | 
				
			||||||
 | 
										max_device = device;
 | 
				
			||||||
 | 
									ok++;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			ok = 0;
 | 
								ok = 0;
 | 
				
			||||||
			while (err >= 0 && list->device >= 0) {
 | 
								for (device = 0; err >= 0 && device < max_device; device++) {
 | 
				
			||||||
 | 
									list->device = device;
 | 
				
			||||||
				err = try_config(list, list->siface, str);
 | 
									err = try_config(list, list->siface, str);
 | 
				
			||||||
				if (err < 0)
 | 
									if (err < 0)
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				err = next_devices[list->iface](list->ctl, &list->device);
 | 
					 | 
				
			||||||
				ok++;
 | 
									ok++;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (ok)
 | 
								if (ok)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue