Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/website/content/en/status/report-2021-01-2021-03/nv-sndstat.adoc
18097 views
=== nv(9)-based audio device enumeration

Links: +
link:https://reviews.freebsd.org/D26884[D26884 Implement sndstat nvlist-based enumeration ioctls.] URL: link:https://reviews.freebsd.org/D26884[https://reviews.freebsd.org/D26884] +
link:https://cgit.freebsd.org/src/commit/?id=c96151d33509655efb7fb26768cb56a041c176f1[commit c96151d33509655efb7fb26768cb56a041c176f1] URL:  link:https://cgit.freebsd.org/src/commit/?id=c96151d33509655efb7fb26768cb56a041c176f1[https://cgit.freebsd.org/src/commit/?id=c96151d33509655efb7fb26768cb56a041c176f1]

Contact: Ka Ho Ng <[email protected]>

This work presents a number of ioctl commands on [.underline]#/dev/sndstat# using nv(9) to expose all available audio device nodes.
nv(9) is used to generate a serialized binary stream representation of the information of audio device nodes presented in the running system.
The documented nvlist structure in sndstat(4) manual page is stable for programming use.

For a long time, enumerating the audio device node interface required parsing content of [.underline]#/dev/sndstat#.
It is tedious to write such a parser and handle different `hw.snd.verbose` levels correctly.
Using nv(9) eliminates the need to write a text parser to do audio device nodes enumeration.

This work has been link:https://cgit.freebsd.org/src/commit/?id=c96151d33509655efb7fb26768cb56a041c176f1[committed] and is available in FreeBSD 14-CURRENT.

Sponsor: The FreeBSD Foundation