NetBSD Problem Report #59873
From tsutsui@ceres.dti.ne.jp Thu Jan 1 06:17:38 2026
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 791E61A923C
for <gnats-bugs@gnats.NetBSD.org>; Thu, 1 Jan 2026 06:17:38 +0000 (UTC)
Message-Id: <202601010617.6016HWqP005613@ceres.dti.ne.jp>
Date: Thu, 1 Jan 2026 15:17:32 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: RPI 3B vcaudio(4) puts bogus errors on audioplay(1)
X-Send-Pr-Version: 3.95
>Number: 59873
>Category: port-evbarm
>Synopsis: RPI 3B vcaudio(4) puts bogus errors on audioplay(1)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: port-evbarm-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 01 06:20:00 +0000 2026
>Last-Modified: Thu Jan 01 08:05:00 +0000 2026
>Originator: Izumi Tsutsui
>Release: NetBSD 11.99.4 (also happens 10.1)
>Organization:
>Environment:
System: NetBSD armv7 11.99.4 NetBSD 11.99.4 (GENERIC) #1: Sun Dec 21 19:20:18 JST 2025 tsutsui@mirage:/s/cvs/src/sys/arch/evbarm/compile/GENERIC evbarm
Architecture: earmv7hf (also happens on aarch64)
Machine: evbarm
>Description:
On my Raspberry Pi 3B, if audioplay(1) is passed non-existent audio file,
the kernel emits the following errors:
```
armv7-% audioplay non-existent-file.wav
audioplay: could not open non-existent-file.wav: No such file or directory
[ 314735.791236] audio0(vcaudio0): setting play.port=0 failed: errno=22
[ 314735.791236] audio0(vcaudio0): setting play.port=0 failed: errno=22
```
>How-To-Repeat:
See above.
>Fix:
No idea.
Wrong return values (EINVAL) or bad error handling in
vcaudio_set_port() (in VCAUDIO_OUTPUT_SELECT case?)
in src/sys/arch/arm/broadcom/bcm2835_vcaudio.c ?
```
static int
vcaudio_set_port(void *priv, mixer_ctrl_t *mc)
{
struct vcaudio_softc *sc = priv;
switch (mc->dev) {
case VCAUDIO_OUTPUT_MASTER_VOLUME:
case VCAUDIO_INPUT_DAC_VOLUME:
sc->sc_swvol = mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
return 0;
case VCAUDIO_OUTPUT_AUTO_VOLUME:
return vcaudio_set_volume(sc, VCAUDIO_DEST_AUTO,
mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT]);
case VCAUDIO_OUTPUT_HEADPHONE_VOLUME:
return vcaudio_set_volume(sc, VCAUDIO_DEST_HP,
mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT]);
case VCAUDIO_OUTPUT_HDMI_VOLUME:
return vcaudio_set_volume(sc, VCAUDIO_DEST_HDMI,
mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT]);
case VCAUDIO_OUTPUT_SELECT:
if (mc->un.ord < 0 || mc->un.ord > 2)
return EINVAL;
sc->sc_dest = mc->un.ord;
return vcaudio_set_volume(sc, mc->un.ord,
sc->sc_hwvol[mc->un.ord]);
}
return ENXIO;
}
```
---
Izumi Tsutsui
>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-evbarm/59873: RPI 3B vcaudio(4) puts bogus errors on audioplay(1)
Date: Thu, 1 Jan 2026 08:04:02 -0000 (UTC)
tsutsui@ceres.dti.ne.jp (Izumi Tsutsui) writes:
>On my Raspberry Pi 3B, if audioplay(1) is passed non-existent audio file,
>the kernel emits the following errors:
>armv7-% audioplay non-existent-file.wav
>audioplay: could not open non-existent-file.wav: No such file or directory
>[ 314735.791236] audio0(vcaudio0): setting play.port=0 failed: errno=22
>[ 314735.791236] audio0(vcaudio0): setting play.port=0 failed: errno=22
>```
>Wrong return values (EINVAL) or bad error handling in
>vcaudio_set_port() (in VCAUDIO_OUTPUT_SELECT case?)
>in src/sys/arch/arm/broadcom/bcm2835_vcaudio.c ?
The audio driver maintains the idea of well-known ports of an
audio device. audioplay lets you select with option -p the
values "speaker", "headphone" and "line" which results in a
bitmask with one bit set. The default is none (a bitmask value
of zero).
The audio driver has a heuristic to find these ports by looking
at mixer controls of type AUDIO_MIXER_ENUM or AUDIO_MIXER_SET
that match well-knwon names (differently for input and output).
static const struct portname itable[] = {
{ AudioNmicrophone, AUDIO_MICROPHONE },
{ AudioNline, AUDIO_LINE_IN },
{ AudioNcd, AUDIO_CD },
{ 0, 0 }
};
static const struct portname otable[] = {
{ AudioNspeaker, AUDIO_SPEAKER },
{ AudioNheadphone, AUDIO_HEADPHONE },
{ AudioNline, AUDIO_LINE_OUT },
{ 0, 0 }
};
Since vcaudio provides a mixer control named AudioNheadphone, the audio
driver collects this as a well-known port name.
# audioctl play.avail_ports
play.avail_ports=0x2
That's
sys/audioio.h:#define AUDIO_HEADPHONE 0x02 /* headphone jack */
The audio driver also tries to find a mixer control named "select"
to select well-known ports.
Most devices don't have well known ports, and playing audio
with no port selected is accepted for them as a special
case.
int
au_set_port(struct audio_softc *sc, struct au_mixer_ports *ports, u_int port)
{
...
if (port == 0) {
if (ports->allports == 0)
return 0; /* Allow this special case. */
else if (ports->isdual) {
if (ports->cur_port == -1) {
return 0;
} else {
port = ports->aumask[ports->cur_port];
ports->cur_port = -1;
use_mixerout = 0;
}
}
}
if (ports->index == -1)
return EINVAL;
...
The index is set from finding a well-known port, so that's not the
error. But the following codes tries to match a well-known port and
also fails with EINVAL if none is found. An AUDIO_MIXER_ENUM allows
to ask for a single port, an AUDIO_MIXER_SET allows a bitmap of
well-known ports, but selecting no port fails.
When you play audio with 'audioplay -p headphone', no error will
be generated. Unfortunately, it also selects the headphones output.
The whole idea of "well-known" ports is outdated, in particular
the assumption that a device has only such ports or none. Using
the name for classification is also questionable.
N.B. audioplay calls it "headphone" while the driver calls it
"headphones". That's from
else if (strncmp(optarg, "headphone", len) == 0)
port |= AUDIO_HEADPHONE;
but the drivers use:
#define AudioNheadphone "headphones"
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.