Update of /cvsroot/alsa/alsa-lib/src/control
In directory sc8-pr-cvs1:/tmp/cvs-serv11595/src/control
Modified Files:
setup.c
Log Message:
added the "optional" field for sctl.
if the control is not loaded properly, it's ignored without errors.
Index: setup.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/control/setup.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- setup.c 12 Mar 2002 20:14:33 -0000 1.13
+++ setup.c 25 Feb 2003 16:57:21 -0000 1.14
@@ -396,6 +396,7 @@
long subdevice = -1;
int lock = 0;
int preserve = 0;
+ int optional = 0;
snd_config_t *value = NULL, *mask = NULL;
snd_sctl_elem_t *elem = NULL;
int err;
@@ -485,6 +486,19 @@
mask = n;
continue;
}
+ if (strcmp(id, "optional") == 0) {
+ if ((err = snd_config_get_ascii(n, &tmp)) < 0) {
+ SNDERR("field %s has an invalid type", id);
+ goto _err;
+ }
+ err = snd_config_get_bool_ascii(tmp);
+ if (err < 0) {
+ SNDERR("field %s is not a boolean", id);
+ goto _err;
+ }
+ optional = err;
+ continue;
+ }
SNDERR("Unknown field %s", id);
return -EINVAL;
}
@@ -530,7 +544,8 @@
snd_ctl_elem_info_set_id(elem->info, elem->id);
err = snd_ctl_elem_info(h->ctl, elem->info);
if (err < 0) {
- SNDERR("Cannot obtain info for CTL elem (%s,'%s',%li,%li,%li): %s",
snd_ctl_elem_iface_name(iface), name, index, device, subdevice, snd_strerror(err));
+ if (! optional)
+ SNDERR("Cannot obtain info for CTL elem (%s,'%s',%li,%li,%li):
%s", snd_ctl_elem_iface_name(iface), name, index, device, subdevice,
snd_strerror(err));
goto _err;
}
snd_ctl_elem_value_set_id(elem->val, elem->id);
@@ -566,6 +581,8 @@
if (elem->old)
snd_ctl_elem_value_free(elem->old);
free(elem);
+ if (err != -ENOMEM && optional)
+ err = 0; /* ignore the error */
}
if (conf)
snd_config_delete(conf);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog