From 7fcea07002ce2eee6687cdd97e57635f2e0bc55e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 4 Dec 2002 14:36:39 +0000 Subject: [PATCH] Added SND_CTL_READONLY --- include/control.h | 3 +++ src/control/control_hw.c | 5 ++++- src/dlmisc.c | 2 -- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/control.h b/include/control.h index 49ef4fbc..c3338995 100644 --- a/include/control.h +++ b/include/control.h @@ -180,6 +180,9 @@ typedef enum _snd_ctl_type { /** Async notification (flag for open mode) \hideinitializer */ #define SND_CTL_ASYNC 0x0002 +/** Read only (flag for open mode) \hideinitializer */ +#define SND_CTL_READONLY 0x0004 + /** CTL handle */ typedef struct _snd_ctl snd_ctl_t; diff --git a/src/control/control_hw.c b/src/control/control_hw.c index a3ac8ca6..f62174d0 100644 --- a/src/control/control_hw.c +++ b/src/control/control_hw.c @@ -302,7 +302,10 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode) assert(card >= 0 && card < 32); sprintf(filename, SNDRV_FILE_CONTROL, card); - fmode = O_RDWR; + if (mode & SND_CTL_READONLY) + fmode = O_RDONLY; + else + fmode = O_RDWR; if (mode & SND_CTL_NONBLOCK) fmode |= O_NONBLOCK; if (mode & SND_CTL_ASYNC) diff --git a/src/dlmisc.c b/src/dlmisc.c index d275ad68..a5d174d7 100644 --- a/src/dlmisc.c +++ b/src/dlmisc.c @@ -48,8 +48,6 @@ struct snd_dlsym_link *snd_dlsym_start = NULL; */ void *snd_dlopen(const char *name, int mode) { - void *res; - #ifndef PIC if (name == NULL) return &snd_dlsym_start; -- 2.11.0