This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit c704164c796fb48b43f4487cd836caaa60021aa3 Author: qiaohaijiao1 <[email protected]> AuthorDate: Fri May 23 15:25:37 2025 +0800 drivers/virtio-snd: only report formats NuttX supports virtio_snd_get_support_formats() reported every format bit set by the device, including those without an AUDIO_SUBFMT mapping, which showed up as subformat 0. Skip unmapped formats and add the U8 mapping. Signed-off-by: qiaohaijiao1 <[email protected]> --- drivers/virtio/virtio-snd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio-snd.c b/drivers/virtio/virtio-snd.c index 0fbc220fdaa..8f3ac3e3cff 100644 --- a/drivers/virtio/virtio-snd.c +++ b/drivers/virtio/virtio-snd.c @@ -229,6 +229,10 @@ static const struct virtio_snd_format_map_s g_format_map[] = { AUDIO_SUBFMT_PCM_S8, 8 }, + [VIRTIO_SND_PCM_FMT_U8] = + { + AUDIO_SUBFMT_PCM_U8, 8 + }, [VIRTIO_SND_PCM_FMT_S16] = { AUDIO_SUBFMT_PCM_S16_LE, 16 @@ -321,7 +325,7 @@ virtio_snd_get_support_formats(FAR const struct virtio_snd_pcm_info *info, for (i = 0; i < nitems(g_format_map); i++) { - if (info->formats & (1 << i)) + if (info->formats & (1 << i) && g_format_map[i].nformat) { caps->ac_controls.b[subformats++] = g_format_map[i].nformat; if (subformats >= nitems(caps->ac_controls.b))
