mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	add new function pa_alsa_get_driver_name()
This commit is contained in:
		
							parent
							
								
									1c94cfe29f
								
							
						
					
					
						commit
						4bd654542e
					
				
					 2 changed files with 21 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -31,6 +31,7 @@
 | 
			
		|||
#include <pulse/sample.h>
 | 
			
		||||
#include <pulse/xmalloc.h>
 | 
			
		||||
#include <pulse/timeval.h>
 | 
			
		||||
#include <pulse/util.h>
 | 
			
		||||
 | 
			
		||||
#include <pulsecore/log.h>
 | 
			
		||||
#include <pulsecore/macro.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -1477,3 +1478,21 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas
 | 
			
		|||
 | 
			
		||||
    return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char *pa_alsa_get_driver_name(int card) {
 | 
			
		||||
    char *t, *m, *n;
 | 
			
		||||
 | 
			
		||||
    pa_assert(card >= 0);
 | 
			
		||||
 | 
			
		||||
    t = pa_sprintf_malloc("/sys/class/sound/card%i/device/driver/module", card);
 | 
			
		||||
    m = pa_readlink(t);
 | 
			
		||||
    pa_xfree(t);
 | 
			
		||||
 | 
			
		||||
    if (!m)
 | 
			
		||||
        return NULL;
 | 
			
		||||
 | 
			
		||||
    n = pa_xstrdup(pa_path_get_filename(m));
 | 
			
		||||
    pa_xfree(m);
 | 
			
		||||
 | 
			
		||||
    return n;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue