如何从用户空间向alsa注册虚拟卡? [英] How to register a virtual card to alsa from user-space?

查看:94
本文介绍了如何从用户空间向alsa注册虚拟卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从用户空间开发虚拟设备

I'm developing a virtual device from the user space

(使用umview http://wiki.virtualsquare.org/wiki/index.php /UMview ) 因此,我需要将设备注册到系统的声卡列表中

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

(我从未在内核模块中使用过alsa,所以我认为我需要调用snd_card_register()函数)

(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...

也许我可以编写一个syscall来做到这一点?

maybe I can write a syscall to do that?

推荐答案

我已经解决了这个问题,

I've solved this problem some times ago,

Alsa用户空间lib只需从0到32打开每个/dev/snd/controlC#并启动

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

如果我们将UmView模块安装在/dev/snd/control#上并劫持ioctl并对其进行回答,则我们的模块将被ALSA识别为声卡

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

我已经用这种技术创建了一个虚拟声音设备,您可以在以下位置找到它 https://github.com/berdav/umdevaudio

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.

这篇关于如何从用户空间向alsa注册虚拟卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