Page MenuHomeFreeBSD

mixer(8): Use new mixer if we change the default unit
ClosedPublic

Authored by christos on Feb 9 2024, 9:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 5 2024, 6:05 AM
Unknown Object (File)
Oct 5 2024, 6:05 AM
Unknown Object (File)
Oct 5 2024, 6:04 AM
Unknown Object (File)
Oct 5 2024, 6:04 AM
Unknown Object (File)
Oct 5 2024, 6:04 AM
Unknown Object (File)
Oct 5 2024, 5:43 AM
Unknown Object (File)
Oct 2 2024, 2:13 PM
Unknown Object (File)
Sep 24 2024, 4:27 AM
Subscribers
None

Details

Summary

If we use the -d option to change the default unit, close the current
mixer and open the one we set as the default to avoid printing and
applying changes (if any) to the old one.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

Test Plan

Old (still printing the old mixer if change the default unit):

christos@tpad$ mixer
pcm0:mixer: <Realtek ALC257 (Analog 2.0+HP/2.0)> on hdaa0  (play/rec) (default)
    vol       = 0.85:0.85     pbk
    pcm       = 1.00:1.00     pbk
    speaker   = 1.00:1.00     pbk
    rec       = 0.37:0.37     pbk
    ogain     = 1.00:1.00     pbk
    monitor   = 0.67:0.67     rec src
christos@tpad$ mixer -d pcm1
default_unit: 0 -> 1
pcm0:mixer: <Realtek ALC257 (Analog 2.0+HP/2.0)> on hdaa0  (play/rec)
    vol       = 0.85:0.85     pbk
    pcm       = 1.00:1.00     pbk
    speaker   = 1.00:1.00     pbk
    rec       = 0.37:0.37     pbk
    ogain     = 1.00:1.00     pbk
    monitor   = 0.67:0.67     rec src

New:

christos@tpad$ mixer
pcm0:mixer: <Realtek ALC257 (Analog 2.0+HP/2.0)> on hdaa0  (play/rec) (default)
    vol       = 0.85:0.85     pbk
    pcm       = 1.00:1.00     pbk
    speaker   = 1.00:1.00     pbk
    rec       = 0.37:0.37     pbk
    ogain     = 1.00:1.00     pbk
    monitor   = 0.67:0.67     rec src
christos@tpad$ mixer -d pcm1
default_unit: 0 -> 1
pcm1:mixer: <Realtek ALC257 (Right Analog Mic)> on hdaa0  (rec) (default)
    mic       = 0.67:0.67     rec src
    rec       = 0.37:0.37     pbk

Diff Detail

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

Event Timeline

christos created this revision.

Use NULL in mixer_open() to open default unit instead of hardcoding
"/dev/mixer".

Definitely an improvement, the previous behavior was confusing.

This revision is now accepted and ready to land.Feb 10 2024, 5:02 PM