[uClibc] Alsa and uclibc...

Gilbert Forkel gforkel at web.de
Tue Mar 29 16:12:53 UTC 2005


Hello,
wanting to use Alsa for my embedded target I compiled alsa-lib and
alsa-utils 1.0.8 in my uclibc dev system (by buildroot).
But when I now try to use an alsa-device (kernel-2.6.10/devfs/buildin) I
always get the following errors (aplay/alsamixer):

ALSA lib conf.c:2796:(snd_config_hook_load) "/etc/asound.conf" is not a
word
ALSA lib conf.c:2676:(snd_config_hooks_call) function
snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3044:(snd_config_update_r) hooks failed, removing
configuration

alsamixer: function snd_ctl_open failed for default: Invalid argument
aplay: main:508: audio open error: Invalid argument

thanks a lot for your help
Gilbert Forkel


The patches:
diff -ur alsa-lib-1.0.8/src/alisp/alisp.c
alsa-lib-1.0.8.gilbert/src/alisp/alisp.c
--- alsa-lib-1.0.8/src/alisp/alisp.c	2003-12-23 17:43:04.000000000 +0100
+++ alsa-lib-1.0.8.gilbert/src/alisp/alisp.c	2005-03-29
15:16:39.931629120 +0200
@@ -30,7 +30,11 @@
 #include <ctype.h>
 #include <math.h>
 #include <err.h>
+#ifdef HAS_WORDEXP
 #include <wordexp.h>
+#else
+#include <glob.h>
+#endif
 
 #define alisp_seq_iterator alisp_object
 
diff -ur alsa-lib-1.0.8/src/conf.c alsa-lib-1.0.8.gilbert/src/conf.c
--- alsa-lib-1.0.8/src/conf.c	2004-10-05 17:33:04.000000000 +0200
+++ alsa-lib-1.0.8.gilbert/src/conf.c	2005-03-29 15:17:57.373856112
+0200
@@ -415,7 +415,11 @@
 
 
 #include <stdarg.h>
+#ifdef HAS_WORDEXP
 #include <wordexp.h>
+#else
+#include <glob.h>
+#endif
 #include <dlfcn.h>
 #include <limits.h>
 #include <sys/stat.h>

diff -ur alsa-lib-1.0.8/src/pcm/pcm_ladspa.c
alsa-lib-1.0.8.gilbert/src/pcm/pcm_ladspa.c
--- alsa-lib-1.0.8/src/pcm/pcm_ladspa.c	2004-05-04 17:54:01.000000000
+0200
+++ alsa-lib-1.0.8.gilbert/src/pcm/pcm_ladspa.c	2005-03-29
15:14:57.414214136 +0200
@@ -28,7 +28,11 @@
   
 #include <dirent.h>
 #include <dlfcn.h>
+#ifdef HAS_WORDEXP
 #include <wordexp.h>
+#else
+#include <glob.h>
+#endif
 #include "pcm_local.h"
 #include "pcm_plugin.h"
 
@@ -795,13 +799,18 @@
 {
 	const char *c;
 	size_t l;
+	#ifdef HAS_WORDEXP
 	wordexp_t we;
+	#else
+	glob_t globbuf;
+	#endif
 	int err;
 	
 	for (c = path; (l = strcspn(c, ": ")) > 0; ) {
 		char name[l + 1];
 		memcpy(name, c, l);
 		name[l] = 0;
+		#ifdef HAS_WORDEXP
 		err = wordexp(name, &we, WRDE_NOCMD);
 		switch (err) {
 		case WRDE_NOSPACE:
@@ -815,6 +824,21 @@
 		}
 		err = snd_pcm_ladspa_check_dir(plugin, we.we_wordv[0], label,
ladspa_id);
 		wordfree(&we);
+		#else
+		err = glob(name, 0, NULL, &globbuf);
+		switch (err) {
+		case GLOB_NOSPACE:
+			return -ENOMEM;
+		case 0:
+			if (globbuf.gl_pathc == 1)
+				break;
+			/* Fall through */
+		default:
+			return -EINVAL;
+		}
+		err = snd_pcm_ladspa_check_dir(plugin, globbuf.gl_pathv[0], label,
ladspa_id);
+		globfree(&globbuf);
+		#endif
 		if (err < 0)
 			return err;
 		if (err > 0)
diff -ur alsa-lib-1.0.8/src/userfile.c
alsa-lib-1.0.8.gilbert/src/userfile.c
--- alsa-lib-1.0.8/src/userfile.c	2003-09-08 20:04:10.000000000 +0200
+++ alsa-lib-1.0.8.gilbert/src/userfile.c	2005-03-29 16:16:26.257424728
+0200
@@ -20,9 +20,14 @@
   
 #include <string.h>
 #include <errno.h>
+#ifdef HAS_WORDEXP
 #include <wordexp.h>
+#else
+#include <glob.h>
+#endif
 #include <assert.h>
 
+#ifdef HAS_WORDEXP
 int snd_user_file(const char *file, char **result)
 {
 	wordexp_t we;
@@ -47,3 +52,29 @@
 	wordfree(&we);
 	return 0;
 }
+#else
+int snd_user_file(const char *file, char **result)
+{
+	glob_t globbuf;
+	int err;
+	
+	assert(file && result);
+	err = glob(file, 0, NULL, &globbuf);
+	switch (err) {
+	case GLOB_NOSPACE:
+		return -ENOMEM;
+	case 0:
+		if (globbuf.gl_pathc == 1)
+			break;
+		/* fall thru */
+	default:
+		globfree(&globbuf);
+		return -EINVAL;
+	}
+	*result = strdup(globbuf.gl_pathv[0]);
+	if (*result == NULL)
+		return -ENOMEM;
+	globfree(&globbuf);
+	return 0;
+}
+#endif

diff -ur alsa-utils-1.0.8/alsamixer/alsamixer.c
alsa-utils-1.0.8.gilbert/alsamixer/alsamixer.c
--- alsa-utils-1.0.8/alsamixer/alsamixer.c	2005-01-12 12:08:53.000000000
+0100
+++ alsa-utils-1.0.8.gilbert/alsamixer/alsamixer.c	2005-03-29
16:24:04.866705520 +0200
@@ -2188,7 +2188,7 @@
 mixer_signal_handler (int signal)
 {
   if (signal != SIGSEGV)
-    mixer_abort (ERR_SIGNAL, sys_siglist[signal], 0);
+    mixer_abort (ERR_SIGNAL, strsignal(signal), 0);
   else
     {
       fprintf (stderr, "\nSegmentation fault.\n");





More information about the uClibc mailing list