summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2008-10-23 09:58:10 +0200
committerJaroslav Kysela <perex@perex.cz>2008-10-23 09:58:10 +0200
commit8feae77e13ed28280751c475c74e7083b51a462a (patch)
tree01fe5810707fb5815c11ced195bd3496d627ed8e
parentcc7fec138ed6dceaf9deccfa8f26a28ab8a6c504 (diff)
parent3b3eac25abe604d20c00ec3a6722d7c55b9b8af3 (diff)
downloadalsa-lib-8feae77e13ed28280751c475c74e7083b51a462a.tar.gz
Merge branch 'master' of git@git.alsa-project.org:alsa-lib
-rw-r--r--include/sound/asound.h5
-rw-r--r--src/conf/cards/PS3.conf39
-rw-r--r--src/control/control_hw.c13
-rw-r--r--src/control/namehint.c28
4 files changed, 65 insertions, 20 deletions
diff --git a/include/sound/asound.h b/include/sound/asound.h
index e5fbea43..977b2d6c 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -725,7 +725,7 @@ struct sndrv_timer_tread {
* *
****************************************************************************/
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
struct sndrv_ctl_card_info {
int card; /* card number */
@@ -736,8 +736,7 @@ struct sndrv_ctl_card_info {
unsigned char longname[80]; /* name + info text about soundcard */
unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
unsigned char mixername[80]; /* visual mixer identification */
- unsigned char components[80]; /* card components / fine identification, delimited with one space (AC97 etc..) */
- unsigned char reserved[48]; /* reserved for future */
+ unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
};
enum sndrv_ctl_elem_type {
diff --git a/src/conf/cards/PS3.conf b/src/conf/cards/PS3.conf
index b7e30ff5..b642f0dc 100644
--- a/src/conf/cards/PS3.conf
+++ b/src/conf/cards/PS3.conf
@@ -44,3 +44,42 @@ PS3.pcm.default {
}
}
}
+
+<confdir:pcm/iec958.conf>
+
+PS3.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
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/src/control/control_hw.c b/src/control/control_hw.c
index 7180eadc..aeb2c23e 100644
--- a/src/control/control_hw.c
+++ b/src/control/control_hw.c
@@ -116,7 +116,7 @@ static int snd_ctl_hw_subscribe_events(snd_ctl_t *handle, int subscribe)
SYSERR("SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS failed");
return -errno;
}
- return subscribe;
+ return 0;
}
static int snd_ctl_hw_card_info(snd_ctl_t *handle, snd_ctl_card_info_t *info)
@@ -324,7 +324,11 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
ssize_t res = read(hw->fd, event, sizeof(*event));
if (res <= 0)
return -errno;
- assert(res == sizeof(*event));
+ if (CHECK_SANITY(res != sizeof(*event))) {
+ SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)\n",
+ sizeof(*event), res);
+ return -EINVAL;
+ }
return 1;
}
@@ -368,7 +372,10 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
*handle = NULL;
- assert(card >= 0 && card < 32);
+ if (CHECK_SANITY(card < 0 || card >= 32)) {
+ SNDMSG("Invalid card index %d", card);
+ return -EINVAL;
+ }
sprintf(filename, SNDRV_FILE_CONTROL, card);
if (mode & SND_CTL_READONLY)
fmode = O_RDONLY;
diff --git a/src/control/namehint.c b/src/control/namehint.c
index b526ad5d..8bf739b9 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -84,10 +84,11 @@ static void zero_handler(const char *file ATTRIBUTE_UNUSED,
{
}
-static int get_dev_name1(struct hint_list *list, char **res)
+static int get_dev_name1(struct hint_list *list, char **res, int device,
+ int stream)
{
*res = NULL;
- if (list->device < 0)
+ if (device < 0)
return 0;
switch (list->iface) {
#ifdef BUILD_HWDEP
@@ -95,7 +96,7 @@ static int get_dev_name1(struct hint_list *list, char **res)
{
snd_hwdep_info_t *info;
snd_hwdep_info_alloca(&info);
- snd_hwdep_info_set_device(info, list->device);
+ snd_hwdep_info_set_device(info, device);
if (snd_ctl_hwdep_info(list->ctl, info) < 0)
return 0;
*res = strdup(snd_hwdep_info_get_name(info));
@@ -107,8 +108,8 @@ static int get_dev_name1(struct hint_list *list, char **res)
{
snd_pcm_info_t *info;
snd_pcm_info_alloca(&info);
- snd_pcm_info_set_device(info, list->device);
- snd_pcm_info_set_stream(info, list->stream ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK);
+ snd_pcm_info_set_device(info, device);
+ snd_pcm_info_set_stream(info, stream ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK);
if (snd_ctl_pcm_info(list->ctl, info) < 0)
return 0;
switch (snd_pcm_info_get_class(info)) {
@@ -127,8 +128,8 @@ static int get_dev_name1(struct hint_list *list, char **res)
{
snd_rawmidi_info_t *info;
snd_rawmidi_info_alloca(&info);
- snd_rawmidi_info_set_device(info, list->device);
- snd_rawmidi_info_set_stream(info, list->stream ? SND_RAWMIDI_STREAM_INPUT : SND_RAWMIDI_STREAM_OUTPUT);
+ snd_rawmidi_info_set_device(info, device);
+ snd_rawmidi_info_set_stream(info, stream ? SND_RAWMIDI_STREAM_INPUT : SND_RAWMIDI_STREAM_OUTPUT);
if (snd_ctl_rawmidi_info(list->ctl, info) < 0)
return 0;
*res = strdup(snd_rawmidi_info_get_name(info));
@@ -143,14 +144,13 @@ static int get_dev_name1(struct hint_list *list, char **res)
static char *get_dev_name(struct hint_list *list)
{
char *str1, *str2, *res;
+ int device;
- list->device = list->device_input >= 0 ? list->device_input : list->device;
- list->stream = 1;
- if (get_dev_name1(list, &str1) < 0)
+ device = list->device_input >= 0 ? list->device_input : list->device;
+ if (get_dev_name1(list, &str1, device, 1) < 0)
return NULL;
- list->device = list->device_output >= 0 ? list->device_input : list->device;
- list->stream = 0;
- if (get_dev_name1(list, &str2) < 0) {
+ device = list->device_output >= 0 ? list->device_output : list->device;
+ if (get_dev_name1(list, &str2, device, 0) < 0) {
if (str1)
free(str1);
return NULL;
@@ -199,7 +199,7 @@ static char *get_dev_name(struct hint_list *list)
}
}
/* if the specified device doesn't exist, skip this entry */
- if (list->device_input >= 0 || list->device_output >= 0)
+ if (list->device >= 0 || list->device_input >= 0 || list->device_output >= 0)
return NULL;
return strdup(list->cardname);
}