Accepting request 122932 from multimedia:libs

- backport upstream fixes:
  * Add support for Echo3G devices
  * Blacklist iec958 for some USB devices
  * Remove redundant CHECK_ENUM() from snd_mixer_selem_is_enum*()
  * Document fixes / updates
  * Add ability to specify TLV data to external control plugins
  * Fix invalid long long format specifier
  * Fix missing break in PCM non-interleaved mmap handling
  * improve robustness of TLV raw value ranges

OBS-URL: https://build.opensuse.org/request/show/122932
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa?expand=0&rev=119
This commit is contained in:
Stephan Kulow 2012-06-01 05:19:21 +00:00 committed by Git OBS Bridge
commit a72f20f5f7
16 changed files with 1036 additions and 2 deletions

View File

@ -0,0 +1,355 @@
From 65298d98f3b1222001283a2bfc92eecb12096def Mon Sep 17 00:00:00 2001
From: Luke Yelavich <luke.yelavich@canonical.com>
Date: Wed, 8 Feb 2012 15:09:55 +1100
Subject: [PATCH 01/14] conf/pcm: Add support for Echo3G devices. Thanks to
unimatrix.
BugLink: https://bugs.launchpad.net/bugs/433573
Signed-off-by: Luke Yelavich <luke.yelavich@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/conf/cards/Echo_Echo3G.conf | 318 +++++++++++++++++++++++++++++++++++++++
src/conf/cards/Makefile.am | 1 +
2 files changed, 319 insertions(+)
create mode 100644 src/conf/cards/Echo_Echo3G.conf
diff --git a/src/conf/cards/Echo_Echo3G.conf b/src/conf/cards/Echo_Echo3G.conf
new file mode 100644
index 0000000..766f13f
--- /dev/null
+++ b/src/conf/cards/Echo_Echo3G.conf
@@ -0,0 +1,318 @@
+#
+# Configuration for the Echo3G driver
+#
+
+<confdir:pcm/front.conf>
+Echo_Echo3G.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 0
+ subdevice 0
+}
+
+<confdir:pcm/rear.conf>
+Echo_Echo3G.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 0
+ subdevice 4
+}
+
+<confdir:pcm/center_lfe.conf>
+Echo_Echo3G.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 0
+ subdevice 2
+}
+
+<confdir:pcm/side.conf>
+Echo_Echo3G.pcm.side.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 0
+ subdevice 6
+}
+
+<confdir:pcm/surround40.conf>
+Echo_Echo3G.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround41.conf>
+Echo_Echo3G.pcm.surround41.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ ]
+}
+
+<confdir:pcm/surround50.conf>
+Echo_Echo3G.pcm.surround50.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround51.conf>
+Echo_Echo3G.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround71.conf>
+Echo_Echo3G.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Echo_Echo3G.pcm.side.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ { slave 3 channel 0 }
+ { slave 3 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+Echo_Echo3G.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/src/conf/cards/Makefile.am b/src/conf/cards/Makefile.am
index b7190e7..ee7991b 100644
--- a/src/conf/cards/Makefile.am
+++ b/src/conf/cards/Makefile.am
@@ -19,6 +19,7 @@ cfg_files = aliases.conf \
CMI8738-MC8.conf \
CMI8788.conf \
CS46xx.conf \
+ Echo_Echo3G.conf \
EMU10K1.conf \
EMU10K1X.conf \
ENS1370.conf \
--
1.7.9.2

View File

@ -0,0 +1,41 @@
From 1a9627dfe74d373010bbd41d738eda25e03f2231 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Fri, 9 Mar 2012 11:46:06 +0100
Subject: [PATCH 02/14] USB-Audio: Blacklist iec958 for some USB devices
Some common USB devices are analog only, so prevent the digital
devices from being opened. This simplifies probing the device
in PulseAudio.
I have a "Logitech USB Headset" myself, the "Logitech Web Camera"
was reported by Raymond Yau, and the "Blue Snowball" was reported by
Andy Whitcroft.
Cc: Andy Whitcroft <andy.whitcroft@canonical.com>
Cc: Raymond Yau <superquad.vortex2@gmail.com>
BugLink: https://bugs.launchpad.net/bugs/940145
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/conf/cards/USB-Audio.conf | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
index 0726c34..d7c121e 100644
--- a/src/conf/cards/USB-Audio.conf
+++ b/src/conf/cards/USB-Audio.conf
@@ -36,6 +36,11 @@ USB-Audio.pcm.surround40_type {
# number for the iec958 device can be changed here.
USB-Audio.pcm.iec958_device {
# "NoiseBlaster 3000" 42
+
+ # The below don't have digital in/out, so prevent them from being opened.
+ "Logitech USB Headset" 999
+ "Logitech Web Camera" 999
+ "Blue Snowball" 999
}
--
1.7.9.2

View File

@ -0,0 +1,28 @@
From 947d208076e3e7e7ff167833ec3335804a6b7d2a Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Fri, 9 Mar 2012 14:06:04 +0100
Subject: [PATCH 03/14] USB-Audio: Fixup card name for Logitech web camera
Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/conf/cards/USB-Audio.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
index d7c121e..966172f 100644
--- a/src/conf/cards/USB-Audio.conf
+++ b/src/conf/cards/USB-Audio.conf
@@ -39,7 +39,7 @@ USB-Audio.pcm.iec958_device {
# The below don't have digital in/out, so prevent them from being opened.
"Logitech USB Headset" 999
- "Logitech Web Camera" 999
+ "USB Device 0x46d:0x992" 999
"Blue Snowball" 999
}
--
1.7.9.2

View File

@ -0,0 +1,37 @@
From 2ab86d96c9c9f63212eee89f92f516d537b086e1 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 13 Mar 2012 14:30:22 +0100
Subject: [PATCH 04/14] mixer: Remove redundant CHECK_ENUM() from
snd_mixer_selem_is_enum*()
The functions to check whether the element is an enum don't need the
extra check of the type. It should return simply 0 or 1 without error.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/mixer/simple.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/mixer/simple.c b/src/mixer/simple.c
index 8079fe7..ec22a9c 100644
--- a/src/mixer/simple.c
+++ b/src/mixer/simple.c
@@ -889,7 +889,6 @@ int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem)
int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem)
{
CHECK_BASIC(elem);
- CHECK_ENUM(elem);
return sm_selem_ops(elem)->is(elem, SM_PLAY, SM_OPS_IS_ENUMERATED, 1);
}
@@ -901,7 +900,6 @@ int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem)
int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem)
{
CHECK_BASIC(elem);
- CHECK_ENUM(elem);
return sm_selem_ops(elem)->is(elem, SM_CAPT, SM_OPS_IS_ENUMERATED, 1);
}
--
1.7.9.2

