OBS User unknown 2009-05-28 20:53:59 +00:00 committed by Git OBS Bridge
parent f99311d187
commit 8cab7bf09b
4 changed files with 101 additions and 5 deletions

73
alsa-lib-git-fixes.diff Normal file
View File

@ -0,0 +1,73 @@
diff --git a/src/control/cards.c b/src/control/cards.c
index 4d2c739..6208c73 100644
--- a/src/control/cards.c
+++ b/src/control/cards.c
@@ -39,27 +39,40 @@
#define SND_FILE_LOAD ALOAD_DEVICE_DIRECTORY "aloadC%i"
#endif
-static int snd_card_load1(int card)
+static int snd_card_load2(const char *control)
{
int open_dev;
+ snd_ctl_card_info_t info;
+
+ open_dev = snd_open_device(control, O_RDONLY);
+ if (open_dev >= 0) {
+ if (ioctl(open_dev, SNDRV_CTL_IOCTL_CARD_INFO, &info) < 0) {
+ int err = -errno;
+ close(open_dev);
+ return err;
+ }
+ close(open_dev);
+ return info.card;
+ } else {
+ return -errno;
+ }
+}
+
+static int snd_card_load1(int card)
+{
+ int res;
char control[sizeof(SND_FILE_CONTROL) + 10];
sprintf(control, SND_FILE_CONTROL, card);
-
- open_dev = snd_open_device(control, O_RDONLY);
+ res = snd_card_load2(control);
#ifdef SUPPORT_ALOAD
- if (open_dev < 0) {
+ if (res < 0) {
char aload[sizeof(SND_FILE_LOAD) + 10];
sprintf(aload, SND_FILE_LOAD, card);
- open_dev = snd_open_device(aload, O_RDONLY);
+ res = snd_card_load2(aload);
}
#endif
- if (open_dev >= 0) {
- close (open_dev);
- return 0;
- } else {
- return -errno;
- }
+ return res;
}
/**
@@ -107,6 +120,7 @@ int snd_card_next(int *rcard)
*
* The accepted format is an integer value in ASCII representation
* or the card identifier (the id parameter for sound-card drivers).
+ * The control device name like /dev/snd/controlC0 is accepted, too.
*/
int snd_card_get_index(const char *string)
{
@@ -127,6 +141,8 @@ int snd_card_get_index(const char *string)
return card;
return err;
}
+ if (string[0] == '/') /* device name */
+ return snd_card_load2(string);
for (card = 0; card < 32; card++) {
#ifdef SUPPORT_ALOAD
if (! snd_card_load(card))

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu May 28 15:37:47 CEST 2009 - tiwai@suse.de
- adjust more volumes in set_default_volume script
-------------------------------------------------------------------
Wed May 20 10:22:40 CEST 2009 - tiwai@suse.de
- extend snd_card_get_index() to accept the device path name
-------------------------------------------------------------------
Wed May 6 18:03:45 CEST 2009 - tiwai@suse.de

View File

@ -34,7 +34,7 @@ Obsoletes: alsa-64bit
#
Summary: Advanced Linux Sound Architecture
Version: 1.0.20
Release: 1
Release: 2
Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2
Source8: 40-alsa.rules
Source11: alsasound
@ -50,7 +50,7 @@ Source31: all_notes_off.bin
Source32: all_notes_off.mid
Source33: alsa-info.sh
Source34: alsa-init.sh
# Patch: alsa-lib-git-fixes.diff
Patch: alsa-lib-git-fixes.diff
Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -122,7 +122,7 @@ Authors:
%prep
%setup -q -n alsa-lib-%{package_version}
# %patch -p1
%patch -p1
# hack to fix build on older distros
%if %suse_version < 1100
%ifarch %ix86
@ -251,6 +251,10 @@ exit 0
%{_datadir}/alsa
%changelog
* Thu May 28 2009 tiwai@suse.de
- adjust more volumes in set_default_volume script
* Wed May 20 2009 tiwai@suse.de
- extend snd_card_get_index() to accept the device path name
* Wed May 06 2009 tiwai@suse.de
- updated alsa-lib to version 1.0.20:
* including previous fixes

View File

@ -23,6 +23,8 @@ if [ -n "$1" ]; then
*)
card="-D $1";;
esac
else
card="-D hw"
fi
amixer -q -s $card <<EOF
@ -31,13 +33,13 @@ set Master -12dB
set 'Master Mono' 75% unmute
set 'Master Mono' -12dB
set Front 75% unmute
set Front -12dB
set Front 0dB
set PCM 90% unmute
set PCM 0dB
set Synth 90% unmute
set Synth 0dB
set Speaker 90% unmute
set Speaker -12dB
set Speaker 0dB
set CD 90% unmute
set CD 0dB
# mute mic
@ -65,6 +67,13 @@ set Playback 100% unmute
# turn off digital switches
set "SB Live Analog/Digital Output Jack" off
set "Audigy Analog/Digital Output Jack" off
# VIA82xx
set "VIX DXS" 100%
set "VIX DXS",1 100%
set "VIX DXS",2 100%
set "VIX DXS",3 100%
# capture
set Capture 12dB cap
EOF
exit 0