Using AVIRT =================================== ## Introduction ## Table of Contents 1. [Load/Unload AVIRT](#un-load-avirt) 2. [Configuring AVIRT](#configuring-avirt) ## Loading and Unloading AVIRT ### Load Out of Tree As root, load the required `avirt_core.ko` and subsequent audio path. As an example, the Dummy Audiopath is being loaded here. ```sh insmod avirt_core.ko insmod dummy/dummy_audiopath.ko ``` ### Note: The loading and unloading of drivers can be performed using the helper scripts. To run, we must load the kernel modules using the `scripts/load.sh` script: ```sh $ ./scripts/load.sh ``` To unload the drivers use: ```sh $ ./scripts/unload.sh ``` ### Load In Tree #### Note: Either build the module in tree, or you can copy the modules manually and then run `depmod` to generate dependencies. For example, in AGL: ```sh mkdir -p /lib/modules/$(uname -r)/extra cp avirt_core.ko avirt_dummyap.ko /lib/modules/$(uname -r)/extra depmod ``` Once the modules are in place, we can load the modules using: ```sh modprobe avirt_core modprobe avirt_dummyap ``` ## Configuring AVIRT AVIRT is configured using configfs. ### Note: A sample script for the following is supplied inside the `scripts` folder. First, verify the kernel supports the use of configfs. ```sh fgrep configfs /proc/filesystems ``` the expected output is: ``` nodev configfs ``` Once confirmed, we can mount the configfs at the conventional point: ```sh # Check configfs is mounted on the system mkdir -p /config mount -t configfs none /config ``` Finally, we can configure AVIRT: ```sh # Set up each of the cards channels mkdir /config/avirt/streams/playback_media echo "2">/config/avirt/streams/playback_media/channels echo "ap_dummy">/config/avirt/streams/playback_media/map mkdir /config/avirt/streams/playback_navigation echo "1">/config/avirt/streams/playback_navigation/channels echo "ap_dummy">/config/avirt/streams/playback_navigation/map mkdir /config/avirt/streams/playback_emergency echo "1">/config/avirt/streams/playback_emergency/channels echo "ap_dummy">/config/avirt/streams/playback_emergency/map mkdir /config/avirt/streams/capture_voice echo "1">/config/avirt/streams/capture_voice/channels echo "ap_dummy">/config/avirt/streams/capture_voice/map # Finally, seal the card, and initiate configuration echo "1">/config/avirt/streams/sealed ``` Alternatively, the test script at `scripts/test_configfs.sh` can be used. ### Note: A simplified helper library, libavirt, is available [here](https://github.com/fiberdyne/libavirt). Please refer to the readme in libavirt for further details.