微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

snd_pcm_set_managed_buffer_all 未找到

如何解决snd_pcm_set_managed_buffer_all 未找到

我试图为 USB 麦克风制作带有 alsa 内核子系统的内核模块。

我正在关注这个驱动程序的代码 https://github.com/torvalds/linux/blob/master/sound/usb/misc/ua101.c

在取得一些进展后,我的构建失败了

error: implicit declaration of function ‘snd_pcm_set_managed_buffer_all’; did you mean ‘snd_pcm_set_runtime_buffer’? [-Werror=implicit-function-declaration]
  146 |   snd_pcm_set_managed_buffer_all(mic->pcm,SNDRV_DMA_TYPE_VMALLOC,NULL,0);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   snd_pcm_set_runtime_buffer
/home/maglash/Work/ldd/alsa/alsad.c:146:43: error: ‘SNDRV_DMA_TYPE_VMALLOC’ undeclared (first use in this function); did you mean ‘SNDRV_DMA_TYPE_DEV_UC’?
  146 |   snd_pcm_set_managed_buffer_all(mic->pcm,0);
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
      |                                           SNDRV_DMA_TYPE_DEV_UC

//the following API call is the culprit.
snd_pcm_set_managed_buffer_all(ua->pcm,0);

我包含了以下内核头文件

#include <linux/init.h>   // Macros used to mark up functions e.g. __init __exit
#include <linux/module.h> // Core header for loading LKMs into the kernel
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/usb/audio.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>

但他们似乎都没有这个 API? 我正在使用内核版本 5.4.0-62-generic

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。