OBS User unknown 2007-12-14 15:25:23 +00:00 committed by Git OBS Bridge
parent 981cb7a0ea
commit b3456c8aeb
8 changed files with 379 additions and 411 deletions

View File

@ -1,68 +0,0 @@
# HG changeset patch
# User tiwai
# Date 1195037678 -3600
# Node ID 05c093789c5e03b91af50baa8889b7356e18b42f
# Parent 40051fabcab00bd4fcfab41e11b609acf32a6a22
alsactl - Set -F option as default
Set -F option as default for restore. There are still too many systems
that are too lazy to set -F option...
Added the new -P option to back to the old behavior.
diff -r 40051fabcab0 -r 05c093789c5e alsactl/alsactl.1
--- a/alsactl/alsactl.1 Mon Nov 12 17:24:27 2007 +0100
+++ b/alsactl/alsactl.1 Wed Nov 14 11:54:38 2007 +0100
@@ -41,7 +41,12 @@ Select the configuration file to use. Th
.TP
\fI\-F, \-\-force\fP
Used with restore command. Try to restore the matching control elements
-as much as possible.
+as much as possible. This option is set as default now.
+
+.TP
+\fI\-P, \-\-pedantic\fP
+Used with restore command. Don't restore mismatching control elements.
+This option was the old default behavior.
.TP
\fI\-d, \-\-debug\fP
diff -r 40051fabcab0 -r 05c093789c5e alsactl/alsactl.c
--- a/alsactl/alsactl.c Mon Nov 12 17:24:27 2007 +0100
+++ b/alsactl/alsactl.c Wed Nov 14 11:54:38 2007 +0100
@@ -34,7 +34,7 @@
#define SYS_ASOUNDNAMES "/etc/asound.names"
int debugflag = 0;
-int force_restore = 0;
+int force_restore = 1;
char *command;
static void help(void)
@@ -44,6 +44,8 @@ static void help(void)
printf(" -h,--help this help\n");
printf(" -f,--file # configuration file (default " SYS_ASOUNDRC " or " SYS_ASOUNDNAMES ")\n");
printf(" -F,--force try to restore the matching controls as much as possible\n");
+ printf(" (default mode)\n");
+ printf(" -P,--pedantic don't restore mismatching controls (old default)\n");
printf(" -d,--debug debug mode\n");
printf(" -v,--version print version of this program\n");
printf("\nAvailable commands:\n");
@@ -62,6 +64,7 @@ int main(int argc, char *argv[])
{"help", 0, NULL, 'h'},
{"file", 1, NULL, 'f'},
{"force", 0, NULL, 'F'},
+ {"pedantic", 0, NULL, 'P'},
{"debug", 0, NULL, 'd'},
{"version", 0, NULL, 'v'},
{NULL, 0, NULL, 0},
@@ -84,6 +87,9 @@ int main(int argc, char *argv[])
break;
case 'F':
force_restore = 1;
+ break;
+ case 'P':
+ force_restore = 0;
break;
case 'd':
debugflag = 1;

View File

@ -1,22 +0,0 @@
# HG changeset patch
# User tiwai
# Date 1196439639 -3600
# Node ID 8aa60471d254c4e60c95740478842d8500274d90
# Parent b57d8cd4f4900d029176850cd7d706a7e135a394
alsactl - Fix wrong restore
Fix a bug in alsactl that restores wrong values for elements with
multiple channels (counts).
diff -r b57d8cd4f490 -r 8aa60471d254 alsactl/state.c
--- a/alsactl/state.c Fri Nov 30 08:14:04 2007 +0100
+++ b/alsactl/state.c Fri Nov 30 17:20:39 2007 +0100
@@ -1380,7 +1380,7 @@ static int set_control(snd_ctl_t *handle
return -EINVAL;
continue;
}
- err = restore_config_value2(handle, info, type, value,
+ err = restore_config_value2(handle, info, type, n,
ctl, idx, numid);
if (err < 0)
return err;

View File

@ -1,36 +0,0 @@
# HG changeset patch
# User tiwai
# Date 1194884667 -3600
# Node ID 40051fabcab00bd4fcfab41e11b609acf32a6a22
# Parent 19947765f0332b66b5eabab06929f0bbe2061749
alsactl - fix double entry of comment.tlv
The entry comment.tlv can be doubly written via alsactl store, and this
results in an error. I forgot to remove the old code...
diff -r 19947765f033 -r 40051fabcab0 alsactl/state.c
--- a/alsactl/state.c Mon Nov 05 12:44:13 2007 +0100
+++ b/alsactl/state.c Mon Nov 12 17:24:27 2007 +0100
@@ -330,22 +330,6 @@ static int get_control(snd_ctl_t *handle
if (err < 0)
return err;
}
- if (snd_ctl_elem_info_is_tlv_readable(info)) {
- unsigned int tlv[MAX_USER_TLV_SIZE];
- err = snd_ctl_elem_tlv_read(handle, id, tlv, sizeof(tlv));
- if (err >= 0) {
- char *s = tlv_to_str(tlv);
- if (s) {
- err = snd_config_string_add(comment, "tlv", s);
- if (err < 0) {
- error("snd_config_string_add: %s", snd_strerror(err));
- return err;
- }
- free(s);
- }
- }
- }
-
break;
}
case SND_CTL_ELEM_TYPE_INTEGER64:

