svn commit: r359446 - head/sys/dev/sound/usb
Alexander Leidinger
Alexander at leidinger.net
Tue Mar 31 13:44:55 UTC 2020
Quoting Hans Petter Selasky <hselasky at freebsd.org> (from Tue, 31 Mar
2020 14:44:12 +0200):
> On 2020-03-31 14:35, Alexander Leidinger via freebsd-usb wrote:
>> Quoting Hans Petter Selasky <hselasky at freebsd.org> (from Mon, 30
>> Mar 2020 16:50:33 +0000 (UTC)):
>>
>>> Author: hselasky
>>> Date: Mon Mar 30 16:50:32 2020
>>> New Revision: 359446
>>> URL: https://svnweb.freebsd.org/changeset/base/359446
>>>
>>> Log:
>>> Add support for multiple playback and recording devices per
>>> physical USB audio
>>> device. This requires some structural refactoring inside the
>>> driver, mostly
>>> about converting existing audio channel structures into arrays.
>>>
>>> The main audio mixer is provided by the first PCM instance.
>>> The non-first audio instances may only have a software mixer for
>>> PCM playback.
>>
>> Have you thought about providing different pcm devices per physical
>> USB audio device for the functionality of dev.pcm.X.Y.vchanformat /
>> vchanrate? Incompatible configs between those devices could be
>> prevented at runtime via setting all the incompatible devices per
>> physical device to return EBUSY or such while one of the group is
>> open / in use. /dev/sndstat could also contain some kind of status
>> to this effect and to which group of pcm devices pcmX belongs.
>>
>
> Hi,
>
> There will be two pcm devices, belonging to the same uaudioX device
> having each their independent sysctl tree. So you get:
>
> /dev/dsp0
> /dev/mixer0
> /dev/dsp1
> /dev/mixer1
>
> mixer1 only controls dsp1, and mixer0 only controls dsp0, while it
> may be the same physical USB audio device.
>
> Was this your question?
I have this:
uaudio0: <vendor 0x0d8c USB Sound Device, class 0/0, rev 1.10/0.10,
addr 3> on usbus8
uaudio0: Play: 48000 Hz, 4 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 44100 Hz, 4 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: No MIDI sequencer.
It has dev.pcm.0.play.vchanformat=48000 per default. If I want to
switch this, I need to issue a sysctl (= root permission).
My question was to change the code to not need this sysctl anymore,
but to generate a /dev/dspX for each of the possibilities the hardware
supports. And if one dsp device is open, the other could by set into
busy state so that it can not be opened until the first dsp device is
closed. This way I only need user permissions to the dsp device to be
able to select what I want (what I want may need a lookup of me to
/dev/sndstat to find out which device would be the one for bit-perfect
playing (even if vchans are enabled) instead of resampling inside the
kernel).
Similar for e.g. vchanformat=s16le:5.1 or other formats which the
hardware supports. Instead of requiring root access to do the sysctl,
simply chosing the right pcm device would only need user permissions
on the dev entry. BTW: how to find out what the hardware supports in
this regard. The above dmesg snippd suggests the hardware is able to
do s16le:2.0 or s16le:4.0, but not s16le:5.1 (but the device has
connectors for a 7.1 setup - I haven't tried it, I have it connected
via SPDIF).
Bye,
Alexander.
--
http://www.Leidinger.net Alexander at Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org netchild at FreeBSD.org : PGP 0x8F31830F9F2772BF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digitale PGP-Signatur
URL: <http://lists.freebsd.org/pipermail/freebsd-usb/attachments/20200331/44f3b5e5/attachment.sig>
More information about the freebsd-usb
mailing list