OBS User unknown 2007-10-16 15:46:53 +00:00 committed by Git OBS Bridge
parent 4cfefef8cd
commit 148e04b211
6 changed files with 19 additions and 450 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:307d630f0ed15e7e92fa35dc0c961737fa9aed22bd7a4a6054a72f85145fa5cb
size 1013872

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3bb546e873df39159812168180eeff14b13620c653d90739ac0a0912e898aeac
size 1014199

View File

@ -1,99 +0,0 @@
# HG changeset patch
# User tiwai
# Date 1188391795 -7200
# Node ID 803dbe88476f8a1065ce85d9efe7f61df71cf32f
# Parent b230fef1ea76192e8cfaba252beaaca369ab085b
alsamixer - Handle capture enums separately
The capture enum controls should appear only in capture and all views.
This is a fix for Input Source enum controls.
diff -r b230fef1ea76 -r 803dbe88476f alsamixer/alsamixer.c
--- a/alsamixer/alsamixer.c Wed Aug 15 15:38:01 2007 +0200
+++ b/alsamixer/alsamixer.c Wed Aug 29 14:49:55 2007 +0200
@@ -210,7 +210,7 @@ enum {
MIXER_ELEM_FRONT, MIXER_ELEM_REAR,
MIXER_ELEM_CENTER, MIXER_ELEM_WOOFER,
MIXER_ELEM_CAPTURE,
- MIXER_ELEM_ENUM,
+ MIXER_ELEM_ENUM, MIXER_ELEM_CAPTURE_ENUM,
MIXER_ELEM_END
};
@@ -702,7 +702,7 @@ mixer_write_cbar (int elem_index)
/* enum list
*/
- if (type == MIXER_ELEM_ENUM) {
+ if (type == MIXER_ELEM_ENUM || type == MIXER_ELEM_CAPTURE_ENUM) {
if (mixer_volume_delta[MIXER_CHN_LEFT])
update_enum_list(elem, MIXER_CHN_LEFT, mixer_volume_delta[MIXER_CHN_LEFT]);
if (mixer_volume_delta[MIXER_CHN_RIGHT])
@@ -983,7 +983,7 @@ mixer_update_cbar (int elem_index)
snd_mixer_selem_get_playback_switch(elem, chn_right, &swr);
extra_info = !swl && !swr ? " [Off]" : "";
}
- if (type == MIXER_ELEM_ENUM) {
+ if (type == MIXER_ELEM_ENUM || type == MIXER_ELEM_CAPTURE_ENUM) {
/* FIXME: should show the item names of secondary and later channels... */
unsigned int eidx, length;
tmp[0]=' ';
@@ -1049,7 +1049,7 @@ mixer_update_cbar (int elem_index)
y--;
/* enum list? */
- if (type == MIXER_ELEM_ENUM) {
+ if (type == MIXER_ELEM_ENUM || type == MIXER_ELEM_CAPTURE_ENUM) {
display_enum_list(elem, y, x);
return; /* no more to display */
}
@@ -1752,7 +1752,7 @@ __again:
if (elem == NULL)
CHECK_ABORT (ERR_FCN, "snd_mixer_find_selem()", -EINVAL);
if ( (mixer_view == VIEW_PLAYBACK) || (mixer_view == VIEW_CHANNELS) ) {
- for (i = 0; i < MIXER_ELEM_CAPTURE; i++) {
+ for (i = MIXER_ELEM_FRONT; i <= MIXER_ELEM_WOOFER; i++) {
int ok;
for (j = ok = 0; j < 2; j++) {
if (mixer_changed_state)
@@ -1764,6 +1764,9 @@ __again:
sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * idx);
mixer_grpidx[elem_index] = idx;
if (snd_mixer_selem_is_enumerated(elem)) {
+ if (mixer_view == VIEW_PLAYBACK &&
+ snd_mixer_selem_is_enum_capture(elem))
+ continue;
mixer_type[elem_index] = MIXER_ELEM_ENUM;
} else {
mixer_type[elem_index] = i;
@@ -1795,15 +1798,23 @@ __again:
(nelems_added == 0 && snd_mixer_selem_has_capture_switch(elem)) &&
(mixer_view == VIEW_CAPTURE || !snd_mixer_selem_has_common_switch(elem)))
do_add = 1;
+ if (!do_add &&
+ mixer_view == VIEW_CAPTURE && snd_mixer_selem_is_enum_capture(elem))
+ do_add = 1;
+
if (do_add) {
mixer_grpidx[elem_index] = idx;
- mixer_type[elem_index] = MIXER_ELEM_CAPTURE;
- if (nelems_added == 0 && snd_mixer_selem_has_capture_switch(elem))
- mixer_type[elem_index] |= MIXER_ELEM_CAPTURE_SWITCH;
- if (nelems_added)
- mixer_type[elem_index] |= MIXER_ELEM_CAPTURE_SUFFIX;
- if (snd_mixer_selem_has_capture_volume(elem))
- mixer_type[elem_index] |= MIXER_ELEM_HAS_VOLUME;
+ if (snd_mixer_selem_is_enum_capture(elem))
+ mixer_type[elem_index] = MIXER_ELEM_CAPTURE_ENUM;
+ else {
+ mixer_type[elem_index] = MIXER_ELEM_CAPTURE;
+ if (nelems_added == 0 && snd_mixer_selem_has_capture_switch(elem))
+ mixer_type[elem_index] |= MIXER_ELEM_CAPTURE_SWITCH;
+ if (nelems_added)
+ mixer_type[elem_index] |= MIXER_ELEM_CAPTURE_SUFFIX;
+ if (snd_mixer_selem_has_capture_volume(elem))
+ mixer_type[elem_index] |= MIXER_ELEM_HAS_VOLUME;
+ }
elem_index++;
if (elem_index >= mixer_n_elems)
break;

View File

@ -1,338 +0,0 @@
diff -r 0c395cb93191 alsaconf/alsaconf.in
--- a/alsaconf/alsaconf.in Thu May 31 08:55:26 2007 +0200
+++ b/alsaconf/alsaconf.in Tue Aug 14 16:31:00 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 Tue Aug 14 16:31:00 2007 +0200
@@ -1154,6 +1154,34 @@ static int parse_simple_id(const char *s
return 0;
}
+static int get_ctl_enum_item_index(snd_ctl_t *handle, snd_ctl_elem_info_t *info,
+ char **ptrp)
+{
+ char *ptr = *ptrp;
+ int items, i, len;
+ const char *name;
+
+ items = snd_ctl_elem_info_get_items(info);
+ if (items <= 0)
+ return -1;
+
+ for (i = 0; i < items; i++) {
+ snd_ctl_elem_info_set_item(info, i);
+ if (snd_ctl_elem_info(handle, info) < 0)
+ return -1;
+ name = snd_ctl_elem_info_get_item_name(info);
+ len = strlen(name);
+ if (! strncmp(name, ptr, len)) {
+ if (! ptr[len] || ptr[len] == ',' || ptr[len] == '\n') {
+ ptr += len;
+ *ptrp = ptr;
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
static int cset(int argc, char *argv[], int roflag, int keep_handle)
{
int err;
@@ -1242,7 +1270,9 @@ static int cset(int argc, char *argv[],
snd_ctl_elem_value_set_integer64(control, idx, tmp);
break;
case SND_CTL_ELEM_TYPE_ENUMERATED:
- tmp = get_integer(&ptr, 0, snd_ctl_elem_info_get_items(info) - 1);
+ tmp = get_ctl_enum_item_index(handle, info, &ptr);
+ if (tmp < 0)
+ tmp = get_integer(&ptr, 0, snd_ctl_elem_info_get_items(info) - 1);
snd_ctl_elem_value_set_enumerated(control, idx, tmp);
break;
case SND_CTL_ELEM_TYPE_BYTES:
@@ -1369,67 +1399,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 +1445,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 +1525,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 Tue Aug 14 16:31:00 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 Tue Aug 14 16:31:00 2007 +0200
@@ -37,6 +37,7 @@
#include <ctype.h>
#include <errno.h>
#include <limits.h>
+#include <time.h>
#include <locale.h>
#include <alsa/asoundlib.h>
#include <assert.h>
@@ -322,7 +323,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 +1216,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 Tue Aug 14 16:31:00 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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 16 15:02:20 CEST 2007 - tiwai@suse.de
- updated to version 1.0.15-final
* including all previous patches
-------------------------------------------------------------------
Mon Sep 17 16:13:15 CEST 2007 - tiwai@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package alsa-utils (Version 1.0.14)
# spec file for package alsa-utils (Version 1.0.15)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -12,18 +12,17 @@
Name: alsa-utils
BuildRequires: alsa-devel ncurses-devel
%define package_version 1.0.14
%define package_version 1.0.15
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: 24
Version: 1.0.15
Release: 1
Source: ftp://ftp.alsa-project.org/pub/util/alsa-utils-%{package_version}.tar.bz2
Patch: alsa-utils-hg-fixes.diff
Patch1: alsa-utils-alsamixer-capture-enum-fix.diff
# Patch: alsa-utils-hg-fixes.diff
Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -35,13 +34,12 @@ Sound Architecture.
Authors:
--------
Jaroslav Kysela <perex@suse.de>
Jaroslav Kysela <perex@perex.cz>
Takashi Iwai <tiwai@suse.de>
%prep
%setup -q -n %{name}-%{package_version}
%patch -p1
%patch1 -p1
# %patch -p1
mv alsamixer/README alsamixer/README-alsamixer
%{?suse_update_config:%{suse_update_config -f .}}
@ -69,8 +67,10 @@ make DESTDIR=$RPM_BUILD_ROOT install
%{_sbindir}/*
%{_datadir}/sounds/alsa
%{_datadir}/alsa
%changelog
* Tue Oct 16 2007 - tiwai@suse.de
- updated to version 1.0.15-final
* including all previous patches
* Mon Sep 17 2007 - tiwai@suse.de
- fix the handling of capture enum elements in alsamixer (#325677)
* Tue Aug 14 2007 - tiwai@suse.de