mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
allow changing of device directory path
Add configuration options to change the default device path from the default /dev/snd. This is useful for embedded systems that do not want subdirectories in /dev.
This commit is contained in:
parent
3f00bc728b
commit
09f598e57c
9 changed files with 41 additions and 17 deletions
24
configure.in
24
configure.in
|
|
@ -196,6 +196,30 @@ if test "$aload" = "yes"; then
|
|||
AC_DEFINE(SUPPORT_ALOAD, "1", [Support /dev/aload* access for auto-loading])
|
||||
fi
|
||||
|
||||
dnl Check for non-standard /dev directory
|
||||
AC_MSG_CHECKING([for ALSA device file directory])
|
||||
AC_ARG_WITH(alsa-devdir,
|
||||
[ --with-alsa-devdir=dir directory with ALSA device files (default /dev/snd)],
|
||||
[alsa_dev_dir="$withval"],
|
||||
[alsa_dev_dir="/dev/snd"])
|
||||
dnl make sure it has a trailing slash
|
||||
if echo "$alsa_dev_dir" | grep -v '/$' > /dev/null; then
|
||||
alsa_dev_dir="$alsa_dev_dir/"
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(ALSA_DEVICE_DIRECTORY, "$alsa_dev_dir", [Directory with ALSA device files])
|
||||
AC_MSG_RESULT([$alsa_dev_dir])
|
||||
|
||||
AC_MSG_CHECKING([for aload* device file directory])
|
||||
AC_ARG_WITH(aload-devdir,
|
||||
[ --with-aload-devdir=dir directory with aload* device files (default /dev)],
|
||||
[aload_dev_dir="$withval"],
|
||||
[aload_dev_dir="/dev"])
|
||||
if echo "$aload_dev_dir" | grep -v '/$' > /dev/null; then
|
||||
aload_dev_dir="$aload_dev_dir/"
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(ALOAD_DEVICE_DIRECTORY, "$aload_dev_dir", [Directory with aload* device files])
|
||||
AC_MSG_RESULT([$aload_dev_dir])
|
||||
|
||||
dnl Build conditions
|
||||
AC_ARG_ENABLE(mixer,
|
||||
[ --disable-mixer Disable the mixer component],
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@
|
|||
#include "control_local.h"
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
#define SND_FILE_CONTROL "/dev/snd/controlC%i"
|
||||
#define SND_FILE_LOAD "/dev/aloadC%i"
|
||||
#define SND_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"
|
||||
#define SND_FILE_LOAD ALOAD_DEVICE_DIRECTORY "aloadC%i"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
@ -47,14 +47,14 @@
|
|||
int snd_card_load(int card)
|
||||
{
|
||||
int open_dev;
|
||||
char control[32];
|
||||
char control[sizeof(SND_FILE_CONTROL) + 10];
|
||||
|
||||
sprintf(control, SND_FILE_CONTROL, card);
|
||||
|
||||
open_dev = snd_open_device(control, O_RDONLY);
|
||||
#ifdef SUPPORT_ALOAD
|
||||
if (open_dev < 0) {
|
||||
char aload[32];
|
||||
char aload[sizeof(SND_FILE_LOAD) + 10];
|
||||
sprintf(aload, SND_FILE_LOAD, card);
|
||||
open_dev = snd_open_device(aload, O_RDONLY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ const char *_snd_module_control_hw = "";
|
|||
#endif
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
#define SNDRV_FILE_CONTROL "/dev/snd/controlC%i"
|
||||
#define SNDRV_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"
|
||||
#define SNDRV_CTL_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 3)
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -321,7 +321,7 @@ snd_ctl_ops_t snd_ctl_hw_ops = {
|
|||
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
|
||||
{
|
||||
int fd, ver;
|
||||
char filename[32];
|
||||
char filename[sizeof(SNDRV_FILE_CONTROL) + 10];
|
||||
int fmode;
|
||||
snd_ctl_t *ctl;
|
||||
snd_ctl_hw_t *hw;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
const char *_snd_module_hwdep_hw = "";
|
||||
#endif
|
||||
|
||||
#define SNDRV_FILE_HWDEP "/dev/snd/hwC%iD%i"
|
||||
#define SNDRV_FILE_HWDEP ALSA_DEVICE_DIRECTORY "hwC%iD%i"
|
||||
#define SNDRV_HWDEP_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 1)
|
||||
|
||||
static int snd_hwdep_hw_close(snd_hwdep_t *hwdep)
|
||||
|
|
@ -106,7 +106,7 @@ static snd_hwdep_ops_t snd_hwdep_hw_ops = {
|
|||
int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int device, int mode)
|
||||
{
|
||||
int fd, ver, ret;
|
||||
char filename[32];
|
||||
char filename[sizeof(SNDRV_FILE_HWDEP) + 20];
|
||||
snd_hwdep_t *hwdep;
|
||||
assert(handle);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ typedef struct {
|
|||
snd_pcm_uframes_t appl_ptr;
|
||||
} snd_pcm_hw_t;
|
||||
|
||||
#define SNDRV_FILE_PCM_STREAM_PLAYBACK "/dev/snd/pcmC%iD%ip"
|
||||
#define SNDRV_FILE_PCM_STREAM_CAPTURE "/dev/snd/pcmC%iD%ic"
|
||||
#define SNDRV_FILE_PCM_STREAM_PLAYBACK ALSA_DEVICE_DIRECTORY "pcmC%iD%ip"
|
||||
#define SNDRV_FILE_PCM_STREAM_CAPTURE ALSA_DEVICE_DIRECTORY "pcmC%iD%ic"
|
||||
#define SNDRV_PCM_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 5)
|
||||
|
||||
/* update appl_ptr with driver */
|
||||
|
|
@ -1167,7 +1167,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_stream_t stream, int mode,
|
||||
int mmap_emulation, int sync_ptr_ioctl)
|
||||
{
|
||||
char filename[32];
|
||||
char filename[sizeof(SNDRV_FILE_PCM_STREAM_PLAYBACK) + 20];
|
||||
const char *filefmt;
|
||||
int ret = 0, fd = -1;
|
||||
int attempt = 0;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
const char *_snd_module_rawmidi_hw = "";
|
||||
#endif
|
||||
|
||||
#define SNDRV_FILE_RAWMIDI "/dev/snd/midiC%iD%i"
|
||||
#define SNDRV_FILE_RAWMIDI ALSA_DEVICE_DIRECTORY "midiC%iD%i"
|
||||
#define SNDRV_RAWMIDI_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
@ -175,7 +175,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
{
|
||||
int fd, ver, ret;
|
||||
int attempt = 0;
|
||||
char filename[32];
|
||||
char filename[sizeof(SNDRV_FILE_RAWMIDI) + 20];
|
||||
snd_ctl_t *ctl;
|
||||
snd_rawmidi_t *rmidi;
|
||||
snd_rawmidi_hw_t *hw = NULL;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ const char *_snd_module_seq_hw = "";
|
|||
#endif
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
#define SNDRV_FILE_SEQ "/dev/snd/seq"
|
||||
#define SNDRV_FILE_ALOADSEQ "/dev/aloadSEQ"
|
||||
#define SNDRV_FILE_SEQ ALSA_DEVICE_DIRECTORY "seq"
|
||||
#define SNDRV_FILE_ALOADSEQ ALOAD_DEVICE_DIRECTORY "aloadSEQ"
|
||||
#define SNDRV_SEQ_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 1)
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
const char *_snd_module_timer_hw = "";
|
||||
#endif
|
||||
|
||||
#define SNDRV_FILE_TIMER "/dev/snd/timer"
|
||||
#define SNDRV_FILE_TIMER ALSA_DEVICE_DIRECTORY "timer"
|
||||
#define SNDRV_TIMER_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 5)
|
||||
|
||||
#define SNDRV_TIMER_IOCTL_STATUS_OLD _IOW('T', 0x14, struct sndrv_timer_status)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
const char *_snd_module_timer_query_hw = "";
|
||||
#endif
|
||||
|
||||
#define SNDRV_FILE_TIMER "/dev/snd/timer"
|
||||
#define SNDRV_FILE_TIMER ALSA_DEVICE_DIRECTORY "timer"
|
||||
#define SNDRV_TIMER_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
|
||||
|
||||
static int snd_timer_query_hw_close(snd_timer_query_t *handle)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue