On Thu, Oct 27, 2022 at 01:27:43PM +0000, Klemens Nanni wrote:
> Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
> in their open() if full-duplex mode was requested.
>
> This way, sys/dev/audio.c:audio_open() will fail immediately rather than
> later through the to-be-removed get_props() check.
>
> These are all drivers which simply don't support recording.
>
> In device-tree based drivers like simpleaudio(4)/rkiis(4) and newer
> Apple ones like aplaudio(4)/aplmca(4), this adds a new open() stub to
> the low-level drivers which merely does the duplex check.
>
> The rkiis(4) and aplmca(4) stubs don't open anything, but are now
> required for simpleaudio(4) and aplaudio(4) to actually do the low-level
> driver specific duplex check.
>
> My Pinebook Pro keeps playing audio and recording silence with this diff
> just like before (rkiis(4) is currently play-only):
> simpleaudio0 at mainbus0
> simpleaudio1 at mainbus0
> audio0 at simpleaudio1
>
> $ aucat -i song69.wav -o rec.wav
>
> Builds fine on amd64 and arm64.
> Feedback? Objection? OK?
IMO, for play-only drivers, the check should be:
if (flags & FREAD)
return ENXIO;
which will reject record-only and full-duplex.