Page MenuHomeFreeBSD

mixer: Improve error messages
Needs ReviewPublic

Authored by fernape on Wed, May 6, 10:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 20, 8:11 AM
Unknown Object (File)
Tue, May 19, 3:29 AM
Unknown Object (File)
Sun, May 17, 6:18 AM
Unknown Object (File)
Fri, May 15, 2:07 PM
Unknown Object (File)
Fri, May 15, 2:49 AM
Unknown Object (File)
Fri, May 15, 2:49 AM
Unknown Object (File)
Thu, May 14, 11:58 PM
Unknown Object (File)
Thu, May 14, 6:40 PM
Subscribers

Details

Summary

Use better diagnostic messages when unit numbers are wrong.

This is an example of the current and proposed behavior:

$ mixer -d pcmAAA
mixer: strtol(AAA): Invalid argument
$mixer -dpcmAAAA
mixer: Can not convert 'AAAA' to a number: Invalid argument
$ mixer -d999999999999999999999999999999999
mixer: strtol(999999999999999999999999999999999): Result too large
$mixer -d99999999999999999999999
mixer: 99999999999999999999999: Result too large
$ mixer -d-2
mixer: cannot set default unit to -2: Invalid argument
pcm3:mixer: <Realtek ALC887 (Front Analog)> on hdaa1 (play/rec) (default)
    vol       = 0.78:0.78     pbk
    pcm       = 0.85:0.85     pbk
    speaker   = 0.00:0.00     rec
    rec       = 0.35:0.35     pbk
    igain     = 0.00:0.00     pbk
    ogain     = 1.00:1.00     pbk
    monitor   = 0.67:0.67     rec src
$mixer -d-2
mixer: Unit number must be a positive number
$ mixer -d99
mixer: cannot set default unit to 99: Invalid argument
pcm3:mixer: <Realtek ALC887 (Front Analog)> on hdaa1 (play/rec) (default)
    vol       = 0.78:0.78     pbk
    pcm       = 0.85:0.85     pbk
    speaker   = 0.00:0.00     rec
    rec       = 0.35:0.35     pbk
    igain     = 0.00:0.00     pbk
    ogain     = 1.00:1.00     pbk
    monitor   = 0.67:0.67     rec src
$mixer -d99
mixer: No such mixer unit: 99
Test Plan

Apply attached patch and run the commands above.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 72842
Build 69725: arc lint + arc unit