Page MenuHomeFreeBSD

snd_uaudio: mark selected configurations
ClosedPublic

Authored by christos on Feb 6 2024, 10:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, May 21, 4:40 AM
Unknown Object (File)
Fri, May 17, 6:23 PM
Unknown Object (File)
Fri, May 17, 4:29 AM
Unknown Object (File)
Mar 25 2024, 10:39 PM
Unknown Object (File)
Mar 12 2024, 5:01 AM
Unknown Object (File)
Mar 2 2024, 4:45 PM
Unknown Object (File)
Feb 13 2024, 7:34 AM
Unknown Object (File)
Feb 13 2024, 7:34 AM
Subscribers

Details

Summary

snd_uaudio(4) selects the first maching rate/channel/bit/format/buffer
configuration for use during attach, even though it will print the rest
of the supported configurations detected. To make this clear, mark the
selected playback and recording configurations with a "selected" string.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

Test Plan
root@freebsd:~ # ugen0.4: <Focusrite Scarlett Solo USB> at usbus0
uaudio0 on uhub0
uaudio0: <Focusrite Scarlett Solo USB, class 239/2, rev 2.00/2.80, addr 9> on usbus0
uaudio0: Play[0]: 96000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer. (selected)
uaudio0: Play[0]: 88200 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Play[0]: 48000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Play[0]: 44100 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 96000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer. (selected)
uaudio0: Record[0]: 88200 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 48000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 44100 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: No MIDI sequencer.
pcm0 on uaudio0
uaudio0: No HID volume keys found.

Show new selected config after changing the the default rate:

root@freebsd:~ # sysctl hw.usb.uaudio.default_rate=44100
hw.usb.uaudio.default_rate: 0 -> 44100
root@freebsd:~ # ugen0.4: <Focusrite Scarlett Solo USB> at usbus0 (disconnected)
uaudio0: at uhub0, port 1, addr 9 (disconnected)
pcm0: detached
uaudio0: detached
root@freebsd:~ # ugen0.4: <Focusrite Scarlett Solo USB> at usbus0
uaudio0 on uhub0
uaudio0: <Focusrite Scarlett Solo USB, class 239/2, rev 2.00/2.80, addr 10> on usbus0
uaudio0: Play[0]: 44100 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer. (selected)
uaudio0: Play[0]: 96000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Play[0]: 88200 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Play[0]: 48000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Play[0]: 44100 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 44100 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer. (selected)
uaudio0: Record[0]: 96000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 88200 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 48000 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 44100 Hz, 2 ch, 32-bit S-LE PCM format, 2x2ms buffer.
uaudio0: No MIDI sequencer.
pcm0 on uaudio0
uaudio0: No HID volume keys found.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().

Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().

Yeap, but that's still better than the current out-of-context dump, which requires one to have read the code to understand which config is selected. After all, this is printed during attach so it's expected that this reflects the state of the device during attach, and not runtime.

Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().

Yeap, but that's still better than the current out-of-context dump, which requires one to have read the code to understand which config is selected. After all, this is printed during attach so it's expected that this reflects the state of the device during attach, and not runtime.

I've only ever seen different sample rates here, never different channel configurations. Which means it's not significant to the end user, no need to understand the order here. If vchans aren't disabled, setting dev.pcm.*.*.vchanrate will select a different one.

Not that I care too much, go ahead if you want to.

This revision is now accepted and ready to land.Feb 6 2024, 12:21 PM

Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().

Yeap, but that's still better than the current out-of-context dump, which requires one to have read the code to understand which config is selected. After all, this is printed during attach so it's expected that this reflects the state of the device during attach, and not runtime.

I've only ever seen different sample rates here, never different channel configurations. Which means it's not significant to the end user, no need to understand the order here. If vchans aren't disabled, setting dev.pcm.*.*.vchanrate will select a different one.

I will add a comment explaining that with vchans enabled the sample rate is overriden by dev.pcm.<n>.play|rec.vchanrate and that this reflects the state of the device during attach only.

Not that I care too much, go ahead if you want to.

Me neither really, but it's a cosmetic change that could potentially help some people.

This revision was automatically updated to reflect the committed changes.