[alsa-devel] ioctl request code for specific alsa control

Peter Wurmsdobler peter at wurmsdobler.org
Tue May 13 20:31:12 CEST 2008


The driver for our audio hardware provides 6 snd_kcontrol_new_t 
structures, with their proper callbacks, members and name. One is called 
pmic_control_pb_vol (.name = "Master Playback Volume") in the driver, 
but appears somehow as "Master" in amixer and can be successfully 
written to using the OSS interface and ioctl as:

     int mixerFd = open("/dev/mixer", O_RDWR);
     if (mixerFd >= 0) {
         unsigned int leftright;
         ioctl(mixerFd, SOUND_MIXER_WRITE_VOLUME, &leftright);

It is a big enigma for me that the ioctl with the request code used 
above arrives automagically in the particular audio driver and calls 
pmic_pb_volume_put() defined in pmic_control_pb_vol.

Another control is called pmic_control_op_sw (.name = "Master Output 
Playback Volume") and appears in amixer as "Master Output" (in fact it 
is not a volume control but a switch). It is possible to set the output 
device using amixer. My questions are:

What is the ioctl request code for a particular snd_kcontrol_new_t 
defined in the driver?

Alternatively, how does the OSS layer in ALSA map the different ALSA 
controls to the predefined and fixed OSS controls?

The hard way (and what I am currently trying as last resort) is to write 
to all of them and see what happens.

Many thanks for your help,

More information about the Alsa-devel mailing list