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?
I think you should stop bothering about overriding any particular file (i.e. stop using umview, it's not needed) and simply use the "file" plugin to create device in the ALSA config that will pipe the data to your virtual device over a named pipe in /var/run/virtualsound/output or somewhere like that.
Unlike the umview approach, this will work in all applications without having to run them in any special way.
I've solved this problem some times ago,
Alsa user-space lib simply open every /dev/snd/controlC# from 0 to 32 and launch
ioclt(SNDRV_CTL_IOCTL_CARD_INFO,...);
in order to build a list with the installed sound-cards
so, 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.
来源:https://stackoverflow.com/questions/15134751/how-to-register-a-virtual-card-to-alsa-from-user-space