View File

@ -0,0 +1,38 @@
From 193724743965d4548d632ebfde15c0c5d3c44e9d Mon Sep 17 00:00:00 2001
From: Henning Thielemann <alsa@henning-thielemann.de>
Date: Wed, 14 Mar 2012 18:45:02 +0100
Subject: [PATCH 05/14] seqmid - more descriptions on snd_seq_parse_address()
behavior
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/seq/seqmid.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/seq/seqmid.c b/src/seq/seqmid.c
index 894c3a2..2ff7e8d 100644
--- a/src/seq/seqmid.c
+++ b/src/seq/seqmid.c
@@ -378,9 +378,18 @@ int snd_seq_sync_output_queue(snd_seq_t *seq)
* \return 0 on success or negative error code
*
* This function parses the sequencer client and port numbers from the given string.
- * The client and port tokes are separated by either colon or period, e.g. 128:1.
+ * The client and port tokens are separated by either colon or period, e.g. 128:1.
* When \a seq is not NULL, the function accepts also a client name not only
* digit numbers.
+ * Actually \a arg need to be only a prefix of the wanted client.
+ * That is, if a client named "Foobar XXL Master 2012" with number 128 is available,
+ * then parsing "Foobar" will return the address 128:0.
+ * However parsing is biased towards small client numbers,
+ * thus if also a client named "Foobar" with number 129 exists,
+ * then parsing will still yield address 128:0 and not 129:0.
+ * If you want be able to access all clients by prefixes
+ * then you must write your own parser that checks for matching client names
+ * in the order of increasing name lengths.
*/
int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *arg)
{
--
1.7.9.2

View File

@ -0,0 +1,37 @@
From e5c4c248a1ad6a84140759bfe6a26348c222a929 Mon Sep 17 00:00:00 2001
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Date: Tue, 27 Mar 2012 17:54:47 +0200
Subject: [PATCH 06/14] doc: Fix typo in PCM formats
Of course, 24bit samples are not stored in three bits, but bytes.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index ea1afdc..18b43b3 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -209,13 +209,13 @@ The device is physicaly disconnected. It does not accept any I/O calls in this s
\section pcm_formats PCM formats
The full list of formats present the #snd_pcm_format_t type.
-The 24-bit linear samples uses 32-bit physical space, but the sample is
-stored in low three bits. Some hardware does not support processing of full
+The 24-bit linear samples use 32-bit physical space, but the sample is
+stored in the lower three bytes. Some hardware does not support processing of full
range, thus you may get the significant bits for linear samples via
#snd_pcm_hw_params_get_sbits() function. The example: ICE1712
chips support 32-bit sample processing, but low byte is ignored (playback)
or zero (capture). The function snd_pcm_hw_params_get_sbits()
-returns 24 in the case.
+returns 24 in this case.
\section alsa_transfers ALSA transfers
--
1.7.9.2

View File

@ -0,0 +1,30 @@
From ed0e48583fbd9dc9d86dad25bb26ac089b9e3528 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Sat, 14 Apr 2012 01:14:09 +0200
Subject: [PATCH 07/14] alsa-lib conf: block S/PDIF access for Sennheiser USB
headset
The Sennheiser USB headset has no S/PDIF input or output, so make
sure we can't open it that way.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/conf/cards/USB-Audio.conf | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
index 966172f..b9148e7 100644
--- a/src/conf/cards/USB-Audio.conf
+++ b/src/conf/cards/USB-Audio.conf
@@ -38,6 +38,7 @@ USB-Audio.pcm.iec958_device {
# "NoiseBlaster 3000" 42
# The below don't have digital in/out, so prevent them from being opened.
+ "Sennheiser USB headset" 999
"Logitech USB Headset" 999
"USB Device 0x46d:0x992" 999
"Blue Snowball" 999
--
1.7.9.2

View File

@ -0,0 +1,139 @@
From a6c50d64d9d06cece520d0ab9b109990241af47b Mon Sep 17 00:00:00 2001
From: Dylan Reid <dgreid@chromium.org>
Date: Sun, 15 Apr 2012 16:59:55 -0700
Subject: [PATCH 08/14] control_external: Add ability to specify TLV data.
Allow external control plugins to provide TLV data. This allows
user-space pcms to specify dB ranges for controls.
This follows the same model as the ALSA drivers for accessing the
data. The code is based on that implementation. The control can
provide static data or a callback. The data is accessed or modified
in the new snd_ctl_ext_elem_tlv callback.
Rev bump the protocol version to enable checking if an external
control supports TLV.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/control_external.h | 17 +++++++++++++++-
src/control/control_ext.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/include/control_external.h b/include/control_external.h
index 7c066cf..5392ea6 100644
--- a/include/control_external.h
+++ b/include/control_external.h
@@ -60,13 +60,16 @@ typedef struct snd_ctl_ext snd_ctl_ext_t;
typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t;
/** Key to access a control pointer */
typedef unsigned long snd_ctl_ext_key_t;
+/** Callback to handle TLV commands. */
+typedef int (snd_ctl_ext_tlv_rw_t)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int op_flag, unsigned int numid,
+ unsigned int *tlv, unsigned int tlv_size);
/*
* Protocol version
*/
#define SND_CTL_EXT_VERSION_MAJOR 1 /**< Protocol major version */
#define SND_CTL_EXT_VERSION_MINOR 0 /**< Protocol minor version */
-#define SND_CTL_EXT_VERSION_TINY 0 /**< Protocol tiny version */
+#define SND_CTL_EXT_VERSION_TINY 1 /**< Protocol tiny version */
/**
* external plugin protocol version
*/
@@ -122,6 +125,13 @@ struct snd_ctl_ext {
* control handle filled by #snd_ctl_ext_create()
*/
snd_ctl_t *handle;
+ /**
+ * optional TLV data for the control.
+ */
+ union {
+ snd_ctl_ext_tlv_rw_t *c;
+ const unsigned int *p;
+ } tlv;
int nonblock; /**< non-block mode; read-only */
int subscribed; /**< events subscribed; read-only */
@@ -245,7 +255,12 @@ typedef enum snd_ctl_ext_access {
SND_CTL_EXT_ACCESS_WRITE = (1<<1),
SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
+ SND_CTL_EXT_ACCESS_TLV_READ = (1<<4),
+ SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5),
+ SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4),
+ SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6),
SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
+ SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28),
} snd_ctl_ext_access_t;
/**
diff --git a/src/control/control_ext.c b/src/control/control_ext.c
index e20d4f3..cc30766 100644
--- a/src/control/control_ext.c
+++ b/src/control/control_ext.c
@@ -324,6 +324,51 @@ static int snd_ctl_ext_elem_unlock(snd_ctl_t *handle ATTRIBUTE_UNUSED,
return -ENXIO;
}
+static int snd_ctl_ext_elem_tlv(snd_ctl_t *handle, int op_flag,
+ unsigned int numid,
+ unsigned int *tlv, unsigned int tlv_size)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+ snd_ctl_ext_key_t key;
+ int type, ret;
+ unsigned int access, count, len;
+ snd_ctl_elem_id_t id;
+
+ /* we don't support TLV on protocol ver 1.0.0 or earlier */
+ if (ext->version <= SNDRV_PROTOCOL_VERSION(1, 0, 0))
+ return -ENXIO;
+
+ snd_ctl_elem_id_clear(&id);
+ if (numid > 0) {
+ ext->callback->elem_list(ext, numid - 1, &id);
+ id.numid = numid;
+ } else
+ id.numid = 0;
+ key = ext->callback->find_elem(ext, &id);
+
+ if (key == SND_CTL_EXT_KEY_NOT_FOUND)
+ return -ENOENT;
+ ret = ext->callback->get_attribute(ext, key, &type, &access, &count);
+ if (ret < 0)
+ return ret;
+
+ if ((op_flag == 0 && (access & SND_CTL_EXT_ACCESS_TLV_READ) == 0) ||
+ (op_flag > 0 && (access & SND_CTL_EXT_ACCESS_TLV_WRITE) == 0) ||
+ (op_flag < 0 && (access & SND_CTL_EXT_ACCESS_TLV_COMMAND) == 0))
+ return -ENXIO;
+ if (access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
+ return ext->tlv.c(ext, key, op_flag, numid, tlv, tlv_size);
+ } else {
+ if (op_flag)
+ return -ENXIO;
+ len = ext->tlv.p[1] + 2 * sizeof(unsigned int);
+ if (tlv_size < len)
+ return -ENOMEM;
+ memcpy(tlv, ext->tlv.p, len);
+ return 0;
+ }
+}
+
static int snd_ctl_ext_next_device(snd_ctl_t *handle ATTRIBUTE_UNUSED,
int *device ATTRIBUTE_UNUSED)
{
@@ -429,6 +474,7 @@ static const snd_ctl_ops_t snd_ctl_ext_ops = {
.element_write = snd_ctl_ext_elem_write,
.element_lock = snd_ctl_ext_elem_lock,
.element_unlock = snd_ctl_ext_elem_unlock,
+ .element_tlv = snd_ctl_ext_elem_tlv,
.hwdep_next_device = snd_ctl_ext_next_device,
.hwdep_info = snd_ctl_ext_hwdep_info,
.pcm_next_device = snd_ctl_ext_next_device,
--
1.7.9.2

View File

@ -0,0 +1,40 @@
From bb5c49fa4160ec1d819fb03fc8dfb5387dad0522 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Mon, 23 Apr 2012 10:39:13 +0200
Subject: [PATCH 09/14] alsa-lib conf: Add two more USB devices to iec958
blacklist
Add "Logitech Wireless Headset" and "Logitech Speaker Lapdesk N700" to
the iec958 blacklist.
Also reorder the list in alphabetic order.
BugLink: https://bugs.launchpad.net/bugs/987163
Reported-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/conf/cards/USB-Audio.conf | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
index b9148e7..0a0e374 100644
--- a/src/conf/cards/USB-Audio.conf
+++ b/src/conf/cards/USB-Audio.conf
@@ -38,10 +38,12 @@ USB-Audio.pcm.iec958_device {
# "NoiseBlaster 3000" 42
# The below don't have digital in/out, so prevent them from being opened.
- "Sennheiser USB headset" 999
+ "Blue Snowball" 999
+ "Logitech Speaker Lapdesk N700" 999
"Logitech USB Headset" 999
+ "Logitech Wireless Headset" 999
+ "Sennheiser USB headset" 999
"USB Device 0x46d:0x992" 999
- "Blue Snowball" 999
}
--
1.7.9.2

View File

@ -0,0 +1,68 @@
From 1d3f7975f920f47e6a8a324f547da2180e64171a Mon Sep 17 00:00:00 2001
From: John Spencer <maillist-alsa@barfooze.de>
Date: Tue, 24 Apr 2012 12:58:48 +0200
Subject: [PATCH 10/14] Fix invalid long long format specifier
Per POSIX:
L Specifies that a following a, A, e, E, f, F, g, or G conversion
specifier applies to a long double argument.
L is only intended to be used with long doubles, not long long ints.
the proper way is to use "ll" instead.
Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/conf.c | 6 +++---
test/midiloop.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf.c b/src/conf.c
index 5b1b5a6..32446a2 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -496,7 +496,7 @@ static int safe_strtoll(const char *str, long long *val)
if (!*str)
return -EINVAL;
errno = 0;
- if (sscanf(str, "%Li%n", &v, &endidx) < 1)
+ if (sscanf(str, "%lli%n", &v, &endidx) < 1)
return -EINVAL;
if (str[endidx])
return -EINVAL;
@@ -1378,7 +1378,7 @@ static int _snd_config_save_node_value(snd_config_t *n, snd_output_t *out,
snd_output_printf(out, "%ld", n->u.integer);
break;
case SND_CONFIG_TYPE_INTEGER64:
- snd_output_printf(out, "%Ld", n->u.integer64);
+ snd_output_printf(out, "%lld", n->u.integer64);
break;
case SND_CONFIG_TYPE_REAL:
snd_output_printf(out, "%-16g", n->u.real);
@@ -2630,7 +2630,7 @@ int snd_config_get_ascii(const snd_config_t *config, char **ascii)
{
char res[32];
int err;
- err = snprintf(res, sizeof(res), "%Li", config->u.integer64);
+ err = snprintf(res, sizeof(res), "%lli", config->u.integer64);
if (err < 0 || err == sizeof(res)) {
assert(0);
return -ENOMEM;
diff --git a/test/midiloop.c b/test/midiloop.c
index ee2e563..d6548b5 100644
--- a/test/midiloop.c
+++ b/test/midiloop.c
@@ -175,7 +175,7 @@ int main(int argc, char** argv)
printf("output.status.xruns = %zi\n", snd_rawmidi_status_get_xruns(ostat));
diff = timediff(end, start);
- printf("Time diff: %Liusec (%Li bytes/sec)\n", diff, ((long long)opos * 1000000) / diff);
+ printf("Time diff: %lliusec (%lli bytes/sec)\n", diff, ((long long)opos * 1000000) / diff);
if (verbose) {
fprintf(stderr,"Closing\n");
--
1.7.9.2

View File

@ -0,0 +1,36 @@
From b7334b1a81994bf3005a8999dd779c85683f86c0 Mon Sep 17 00:00:00 2001
From: Antonio Borneo <borneo.antonio@gmail.com>
Date: Sun, 13 May 2012 00:06:23 +0800
Subject: [PATCH 11/14] pcm: add missing "break" in "switch"
A missing "break" in procedure snd_pcm_write_mmap() causes
execution of "case SND_PCM_ACCESS_MMAP_NONINTERLEAVED" to
fall through next "default" case of the "switch" statement.
Since "default" handles error cases, the procedure returns
error.
The error fixed by this patch blocks transfer of capture
data from kernel to application. Execution get stuck in
alsa-lib, that discards all received data.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_mmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c
index 6b44050..83e74e5 100644
--- a/src/pcm/pcm_mmap.c
+++ b/src/pcm/pcm_mmap.c
@@ -622,6 +622,7 @@ snd_pcm_sframes_t snd_pcm_read_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
err = _snd_pcm_readn(pcm->fast_op_arg, bufs, frames);
if (err >= 0)
frames = err;
+ break;
}
default:
SNDMSG("invalid access type %d", pcm->access);
--
1.7.9.2

View File

@ -0,0 +1,26 @@
From afaffe80d9f18bd4e85e665bb078be9511855d51 Mon Sep 17 00:00:00 2001
From: Antonio Borneo <borneo.antonio@gmail.com>
Date: Mon, 14 May 2012 23:56:34 +0800
Subject: [PATCH 12/14] pcm_dsnoop: comment fall-through in next "case"
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_dsnoop.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c
index 988f1f4..bacb4ae 100644
--- a/src/pcm/pcm_dsnoop.c
+++ b/src/pcm/pcm_dsnoop.c
@@ -223,6 +223,7 @@ static int snd_pcm_dsnoop_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
err = snd_pcm_dsnoop_sync_ptr(pcm);
if (err < 0)
return err;
+ /* Fall through */
case SNDRV_PCM_STATE_PREPARED:
case SNDRV_PCM_STATE_SUSPENDED:
*delayp = snd_pcm_mmap_capture_hw_avail(pcm);
--
1.7.9.2

View File

@ -0,0 +1,84 @@
From 70b958f460a253f2cbdfd9773d54d489d3dcc4ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?=
<benoit.thebaudeau@advansee.com>
Date: Wed, 23 May 2012 01:53:01 +0200
Subject: [PATCH 13/14] tlv: improve robustness of raw value ranges
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
snd_tlv_convert_from_dB() relies on rangemin/max blindly.
Since this function is exported, it is better for robustness and
consistency to parse the range properly, which this patch does.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/control/tlv.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/src/control/tlv.c b/src/control/tlv.c
index f7c9976..6b0b9f4 100644
--- a/src/control/tlv.c
+++ b/src/control/tlv.c
@@ -291,41 +291,37 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
{
switch (tlv[0]) {
case SND_CTL_TLVT_DB_RANGE: {
- long dbmin, dbmax, prev_rangemax;
+ long dbmin, dbmax, prev_submax;
unsigned int pos, len;
len = int_index(tlv[1]);
- if (len > MAX_TLV_RANGE_SIZE)
- return -EINVAL;
- if (snd_tlv_get_dB_range(tlv, rangemin, rangemax,
- &dbmin, &dbmax))
+ if (len < 6 || len > MAX_TLV_RANGE_SIZE)
return -EINVAL;
- if (db_gain <= dbmin) {
- *value = rangemin;
- return 0;
- } else if (db_gain >= dbmax) {
- *value = rangemax;
- return 0;
- }
pos = 2;
- prev_rangemax = 0;
+ prev_submax = 0;
while (pos + 4 <= len) {
- rangemin = (int)tlv[pos];
- rangemax = (int)tlv[pos + 1];
+ long submin, submax;
+ submin = (int)tlv[pos];
+ submax = (int)tlv[pos + 1];
+ if (rangemax < submax)
+ submax = rangemax;
if (!snd_tlv_get_dB_range(tlv + pos + 2,
- rangemin, rangemax,
+ submin, submax,
&dbmin, &dbmax) &&
db_gain >= dbmin && db_gain <= dbmax)
return snd_tlv_convert_from_dB(tlv + pos + 2,
- rangemin, rangemax,
+ submin, submax,
db_gain, value, xdir);
else if (db_gain < dbmin) {
- *value = xdir ? rangemin : prev_rangemax;
+ *value = xdir || pos == 2 ? submin : prev_submax;
return 0;
}
- prev_rangemax = rangemax;
+ prev_submax = submax;
+ if (rangemax == submax)
+ break;
pos += int_index(tlv[pos + 3]) + 4;
}
- return -EINVAL;
+ *value = prev_submax;
+ return 0;
}
case SND_CTL_TLVT_DB_SCALE: {
int min, step, max;
--
1.7.9.2

View File

@ -0,0 +1,32 @@
From e4d9c348304880399e622d99d0177f434a517d88 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Wed, 23 May 2012 09:59:50 +0200
Subject: [PATCH 14/14] conf: Add more USB devices to S/PDIF blacklist
These devices don't have digital in/out, so prevent them from being
opened.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/conf/cards/USB-Audio.conf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
index 0a0e374..177a7af 100644
--- a/src/conf/cards/USB-Audio.conf
+++ b/src/conf/cards/USB-Audio.conf
@@ -42,6 +42,10 @@ USB-Audio.pcm.iec958_device {
"Logitech Speaker Lapdesk N700" 999
"Logitech USB Headset" 999
"Logitech Wireless Headset" 999
+ "Plantronics GameCom 780" 999
+ "Plantronics USB Headset" 999
+ "Plantronics Wireless Audio" 999
+ "SB WoW Headset" 999
"Sennheiser USB headset" 999
"USB Device 0x46d:0x992" 999
}
--
1.7.9.2

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Tue May 29 11:08:11 CEST 2012 - tiwai@suse.de
- backport upstream fixes:
* Add support for Echo3G devices
* Blacklist iec958 for some USB devices
* Remove redundant CHECK_ENUM() from snd_mixer_selem_is_enum*()
* Document fixes / updates
* Add ability to specify TLV data to external control plugins
* Fix invalid long long format specifier
* Fix missing break in PCM non-interleaved mmap handling
* improve robustness of TLV raw value ranges
-------------------------------------------------------------------
Wed Jan 25 11:10:29 CET 2012 - tiwai@suse.de

View File

@ -51,6 +51,20 @@ Source32: all_notes_off.mid
Source33: alsa-info.sh
Source34: alsa-init.sh
# Patch: alsa-lib-git-fixes.diff
Patch1: 0001-conf-pcm-Add-support-for-Echo3G-devices.-Thanks-to-u.patch
Patch2: 0002-USB-Audio-Blacklist-iec958-for-some-USB-devices.patch
Patch3: 0003-USB-Audio-Fixup-card-name-for-Logitech-web-camera.patch
Patch4: 0004-mixer-Remove-redundant-CHECK_ENUM-from-snd_mixer_sel.patch
Patch5: 0005-seqmid-more-descriptions-on-snd_seq_parse_address-be.patch
Patch6: 0006-doc-Fix-typo-in-PCM-formats.patch
Patch7: 0007-alsa-lib-conf-block-S-PDIF-access-for-Sennheiser-USB.patch
Patch8: 0008-control_external-Add-ability-to-specify-TLV-data.patch
Patch9: 0009-alsa-lib-conf-Add-two-more-USB-devices-to-iec958-bla.patch
Patch10: 0010-Fix-invalid-long-long-format-specifier.patch
Patch11: 0011-pcm-add-missing-break-in-switch.patch
Patch12: 0012-pcm_dsnoop-comment-fall-through-in-next-case.patch
Patch13: 0013-tlv-improve-robustness-of-raw-value-ranges.patch
Patch14: 0014-conf-Add-more-USB-devices-to-S-PDIF-blacklist.patch
Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff
Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -66,9 +80,11 @@ on your Linux box. To set it up, run yast2 or alsaconf.
Summary: Include Files and Libraries mandatory for Development
License: LGPL-2.1+
Group: Development/Libraries/C and C++
Requires: glibc-devel, libasound2 = %{version}
Requires: glibc-devel
Requires: libasound2 = %{version}
Obsoletes: alsadev
Provides: alsadev alsa-lib-devel
Provides: alsa-lib-devel
Provides: alsadev
%description devel
This package contains all necessary include files and libraries needed
@ -99,6 +115,20 @@ Architecture.
%prep
%setup -q -n alsa-lib-%{package_version}
# %patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%if %suse_version == 1130
%patch99 -p1
%endif