0

Inside of a C program, using libudev and libasound, I have determined a struct udev_device *device is part of the sound subsystem with udev_device_get_subsystem(device) == "sound". Now I have obtained the device, I want to obtain more information about it to use with ALSA.

I want to know how to query information about this device, e.g. playback/capture, number of channels, etc. Furthermore, I want to know how to query this device to obtain the parameters to use for a call to ALSA snd_pcm_open()

I can only think of parsing the contents of /proc/asound/*, however this seems very tedious and rigid. Also, as udev supports detecting sound devices, it seems logical to me that it would have (or there would be) some 'clean' mechanism of obtaining more information about it.

2
  • Card/device number and playback/capture is part of the device node name. Other parameters must be queries through ioctls; the easiest way is through the ALSA API. – CL. Mar 24 at 20:41
  • @CL. What would those ioctls look like? Yes, I'm thinking only to use udev to monitor a sound device being added which would then trigger a rescan of audio devices with ALSA. – Ryan McClue Mar 24 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.