Introduction

This document explains how to enable and use the audio gadget driver, this driver allows to use you board as a audio gadget device for either to work as a audio capture device such as a microphone or to work as an audio receiver device such as speakers.

Audio Gadget Driver 1.0

This driver comes by default into the kernel and is compatible with the USB Audio Class specification 1.0. The current driver allows audio playback mode only and comes wired to the sound system so it automatically uses the default audio decoder to reproduce the audio that is coming from the host machine.

Enabling the audio gadget driver

1. Go to you SDK and open the configuration window make config

2. Go to

-> Kernel configuration
-> Device Drivers
-> USB support (USB_SUPPORT [=y])

and activate the Inventra Highspeed Dual Role Controller (TI, ADI, ...) option to be built in the kernel (press space util it shows a * symbol on it).

Once you have selected it you have to change the Driver Mode option to USB Peripheral (gadget stack).

3. Now activate the USB Gadget Support option (check it as built in the kernel) on

-> Kernel configuration
-> Device Drivers
-> USB support (USB_SUPPORT [=y])

4. Go to

-> Kernel configuration
-> Device Drivers
-> USB support (USB_SUPPORT [=y])
-> USB Gadget Support (USB_GADGET [=y])

and change the USB Peripheral Controller option to Inventra HDRC USB Peripheral (TI, ADI, ...).

5. Activate the USB Gadget Drivers option as a module (M) in

-> Kernel configuration
-> Device Drivers
-> USB support (USB_SUPPORT [=y])
-> USB Gadget Support (USB_GADGET [=y])

6. Activate the Audio Gadget (EXPERIMENTAL) option as a module (M) in

-> Kernel configuration
-> Device Drivers
-> USB support (USB_SUPPORT [=y])
-> USB Gadget Support (USB_GADGET [=y])

7. Save the changes and exit from the configuration window.

8. Built your SDK (make).

Using the audio gadget driver

Once you have built the driver it is ready to be used. In this example we are using the LeopardBoard DM368. Before start your board you need to change its jumper configuration to device mode instead of host mode, you can do that by removing the jumper J1 and installing jumper between Pin1 and Pin2 on J4.

After booting up the board you can see the following output

Advanced Linux Sound Architecture Driver Version 1.0.21.
No device for DAI tlv320aic3x
No device for DAI davinci-i2s
asoc: tlv320aic3x <-> davinci-i2s mapping ok
ALSA device list:
#0: DaVinci DM365 EVM (tlv320aic3x)

Then in the board's terminal you must load the audio gadget module by running the following command

modprobe g_audio

If everything is fine you will see an output like this

/ # modprobe g_audio
g_audio gadget: Hardware params: access 3, format 2, channels 2, rate 48000
g_audio gadget: audio_buf_size 48000, req_buf_size 200, req_count 256
g_audio gadget: Linux USB Audio Gadget, version: Dec 18, 2008
g_audio gadget: g_audio ready

This way the module has been loaded and the driver is ready to be used. In order to test it you can connect the board to a PC using a USB cable and send an audio streaming to the board.

Once you have connected the board to the PC you can see if it was recognized correctly by running the following command:

cat /proc/asound/cards

the you will get an output like this

~$ cat /proc/asound/cards
0 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xfe024000 irq 22
1 [Gadget ]: USB-Audio - Linux USB Audio Gadget
Linux 2.6.32-17-ridgerun with musb_hdrc Linux USB Audio Gadget at usb-0000:00:0

So you can see that the board as been detected as a Linux USB Audio Gadget with ID 1. Now we can playback an audio file using the audio gadget device by running the following command:

aplay -D plug:hw:1 audio_file.wav

Be aware that you must use the same hardware ID we got for the gadget device. After that you will be able to hear the audio content in your board's audio output.

最新文章

  1. 利用WCF双工模式实现即时通讯
  2. SQL批量增加修改数据
  3. c++头文件 #include&lt;iostream&gt;
  4. Spring获取bean的工具类
  5. C#遍历集合与移除元素的方法
  6. linux基础-第九单元 利用vi编辑器创建和编辑正文文件
  7. BZOJ3934 : [CQOI2015]标识设计
  8. mysql默认字符集修改
  9. Echarts个人实例
  10. 扩展 delphi 线程 使之传递参数.(给匿名线程增加参数)
  11. SCI杂志分区规则
  12. System.Data.DbType 与其它DbType的映射关系
  13. Eclipse用法和技巧二十五:eclipse图标的含义
  14. ZOJ 3872 Beauty of Array DP 15年浙江省赛D题
  15. [SinGuLaRiTy] 2017-03-27 综合性测试
  16. HTML DOM元素关系与操作
  17. cesium-navigation 使用(非require,es6引用)
  18. rest-framework基本组件—主要看频率
  19. MySQL索引优化步骤总结
  20. ajax-page局部刷新分页实例

热门文章

  1. redis 3.2.5单机版安装、使用、systemctl管理Redis启动、停止、开机启动
  2. .Net Core WebApi上传图片的两种方式
  3. vue计算属性VS侦听属性
  4. Element-UI 框架 el-scrollbar 组件
  5. layui checkbox , radio 清除所有选中项
  6. 小记--------maxwell启动失败解决
  7. Clone()方法详解
  8. Python3迭代器与生成器
  9. Elastic Search中filter的理解
  10. OpenCV-图像处理