Brightness and Sound on FreeBSD
Part of the "FreeBSD on a Laptop" series.
Brightness
I noticed upon logging into the console my laptop's screen was quite dim. This can be remedied with the backlight(8) command.
This command requires my user be a member of the video group. To add a user (example: foo) to this group, run:
doas pw groupmod video -m foo
Log out and back in to activate the new setting.
Get the current setting (off<-->brightness, 0<-->100):
$ backlight
brightness: 32
Set display to maximum brightness:
backlight 100
This setting will last only to the end of the current session. To set the display to maximum brightness upon login, I modify my shell-of-choice (fish) config file:
doas vi ~/.config/fish/config.fish
Add:
if status is-interactive
# Set display to maximum brightness
if command -v backlight > /dev/null
backlight 100
end
end
Save changes and exit.
Brightness can also be decreased and increased with the backlight decr [integer] and backlight incr [integer] commands. If no amount is specified, by default the brightness will decrease and increase by 10%.
Sound
On my Thinkpad T480s, the sound card was automatically detected by the system:
$ dmesg | grep pcm
pcm0: <Realtek ALC257 (Analog 2.0+HP/2.0)> at nid 20,33 and 18 on hdaa0
pcm1: <Realtek ALC257 (Right Analog Mic)> at nid 25 on hdaa0
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
The beep(1) command can be used to playback a sound, confirming the card is working:
beep
The mixer(8) command is used to manage sound card settings. By itself, it displays the current settings:
$ mixer
pcm0:mixer: <Realtek ALC257 (Analog 2.0+HP/2.0)> on hdaa0 (play/rec) (default)
vol = 1.00:1.00 pbk
pcm = 1.00:1.00 pbk
speaker = 1.00:1.00 pbk
rec = 0.37:0.37 pbk mute
ogain = 1.00:1.00 pbk
monitor = 0.67:0.67 rec src
Increase or decrease the volume by 5% using mixer vol=+5% or mixer vol=-5%.
Toggle mute on/off for the volume or microphone using mixer vol.mute=toggle or mixer rec.mute=toggle.
I've also created keyboard shortcuts for these commands in my Openbox configuration.
Another option is to install an audio mixer utility with a terminal user interface (TUI). If you've ever used alsamixer on Linux, mixertui(8) will be very familiar:
doas pkg install mixertuiYou can like, share, or comment on this post on the Fediverse 💬
» Next: Networking on a FreeBSD Laptop
« Previous: FreeBSD Power Management