View File

@ -1,6 +1,62 @@
diff -r 3b8e4ee4363e alsactl/alsactl.1
--- a/alsactl/alsactl.1 Mon Oct 15 10:36:47 2007 +0200
+++ b/alsactl/alsactl.1 Fri Dec 14 15:35:34 2007 +0100
@@ -41,7 +41,12 @@ Select the configuration file to use. Th
.TP
\fI\-F, \-\-force\fP
Used with restore command. Try to restore the matching control elements
-as much as possible.
+as much as possible. This option is set as default now.
+
+.TP
+\fI\-P, \-\-pedantic\fP
+Used with restore command. Don't restore mismatching control elements.
+This option was the old default behavior.
.TP
\fI\-d, \-\-debug\fP
diff -r 3b8e4ee4363e alsactl/alsactl.c
--- a/alsactl/alsactl.c Mon Oct 15 10:36:47 2007 +0200
+++ b/alsactl/alsactl.c Fri Dec 14 15:35:34 2007 +0100
@@ -34,7 +34,7 @@
#define SYS_ASOUNDNAMES "/etc/asound.names"
int debugflag = 0;
-int force_restore = 0;
+int force_restore = 1;
char *command;
static void help(void)
@@ -44,6 +44,8 @@ static void help(void)
printf(" -h,--help this help\n");
printf(" -f,--file # configuration file (default " SYS_ASOUNDRC " or " SYS_ASOUNDNAMES ")\n");
printf(" -F,--force try to restore the matching controls as much as possible\n");
+ printf(" (default mode)\n");
+ printf(" -P,--pedantic don't restore mismatching controls (old default)\n");
printf(" -d,--debug debug mode\n");
printf(" -v,--version print version of this program\n");
printf("\nAvailable commands:\n");
@@ -62,6 +64,7 @@ int main(int argc, char *argv[])
{"help", 0, NULL, 'h'},
{"file", 1, NULL, 'f'},
{"force", 0, NULL, 'F'},
+ {"pedantic", 0, NULL, 'P'},
{"debug", 0, NULL, 'd'},
{"version", 0, NULL, 'v'},
{NULL, 0, NULL, 0},
@@ -84,6 +87,9 @@ int main(int argc, char *argv[])
break;
case 'F':
force_restore = 1;
+ break;
+ case 'P':
+ force_restore = 0;
break;
case 'd':
debugflag = 1;
diff -r 3b8e4ee4363e alsactl/state.c
--- a/alsactl/state.c Mon Oct 15 10:36:47 2007 +0200
+++ b/alsactl/state.c Fri Oct 26 02:01:44 2007 +0200
+++ b/alsactl/state.c Fri Dec 14 15:35:34 2007 +0100
@@ -188,6 +188,46 @@ static unsigned int *str_to_tlv(const ch
return tlv;
}
@ -48,22 +104,35 @@ diff -r 3b8e4ee4363e alsactl/state.c
static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *top)
{
snd_ctl_elem_value_t *ctl;
@@ -285,8 +325,12 @@ static int get_control(snd_ctl_t *handle
@@ -285,23 +325,11 @@ static int get_control(snd_ctl_t *handle
error("snd_config_string_add: %s", snd_strerror(err));
return err;
}
- if (snd_ctl_elem_info_is_tlv_readable(info) &&
- snd_ctl_elem_info_is_tlv_writable(info)) {
- unsigned int tlv[MAX_USER_TLV_SIZE];
- err = snd_ctl_elem_tlv_read(handle, id, tlv, sizeof(tlv));
- if (err >= 0) {
- char *s = tlv_to_str(tlv);
- if (s) {
- err = snd_config_string_add(comment, "tlv", s);
- if (err < 0) {
- error("snd_config_string_add: %s", snd_strerror(err));
- return err;
- }
- free(s);
- }
- }
+ if (snd_ctl_elem_info_is_tlv_readable(info)) {
+ err = add_tlv_comments(handle, id, info, comment);
+ if (err < 0)
+ return err;
+ }
+ if (snd_ctl_elem_info_is_tlv_readable(info)) {
unsigned int tlv[MAX_USER_TLV_SIZE];
err = snd_ctl_elem_tlv_read(handle, id, tlv, sizeof(tlv));
if (err >= 0) {
@@ -651,6 +695,7 @@ static int config_bool(snd_config_t *n)
}
-
break;
}
case SND_CTL_ELEM_TYPE_INTEGER64:
@@ -651,6 +679,7 @@ static int config_bool(snd_config_t *n)
const char *str;
long val;
long long lval;
@ -71,7 +140,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
switch (snd_config_get_type(n)) {
case SND_CONFIG_TYPE_INTEGER:
snd_config_get_integer(n, &val);
@@ -665,6 +710,11 @@ static int config_bool(snd_config_t *n)
@@ -665,6 +694,11 @@ static int config_bool(snd_config_t *n)
case SND_CONFIG_TYPE_STRING:
snd_config_get_string(n, &str);
break;
@ -83,7 +152,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
default:
return -1;
}
@@ -682,6 +732,7 @@ static int config_enumerated(snd_config_
@@ -682,6 +716,7 @@ static int config_enumerated(snd_config_
long val;
long long lval;
unsigned int idx, items;
@ -91,7 +160,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
switch (snd_config_get_type(n)) {
case SND_CONFIG_TYPE_INTEGER:
snd_config_get_integer(n, &val);
@@ -692,6 +743,11 @@ static int config_enumerated(snd_config_
@@ -692,6 +727,11 @@ static int config_enumerated(snd_config_
case SND_CONFIG_TYPE_STRING:
snd_config_get_string(n, &str);
break;
@ -103,7 +172,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
default:
return -1;
}
@@ -708,6 +764,30 @@ static int config_enumerated(snd_config_
@@ -708,6 +748,30 @@ static int config_enumerated(snd_config_
return idx;
}
return -1;
@ -134,7 +203,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
}
static int is_user_control(snd_config_t *conf)
@@ -729,6 +809,56 @@ static int is_user_control(snd_config_t
@@ -729,6 +793,56 @@ static int is_user_control(snd_config_t
return 0;
}
@ -191,7 +260,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
static int add_user_control(snd_ctl_t *handle, snd_ctl_elem_info_t *info, snd_config_t *conf)
{
snd_ctl_elem_id_t *id;
@@ -745,39 +875,20 @@ static int add_user_control(snd_ctl_t *h
@@ -745,39 +859,20 @@ static int add_user_control(snd_ctl_t *h
tlv = NULL;
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
@ -239,7 +308,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
continue;
}
if (strcmp(id, "count") == 0) {
@@ -831,6 +942,213 @@ static int add_user_control(snd_ctl_t *h
@@ -831,6 +926,213 @@ static int add_user_control(snd_ctl_t *h
return snd_ctl_elem_info(handle, info);
}
@ -453,7 +522,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
static int set_control(snd_ctl_t *handle, snd_config_t *control)
{
snd_ctl_elem_value_t *ctl;
@@ -852,8 +1170,6 @@ static int set_control(snd_ctl_t *handle
@@ -852,8 +1154,6 @@ static int set_control(snd_ctl_t *handle
long index = -1;
snd_config_t *value = NULL;
snd_config_t *comment = NULL;
@ -462,7 +531,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
unsigned int idx;
int err;
char *set;
@@ -994,56 +1310,28 @@ static int set_control(snd_ctl_t *handle
@@ -994,56 +1294,28 @@ static int set_control(snd_ctl_t *handle
return -ENOENT;
}
@ -533,7 +602,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
}
switch (type) {
case SND_CTL_ELEM_TYPE_BYTES:
@@ -1080,8 +1368,17 @@ static int set_control(snd_ctl_t *handle
@@ -1080,8 +1352,17 @@ static int set_control(snd_ctl_t *handle
break;
}
if (snd_config_get_type(value) != SND_CONFIG_TYPE_COMPOUND) {
@ -553,7 +622,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
}
set = (char*) alloca(count);
@@ -1095,59 +1392,22 @@ static int set_control(snd_ctl_t *handle
@@ -1095,59 +1376,22 @@ static int set_control(snd_ctl_t *handle
if (idx < 0 || idx >= count ||
set[idx]) {
error("bad control.%d.value index", numid);
@ -608,7 +677,7 @@ diff -r 3b8e4ee4363e alsactl/state.c
- break;
- }
- set[idx] = 1;
+ err = restore_config_value2(handle, info, type, value,
+ err = restore_config_value2(handle, info, type, n,
+ ctl, idx, numid);
+ if (err < 0)
+ return err;
@ -624,9 +693,42 @@ diff -r 3b8e4ee4363e alsactl/state.c
}
}
diff -r 3b8e4ee4363e aplay/aplay.c
--- a/aplay/aplay.c Mon Oct 15 10:36:47 2007 +0200
+++ b/aplay/aplay.c Fri Dec 14 15:35:34 2007 +0100
@@ -1462,7 +1462,9 @@ static void voc_pcm_flush(void)
if (pcm_write(audiobuf, b) != (ssize_t)b)
error(_("voc_pcm_flush error"));
}
+ snd_pcm_nonblock(handle, 0);
snd_pcm_drain(handle);
+ snd_pcm_nonblock(handle, nonblock);
}
static void voc_play(int fd, int ofs, char *name)
@@ -1988,7 +1990,9 @@ void playback_go(int fd, size_t loaded,
written += r;
l = 0;
}
+ snd_pcm_nonblock(handle, 0);
snd_pcm_drain(handle);
+ snd_pcm_nonblock(handle, nonblock);
}
@@ -2227,7 +2231,9 @@ void playbackv_go(int* fds, unsigned int
r = r * bits_per_frame / 8;
count -= r;
}
+ snd_pcm_nonblock(handle, 0);
snd_pcm_drain(handle);
+ snd_pcm_nonblock(handle, nonblock);
}
void capturev_go(int* fds, unsigned int channels, off64_t count, int rtype, char **names)
diff -r 3b8e4ee4363e configure.in
--- a/configure.in Mon Oct 15 10:36:47 2007 +0200
+++ b/configure.in Fri Oct 26 02:01:44 2007 +0200
+++ b/configure.in Fri Dec 14 15:35:34 2007 +0100
@@ -27,7 +27,9 @@ dnl AC_PROG_CXX
dnl AC_PROG_CXX
AC_PROG_INSTALL
@ -638,9 +740,21 @@ diff -r 3b8e4ee4363e configure.in
AC_ARG_ENABLE(alsamixer,
[ --disable-alsamixer Disable alsamixer compilation],
diff -r 3b8e4ee4363e iecset/iecset.c
--- a/iecset/iecset.c Mon Oct 15 10:36:47 2007 +0200
+++ b/iecset/iecset.c Fri Dec 14 15:35:34 2007 +0100
@@ -308,7 +308,7 @@ int main(int argc, char **argv)
break;
case 'c':
i = atoi(optarg);
- if (i < 0 || i >= 7) {
+ if (i < 0 || i >= 32) {
fprintf(stderr, "invalid card index %d\n", i);
return 1;
}
diff -r 3b8e4ee4363e seq/aseqnet/aseqnet.c
--- a/seq/aseqnet/aseqnet.c Mon Oct 15 10:36:47 2007 +0200
+++ b/seq/aseqnet/aseqnet.c Fri Oct 26 02:01:44 2007 +0200
+++ b/seq/aseqnet/aseqnet.c Fri Dec 14 15:35:34 2007 +0100
@@ -26,6 +26,7 @@
#include <alsa/asoundlib.h>
#include <getopt.h>
@ -649,3 +763,234 @@ diff -r 3b8e4ee4363e seq/aseqnet/aseqnet.c
#include "aconfig.h"
#include "gettext.h"
diff -r 3b8e4ee4363e speaker-test/speaker-test.c
--- a/speaker-test/speaker-test.c Mon Oct 15 10:36:47 2007 +0200
+++ b/speaker-test/speaker-test.c Fri Dec 14 15:35:34 2007 +0100
@@ -276,28 +276,28 @@ static int set_hwparams(snd_pcm_t *handl
/* choose all parameters */
err = snd_pcm_hw_params_any(handle, params);
if (err < 0) {
- printf(_("Broken configuration for playback: no configurations available: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Broken configuration for playback: no configurations available: %s\n"), snd_strerror(err));
return err;
}
/* set the interleaved read/write format */
err = snd_pcm_hw_params_set_access(handle, params, access);
if (err < 0) {
- printf(_("Access type not available for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Access type not available for playback: %s\n"), snd_strerror(err));
return err;
}
/* set the sample format */
err = snd_pcm_hw_params_set_format(handle, params, format);
if (err < 0) {
- printf(_("Sample format not available for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Sample format not available for playback: %s\n"), snd_strerror(err));
return err;
}
/* set the count of channels */
err = snd_pcm_hw_params_set_channels(handle, params, channels);
if (err < 0) {
- printf(_("Channels count (%i) not available for playbacks: %s\n"), channels, snd_strerror(err));
+ fprintf(stderr, _("Channels count (%i) not available for playbacks: %s\n"), channels, snd_strerror(err));
return err;
}
@@ -305,12 +305,12 @@ static int set_hwparams(snd_pcm_t *handl
rrate = rate;
err = snd_pcm_hw_params_set_rate(handle, params, rate, 0);
if (err < 0) {
- printf(_("Rate %iHz not available for playback: %s\n"), rate, snd_strerror(err));
+ fprintf(stderr, _("Rate %iHz not available for playback: %s\n"), rate, snd_strerror(err));
return err;
}
if (rrate != rate) {
- printf(_("Rate doesn't match (requested %iHz, get %iHz, err %d)\n"), rate, rrate, err);
+ fprintf(stderr, _("Rate doesn't match (requested %iHz, get %iHz, err %d)\n"), rate, rrate, err);
return -EINVAL;
}
@@ -326,7 +326,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Requested period time %u us\n"), period_time);
err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, NULL);
if (err < 0) {
- printf(_("Unable to set period time %u us for playback: %s\n"),
+ fprintf(stderr, _("Unable to set period time %u us for playback: %s\n"),
period_time, snd_strerror(err));
return err;
}
@@ -335,7 +335,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Requested buffer time %u us\n"), buffer_time);
err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, NULL);
if (err < 0) {
- printf(_("Unable to set buffer time %u us for playback: %s\n"),
+ fprintf(stderr, _("Unable to set buffer time %u us for playback: %s\n"),
buffer_time, snd_strerror(err));
return err;
}
@@ -347,7 +347,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Using max buffer size %lu\n"), buffer_size);
err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size);
if (err < 0) {
- printf(_("Unable to set buffer size %lu for playback: %s\n"),
+ fprintf(stderr, _("Unable to set buffer size %lu for playback: %s\n"),
buffer_size, snd_strerror(err));
return err;
}
@@ -356,7 +356,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Periods = %u\n"), nperiods);
err = snd_pcm_hw_params_set_periods_near(handle, params, &nperiods, NULL);
if (err < 0) {
- printf(_("Unable to set nperiods %u for playback: %s\n"),
+ fprintf(stderr, _("Unable to set nperiods %u for playback: %s\n"),
nperiods, snd_strerror(err));
return err;
}
@@ -366,14 +366,14 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("was set period_size = %lu\n"),period_size);
printf(_("was set buffer_size = %lu\n"),buffer_size);
if (2*period_size > buffer_size) {
- printf(_("buffer to small, could not use\n"));
- return err;
+ fprintf(stderr, _("buffer to small, could not use\n"));
+ return -EINVAL;
}
/* write the parameters to device */
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
- printf(_("Unable to set hw params for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set hw params for playback: %s\n"), snd_strerror(err));
return err;
}
@@ -386,35 +386,35 @@ static int set_swparams(snd_pcm_t *handl
/* get the current swparams */
err = snd_pcm_sw_params_current(handle, swparams);
if (err < 0) {
- printf(_("Unable to determine current swparams for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to determine current swparams for playback: %s\n"), snd_strerror(err));
return err;
}
/* start the transfer when a buffer is full */
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, buffer_size);
if (err < 0) {
- printf(_("Unable to set start threshold mode for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set start threshold mode for playback: %s\n"), snd_strerror(err));
return err;
}
/* allow the transfer when at least period_size frames can be processed */
err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_size);
if (err < 0) {
- printf(_("Unable to set avail min for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set avail min for playback: %s\n"), snd_strerror(err));
return err;
}
/* align all transfers to 1 sample */
err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
if (err < 0) {
- printf(_("Unable to set transfer align for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set transfer align for playback: %s\n"), snd_strerror(err));
return err;
}
/* write the parameters to the playback device */
err = snd_pcm_sw_params(handle, swparams);
if (err < 0) {
- printf(_("Unable to set sw params for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set sw params for playback: %s\n"), snd_strerror(err));
return err;
}
@@ -429,7 +429,7 @@ static int xrun_recovery(snd_pcm_t *hand
if (err == -EPIPE) { /* under-run */
err = snd_pcm_prepare(handle);
if (err < 0)
- printf(_("Can't recovery from underrun, prepare failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Can't recovery from underrun, prepare failed: %s\n"), snd_strerror(err));
return 0;
}
else if (err == -ESTRPIPE) {
@@ -440,7 +440,7 @@ static int xrun_recovery(snd_pcm_t *hand
if (err < 0) {
err = snd_pcm_prepare(handle);
if (err < 0)
- printf(_("Can't recovery from suspend, prepare failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Can't recovery from suspend, prepare failed: %s\n"), snd_strerror(err));
}
return 0;
@@ -648,9 +648,9 @@ static int write_buffer(snd_pcm_t *handl
continue;
if (err < 0) {
- printf(_("Write error: %d,%s\n"), err, snd_strerror(err));
+ fprintf(stderr, _("Write error: %d,%s\n"), err, snd_strerror(err));
if (xrun_recovery(handle, err) < 0) {
- printf(_("xrun_recovery failed: %d,%s\n"), err, snd_strerror(err));
+ fprintf(stderr, _("xrun_recovery failed: %d,%s\n"), err, snd_strerror(err));
return -1;
}
break; /* skip one period */
@@ -683,6 +683,9 @@ static int write_loop(snd_pcm_t *handle,
return err;
}
+
+ if (periods <= 0)
+ periods = 1;
for(n = 0; n < periods; n++) {
if (test_type == TEST_PINK_NOISE)
@@ -847,7 +850,7 @@ int main(int argc, char *argv[]) {
speaker = speaker < 1 ? 0 : speaker;
speaker = speaker > channels ? 0 : speaker;
if (speaker==0) {
- printf(_("Invalid parameter for -s option.\n"));
+ fprintf(stderr, _("Invalid parameter for -s option.\n"));
exit(EXIT_FAILURE);
}
break;
@@ -858,7 +861,7 @@ int main(int argc, char *argv[]) {
wav_file_dir = optarg;
break;
default:
- printf(_("Unknown option '%c'\n"), c);
+ fprintf(stderr, _("Unknown option '%c'\n"), c);
exit(EXIT_FAILURE);
break;
}
@@ -908,7 +911,7 @@ int main(int argc, char *argv[]) {
initialize_pink_noise(&pink, 16);
if (frames == NULL) {
- printf(_("No enough memory\n"));
+ fprintf(stderr, _("No enough memory\n"));
exit(EXIT_FAILURE);
}
if (speaker==0) {
@@ -939,7 +942,7 @@ int main(int argc, char *argv[]) {
err = write_loop(handle, channel, ((rate*3)/period_size), frames);
if (err < 0) {
- printf(_("Transfer failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err));
free(frames);
snd_pcm_close(handle);
exit(EXIT_SUCCESS);
@@ -961,7 +964,7 @@ int main(int argc, char *argv[]) {
err = write_loop(handle, speaker-1, ((rate*5)/period_size), frames);
if (err < 0) {
- printf(_("Transfer failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err));
}
}

View File

@ -1,21 +0,0 @@
# HG changeset patch
# User cladisch
# Date 1196406844 -3600
# Node ID b57d8cd4f4900d029176850cd7d706a7e135a394
# Parent 05c093789c5e03b91af50baa8889b7356e18b42f
iecset: fix card index check
Allow card indices up to 31.
diff -r 05c093789c5e -r b57d8cd4f490 iecset/iecset.c
--- a/iecset/iecset.c Wed Nov 14 11:54:38 2007 +0100
+++ b/iecset/iecset.c Fri Nov 30 08:14:04 2007 +0100
@@ -308,7 +308,7 @@ int main(int argc, char **argv)
break;
case 'c':
i = atoi(optarg);
- if (i < 0 || i >= 7) {
+ if (i < 0 || i >= 32) {
fprintf(stderr, "invalid card index %d\n", i);
return 1;
}

View File

@ -1,231 +0,0 @@
diff -r d121aa649daf -r 19947765f033 speaker-test/speaker-test.c
--- a/speaker-test/speaker-test.c Thu Oct 25 15:39:19 2007 +0200
+++ b/speaker-test/speaker-test.c Mon Nov 05 12:44:13 2007 +0100
@@ -276,28 +276,28 @@ static int set_hwparams(snd_pcm_t *handl
/* choose all parameters */
err = snd_pcm_hw_params_any(handle, params);
if (err < 0) {
- printf(_("Broken configuration for playback: no configurations available: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Broken configuration for playback: no configurations available: %s\n"), snd_strerror(err));
return err;
}
/* set the interleaved read/write format */
err = snd_pcm_hw_params_set_access(handle, params, access);
if (err < 0) {
- printf(_("Access type not available for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Access type not available for playback: %s\n"), snd_strerror(err));
return err;
}
/* set the sample format */
err = snd_pcm_hw_params_set_format(handle, params, format);
if (err < 0) {
- printf(_("Sample format not available for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Sample format not available for playback: %s\n"), snd_strerror(err));
return err;
}
/* set the count of channels */
err = snd_pcm_hw_params_set_channels(handle, params, channels);
if (err < 0) {
- printf(_("Channels count (%i) not available for playbacks: %s\n"), channels, snd_strerror(err));
+ fprintf(stderr, _("Channels count (%i) not available for playbacks: %s\n"), channels, snd_strerror(err));
return err;
}
@@ -305,12 +305,12 @@ static int set_hwparams(snd_pcm_t *handl
rrate = rate;
err = snd_pcm_hw_params_set_rate(handle, params, rate, 0);
if (err < 0) {
- printf(_("Rate %iHz not available for playback: %s\n"), rate, snd_strerror(err));
+ fprintf(stderr, _("Rate %iHz not available for playback: %s\n"), rate, snd_strerror(err));
return err;
}
if (rrate != rate) {
- printf(_("Rate doesn't match (requested %iHz, get %iHz, err %d)\n"), rate, rrate, err);
+ fprintf(stderr, _("Rate doesn't match (requested %iHz, get %iHz, err %d)\n"), rate, rrate, err);
return -EINVAL;
}
@@ -326,7 +326,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Requested period time %u us\n"), period_time);
err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, NULL);
if (err < 0) {
- printf(_("Unable to set period time %u us for playback: %s\n"),
+ fprintf(stderr, _("Unable to set period time %u us for playback: %s\n"),
period_time, snd_strerror(err));
return err;
}
@@ -335,7 +335,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Requested buffer time %u us\n"), buffer_time);
err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, NULL);
if (err < 0) {
- printf(_("Unable to set buffer time %u us for playback: %s\n"),
+ fprintf(stderr, _("Unable to set buffer time %u us for playback: %s\n"),
buffer_time, snd_strerror(err));
return err;
}
@@ -347,7 +347,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Using max buffer size %lu\n"), buffer_size);
err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size);
if (err < 0) {
- printf(_("Unable to set buffer size %lu for playback: %s\n"),
+ fprintf(stderr, _("Unable to set buffer size %lu for playback: %s\n"),
buffer_size, snd_strerror(err));
return err;
}
@@ -356,7 +356,7 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("Periods = %u\n"), nperiods);
err = snd_pcm_hw_params_set_periods_near(handle, params, &nperiods, NULL);
if (err < 0) {
- printf(_("Unable to set nperiods %u for playback: %s\n"),
+ fprintf(stderr, _("Unable to set nperiods %u for playback: %s\n"),
nperiods, snd_strerror(err));
return err;
}
@@ -366,14 +366,14 @@ static int set_hwparams(snd_pcm_t *handl
printf(_("was set period_size = %lu\n"),period_size);
printf(_("was set buffer_size = %lu\n"),buffer_size);
if (2*period_size > buffer_size) {
- printf(_("buffer to small, could not use\n"));
- return err;
+ fprintf(stderr, _("buffer to small, could not use\n"));
+ return -EINVAL;
}
/* write the parameters to device */
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
- printf(_("Unable to set hw params for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set hw params for playback: %s\n"), snd_strerror(err));
return err;
}
@@ -386,35 +386,35 @@ static int set_swparams(snd_pcm_t *handl
/* get the current swparams */
err = snd_pcm_sw_params_current(handle, swparams);
if (err < 0) {
- printf(_("Unable to determine current swparams for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to determine current swparams for playback: %s\n"), snd_strerror(err));
return err;
}
/* start the transfer when a buffer is full */
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, buffer_size);
if (err < 0) {
- printf(_("Unable to set start threshold mode for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set start threshold mode for playback: %s\n"), snd_strerror(err));
return err;
}
/* allow the transfer when at least period_size frames can be processed */
err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_size);
if (err < 0) {
- printf(_("Unable to set avail min for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set avail min for playback: %s\n"), snd_strerror(err));
return err;
}
/* align all transfers to 1 sample */
err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
if (err < 0) {
- printf(_("Unable to set transfer align for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set transfer align for playback: %s\n"), snd_strerror(err));
return err;
}
/* write the parameters to the playback device */
err = snd_pcm_sw_params(handle, swparams);
if (err < 0) {
- printf(_("Unable to set sw params for playback: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Unable to set sw params for playback: %s\n"), snd_strerror(err));
return err;
}
@@ -429,7 +429,7 @@ static int xrun_recovery(snd_pcm_t *hand
if (err == -EPIPE) { /* under-run */
err = snd_pcm_prepare(handle);
if (err < 0)
- printf(_("Can't recovery from underrun, prepare failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Can't recovery from underrun, prepare failed: %s\n"), snd_strerror(err));
return 0;
}
else if (err == -ESTRPIPE) {
@@ -440,7 +440,7 @@ static int xrun_recovery(snd_pcm_t *hand
if (err < 0) {
err = snd_pcm_prepare(handle);
if (err < 0)
- printf(_("Can't recovery from suspend, prepare failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Can't recovery from suspend, prepare failed: %s\n"), snd_strerror(err));
}
return 0;
@@ -648,9 +648,9 @@ static int write_buffer(snd_pcm_t *handl
continue;
if (err < 0) {
- printf(_("Write error: %d,%s\n"), err, snd_strerror(err));
+ fprintf(stderr, _("Write error: %d,%s\n"), err, snd_strerror(err));
if (xrun_recovery(handle, err) < 0) {
- printf(_("xrun_recovery failed: %d,%s\n"), err, snd_strerror(err));
+ fprintf(stderr, _("xrun_recovery failed: %d,%s\n"), err, snd_strerror(err));
return -1;
}
break; /* skip one period */
@@ -683,6 +683,9 @@ static int write_loop(snd_pcm_t *handle,
return err;
}
+
+ if (periods <= 0)
+ periods = 1;
for(n = 0; n < periods; n++) {
if (test_type == TEST_PINK_NOISE)
@@ -847,7 +850,7 @@ int main(int argc, char *argv[]) {
speaker = speaker < 1 ? 0 : speaker;
speaker = speaker > channels ? 0 : speaker;
if (speaker==0) {
- printf(_("Invalid parameter for -s option.\n"));
+ fprintf(stderr, _("Invalid parameter for -s option.\n"));
exit(EXIT_FAILURE);
}
break;
@@ -858,7 +861,7 @@ int main(int argc, char *argv[]) {
wav_file_dir = optarg;
break;
default:
- printf(_("Unknown option '%c'\n"), c);
+ fprintf(stderr, _("Unknown option '%c'\n"), c);
exit(EXIT_FAILURE);
break;
}
@@ -908,7 +911,7 @@ int main(int argc, char *argv[]) {
initialize_pink_noise(&pink, 16);
if (frames == NULL) {
- printf(_("No enough memory\n"));
+ fprintf(stderr, _("No enough memory\n"));
exit(EXIT_FAILURE);
}
if (speaker==0) {
@@ -939,7 +942,7 @@ int main(int argc, char *argv[]) {
err = write_loop(handle, channel, ((rate*3)/period_size), frames);
if (err < 0) {
- printf(_("Transfer failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err));
free(frames);
snd_pcm_close(handle);
exit(EXIT_SUCCESS);
@@ -961,7 +964,7 @@ int main(int argc, char *argv[]) {
err = write_loop(handle, speaker-1, ((rate*5)/period_size), frames);
if (err < 0) {
- printf(_("Transfer failed: %s\n"), snd_strerror(err));
+ fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err));
}
}

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Dec 14 15:38:02 CET 2007 - tiwai@suse.de
- updated to HG 2007.12.14 version:
* merged previous patches
* fix blocking mode around snd_pcm_drain() calls in aplay
-------------------------------------------------------------------
Fri Nov 30 17:55:38 CET 2007 - tiwai@suse.de

View File

@ -20,14 +20,9 @@ Requires: dialog pciutils
AutoReqProv: on
Summary: Advanced Linux Sound Architecture Utilities
Version: 1.0.15
Release: 14
Release: 16
Source: ftp://ftp.alsa-project.org/pub/util/alsa-utils-%{package_version}.tar.bz2
Patch: alsa-utils-hg-fixes.diff
Patch1: alsa-utils-speaker-test-fix.diff
Patch2: alsa-utils-alsactl-tlv-comment-fix.diff
Patch3: alsa-utils-alsactl-force-default.diff
Patch4: alsa-utils-iecset-index-fix.diff
Patch5: alsa-utils-alsactl-restore-fix.diff
Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -45,11 +40,6 @@ Authors:
%prep
%setup -q -n %{name}-%{package_version}
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
mv alsamixer/README alsamixer/README-alsamixer
%{?suse_update_config:%{suse_update_config -f .}}
@ -79,6 +69,10 @@ make DESTDIR=$RPM_BUILD_ROOT install
%{_datadir}/alsa
%changelog
* Fri Dec 14 2007 - tiwai@suse.de
- updated to HG 2007.12.14 version:
* merged previous patches
* fix blocking mode around snd_pcm_drain() calls in aplay
* Fri Nov 30 2007 - tiwai@suse.de
- Merge upstream fixes:
* make -F option as default for alsactl