Skip to contentSkip to conversation

Detecting ALSA OSS emulation

DISCUSSION Glenn Maynard 2 participants 2 messages Dec 8, 2003 – Dec 9, 2003

lore
Share & tools
lore
#0 lore raw

Is there a reliable way to find out if /dev/dsp is being handled by ALSA? I want to be able to detect this for diagnostics. (If /dev/dsp is ALSA, the native alsa-lib code should have been used, and something has gone wrong.) Currently, I'm checking for the existance of /proc/asound/version, but at least one user had a configuration where that file existed but /dev/dsp was really OSS.

(That's what it looked like, and what he claimed, at least; I havn't tried to reproduce that configuration, with both ALSA and OSS loaded and only OSS actually handling sound. It's possible something else was happening and the user was wrong.)

Signature · 8 lines
Glenn Maynard


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
#1 lore raw
Quoted 11 lines · Glenn Maynard

Is there a reliable way to find out if /dev/dsp is being handled by ALSA? I want to be able to detect this for diagnostics. (If /dev/dsp is ALSA, the native alsa-lib code should have been used, and something has gone wrong.) Currently, I'm checking for the existance of /proc/asound/version, but at least one user had a configuration where that file existed but /dev/dsp was really OSS.

(That's what it looked like, and what he claimed, at least; I havn't tried to reproduce that configuration, with both ALSA and OSS loaded and only OSS actually handling sound. It's possible something else was happening and the user was wrong.)

We use this OSS version:

#define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */

Ok, I've just added a new ioctl for more easy and reliable checks for mixer and pcm emulation:

#define OSS_ALSAEMULVER _SIOR ('M', 249, int)

This ioctl will return 1 as integer:

int ver;
if (ioctl(fd, OSS_ALSAEMULVER, &ver) == 0 && ver > 0)

	printf("fd is ALSA's emulation handle\n");

						Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/