Soundcard
The sound device is handled by the kernel driver omap2_audio_wm8985, and is broadly OSS-compatible. Audio applications that can work with OSS, such as mplayer, seem to work OK.
The driver supports the standard OSS ioctl() operations on /dev/sound and /dev/mixer. Note that under udev these default to being root-owned, and permissions changes are needed to allow access to unprivileged users. In the Angstrom distribution, this change of permissions is already handled by the login manager gpe-login (see /etc/X11/gpe-login.pre-session).
One point to note is control of the internal speaker. Essentially, it is on if it's volume is set to greater than 1, and off otherwise. I don't believe it's possible to control it's volume independently of the headphone volume. The value `1' has some special significance related to mono/stereo operation that I haven't yet been able to figure out.
const char *mixerDevice = "/dev/mixer";
void enableSpeaker (bool enable)
{
int f = open (mixerDevice, O_RDONLY);
if (f > 0)
{
int v;
if (enable)
v = 2;
else
v = 0;
ioctl(f, MIXER_WRITE(SOUND_MIXER_SPEAKER), &v);
close (f);
}
else
// Handle error
}
bool isSpeakerOn()
{
int f = open (mixerDevice, O_RDONLY);
if (f > 0)
{
int vol;
ioctl(f, MIXER_READ(SOUND_MIXER_SPEAKER), &vol);
close (f);
return (vol != 0);
}
return FALSE; // Well, we don't know, do we?
}
