Search code examples
linuxaudiokerneldevicevirtualization

How to register a virtual card to alsa from user-space?


I'm developing a virtual device from the user space

(using umview http://wiki.virtualsquare.org/wiki/index.php/UMview) so, i need to register my device to the system's sound cards list

(I've never used alsa in a kernel module so I think that I need to call the snd_card_register() function)

but I can't find a way to do that from the userspace...

maybe I can write a syscall to do that?


Solution

  • I've solved this problem some times ago,

    Alsa user-space lib simply open every /dev/snd/controlC# from 0 to 32 and launch

    ioctl(SNDRV_CTL_IOCTL_CARD_INFO, ...);     
    

    in order to build a list with the installed sound-cards

    if we mount our UmView module on /dev/snd/control# and we hijack the ioctl and answer to it, our module will be identified as a sound-card by ALSA

    I've created a virtual sound device with that technique, you can find it at https://github.com/berdav/umdevaudio

    this is a simple way to build a simple user-space driver.