diff --git a/alsa-utils-hg-fixes.diff b/alsa-utils-hg-fixes.diff new file mode 100644 index 0000000..907cd3d --- /dev/null +++ b/alsa-utils-hg-fixes.diff @@ -0,0 +1,284 @@ +diff -r 0c395cb93191 alsaconf/alsaconf.in +--- a/alsaconf/alsaconf.in Thu May 31 08:55:26 2007 +0200 ++++ b/alsaconf/alsaconf.in Wed Jul 25 02:01:08 2007 +0200 +@@ -896,7 +896,7 @@ BEGIN { in_sound=0; } + # set up /etc/sysconfig/hardware/* + if [ "$distribution" = "suse" ]; then + case "$suse_version" in +- 10.*|10) ++ 10.[012]*|10) + setup_hwcfg $CARD_DRIVER + ;; + esac +diff -r 0c395cb93191 amixer/amixer.c +--- a/amixer/amixer.c Thu May 31 08:55:26 2007 +0200 ++++ b/amixer/amixer.c Wed Jul 25 02:01:08 2007 +0200 +@@ -1369,67 +1369,35 @@ static int get_enum_item_index(snd_mixer + return -1; + } + +-static int sset(unsigned int argc, char *argv[], int roflag, int keep_handle) +-{ +- int err, check_flag; ++static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv) ++{ ++ unsigned int idx, chn = 0; ++ int check_flag = ignore_error ? 0 : -1; ++ ++ for (idx = 1; idx < argc; idx++) { ++ char *ptr = argv[idx]; ++ while (*ptr) { ++ int ival = get_enum_item_index(elem, &ptr); ++ if (ival < 0) ++ return check_flag; ++ if (snd_mixer_selem_set_enum_item(elem, chn, ival) >= 0) ++ check_flag = 1; ++ /* skip separators */ ++ while (*ptr == ',' || isspace(*ptr)) ++ ptr++; ++ } ++ } ++ return check_flag; ++} ++ ++static int sset_channels(snd_mixer_elem_t *elem, unsigned int argc, char **argv) ++{ ++ unsigned int channels = ~0U; ++ unsigned int dir = 3, okflag = 3; + unsigned int idx; + snd_mixer_selem_channel_id_t chn; +- unsigned int channels = ~0U; +- unsigned int dir = 3, okflag = 3; +- static snd_mixer_t *handle = NULL; +- snd_mixer_elem_t *elem; +- snd_mixer_selem_id_t *sid; +- snd_mixer_selem_id_alloca(&sid); +- +- if (argc < 1) { +- fprintf(stderr, "Specify a scontrol identifier: 'name',index\n"); +- return 1; +- } +- if (parse_simple_id(argv[0], sid)) { +- fprintf(stderr, "Wrong scontrol identifier: %s\n", argv[0]); +- return 1; +- } +- if (!roflag && argc < 2) { +- fprintf(stderr, "Specify what you want to set...\n"); +- return 1; +- } +- if (handle == NULL) { +- if ((err = snd_mixer_open(&handle, 0)) < 0) { +- error("Mixer %s open error: %s\n", card, snd_strerror(err)); +- return err; +- } +- if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) { +- error("Mixer attach %s error: %s", card, snd_strerror(err)); +- snd_mixer_close(handle); +- handle = NULL; +- return err; +- } +- if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) { +- error("Mixer register error: %s", snd_strerror(err)); +- snd_mixer_close(handle); +- handle = NULL; +- return err; +- } +- err = snd_mixer_load(handle); +- if (err < 0) { +- error("Mixer %s load error: %s", card, snd_strerror(err)); +- snd_mixer_close(handle); +- handle = NULL; +- return err; +- } +- } +- elem = snd_mixer_find_selem(handle, sid); +- if (!elem) { +- if (ignore_error) +- return 0; +- error("Unable to find simple control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); +- snd_mixer_close(handle); +- handle = NULL; +- return -ENOENT; +- } +- if (roflag) +- goto __skip_write; +- check_flag = 0; ++ int check_flag = ignore_error ? 0 : -1; ++ + for (idx = 1; idx < argc; idx++) { + char *ptr = argv[idx], *optr; + int multi, firstchn = 1; +@@ -1447,19 +1415,6 @@ static int sset(unsigned int argc, char + + if (!(channels & (1 << chn))) + continue; +- /* enum control */ +- if (snd_mixer_selem_is_enumerated(elem)) { +- int idx = get_enum_item_index(elem, &ptr); +- if (idx < 0) { +- break; +- } else { +- if (snd_mixer_selem_set_enum_item(elem, chn, idx) >= 0) +- check_flag = 1; +- } +- if (!multi) +- ptr = optr; +- continue; +- } + + if ((dir & 1) && snd_mixer_selem_has_playback_channel(elem, chn)) { + sptr = ptr; +@@ -1540,35 +1495,94 @@ static int sset(unsigned int argc, char + if (dir & 2) + error("Unknown capture setup '%s'..", ptr); + } +- if (! keep_handle) { +- snd_mixer_close(handle); +- handle = NULL; +- } +- return 0; ++ return 0; /* just skip it */ + } + if (!multi) + ptr = optr; + firstchn = 0; + } + } +- if (!check_flag) { +- error("Invalid command!"); +- if (! keep_handle) { ++ return check_flag; ++} ++ ++static int sset(unsigned int argc, char *argv[], int roflag, int keep_handle) ++{ ++ int err = 0; ++ static snd_mixer_t *handle = NULL; ++ snd_mixer_elem_t *elem; ++ snd_mixer_selem_id_t *sid; ++ snd_mixer_selem_id_alloca(&sid); ++ ++ if (argc < 1) { ++ fprintf(stderr, "Specify a scontrol identifier: 'name',index\n"); ++ return 1; ++ } ++ if (parse_simple_id(argv[0], sid)) { ++ fprintf(stderr, "Wrong scontrol identifier: %s\n", argv[0]); ++ return 1; ++ } ++ if (!roflag && argc < 2) { ++ fprintf(stderr, "Specify what you want to set...\n"); ++ return 1; ++ } ++ if (handle == NULL) { ++ if ((err = snd_mixer_open(&handle, 0)) < 0) { ++ error("Mixer %s open error: %s\n", card, snd_strerror(err)); ++ return err; ++ } ++ if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) { ++ error("Mixer attach %s error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + handle = NULL; +- } +- return 1; +- } +- __skip_write: ++ return err; ++ } ++ if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) { ++ error("Mixer register error: %s", snd_strerror(err)); ++ snd_mixer_close(handle); ++ handle = NULL; ++ return err; ++ } ++ err = snd_mixer_load(handle); ++ if (err < 0) { ++ error("Mixer %s load error: %s", card, snd_strerror(err)); ++ snd_mixer_close(handle); ++ handle = NULL; ++ return err; ++ } ++ } ++ elem = snd_mixer_find_selem(handle, sid); ++ if (!elem) { ++ if (ignore_error) ++ return 0; ++ error("Unable to find simple control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); ++ snd_mixer_close(handle); ++ handle = NULL; ++ return -ENOENT; ++ } ++ if (!roflag) { ++ /* enum control */ ++ if (snd_mixer_selem_is_enumerated(elem)) ++ err = sset_enum(elem, argc, argv); ++ else ++ err = sset_channels(elem, argc, argv); ++ ++ if (!err) ++ goto done; ++ if (err < 0) { ++ error("Invalid command!"); ++ goto done; ++ } ++ } + if (!quiet) { + printf("Simple mixer control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + show_selem(handle, sid, " ", 1); + } ++ done: + if (! keep_handle) { + snd_mixer_close(handle); + handle = NULL; + } +- return 0; ++ return err < 0 ? 1 : 0; + } + + static void events_info(snd_hctl_elem_t *helem) +diff -r 0c395cb93191 aplay/Makefile.am +--- a/aplay/Makefile.am Thu May 31 08:55:26 2007 +0200 ++++ b/aplay/Makefile.am Wed Jul 25 02:01:08 2007 +0200 +@@ -1,5 +1,5 @@ INCLUDES = -I$(top_srcdir)/include + INCLUDES = -I$(top_srcdir)/include +-LDADD = -lasound $(LIBINTL) ++LDADD = $(LIBINTL) + + # debug flags + #LDFLAGS = -static +diff -r 0c395cb93191 aplay/aplay.c +--- a/aplay/aplay.c Thu May 31 08:55:26 2007 +0200 ++++ b/aplay/aplay.c Wed Jul 25 02:01:08 2007 +0200 +@@ -322,7 +322,7 @@ static void signal_handler(int sig) + close(fd); + fd = -1; + } +- if (handle) { ++ if (handle && sig != SIGABRT) { + snd_pcm_close(handle); + handle = NULL; + } +@@ -1215,10 +1215,10 @@ static void compute_max_peak(u_char *dat + putchar('\r'); + for (val = 0; val <= perc / 2 && val < 50; val++) + putchar('#'); +- for (; val < maxperc / 2 && val < 50; val++) ++ for (; val <= maxperc / 2 && val < 50; val++) + putchar(' '); + putchar('+'); +- for (++val; val < 50; val++) ++ for (++val; val <= 50; val++) + putchar(' '); + + printf("| %02i%%", maxperc); +diff -r 0c395cb93191 speaker-test/Makefile.am +--- a/speaker-test/Makefile.am Thu May 31 08:55:26 2007 +0200 ++++ b/speaker-test/Makefile.am Wed Jul 25 02:01:08 2007 +0200 +@@ -1,6 +1,6 @@ INCLUDES = -I$(top_srcdir)/include + INCLUDES = -I$(top_srcdir)/include + SUBDIRS= samples +-LDADD = $(LIBINTL) ++LDADD = $(LIBINTL) -lm + + bin_PROGRAMS = speaker-test + speaker_test_SOURCES = speaker-test.c pink.c diff --git a/alsa-utils.changes b/alsa-utils.changes index dd9d64c..4941869 100644 --- a/alsa-utils.changes +++ b/alsa-utils.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Jul 30 19:01:41 CEST 2007 - tiwai@suse.de + +- HG fixes (as of 2007.07.28) + * don't install hwcfg file for openSUSE 10.3 in alsaconf + * fix the handling of enum channels in amixer + * fix VU meter of aplay + * fix possible infinite loop with signal handler in aplay + ------------------------------------------------------------------- Thu May 31 12:26:10 CEST 2007 - tiwai@suse.de diff --git a/alsa-utils.spec b/alsa-utils.spec index 551a8cf..c6d2aaa 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -13,16 +13,16 @@ Name: alsa-utils BuildRequires: alsa-devel ncurses-devel %define package_version 1.0.14 -License: GNU General Public License (GPL) +License: GPL v2 or later Group: Productivity/Multimedia/Sound/Players Provides: alsa-conf Requires: dialog pciutils Autoreqprov: on Summary: Advanced Linux Sound Architecture Utilities Version: 1.0.14 -Release: 1 +Release: 13 Source: ftp://ftp.alsa-project.org/pub/util/alsa-utils-%{package_version}.tar.bz2 -# Patch: alsa-utils-hg-fixes.diff +Patch: alsa-utils-hg-fixes.diff URL: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -39,7 +39,7 @@ Authors: %prep %setup -q -n %{name}-%{package_version} -# %patch -p1 +%patch -p1 mv alsamixer/README alsamixer/README-alsamixer %{?suse_update_config:%{suse_update_config -f .}} @@ -69,6 +69,12 @@ make DESTDIR=$RPM_BUILD_ROOT install %{_datadir}/alsa %changelog +* Mon Jul 30 2007 - tiwai@suse.de +- HG fixes (as of 2007.07.28) + * don't install hwcfg file for openSUSE 10.3 in alsaconf + * fix the handling of enum channels in amixer + * fix VU meter of aplay + * fix possible infinite loop with signal handler in aplay * Thu May 31 2007 - tiwai@suse.de - updated to version 1.0.14-final including previous HG fixes