summaryrefslogtreecommitdiff
path: root/content/bsd/thinkpad/switching-between-speakers-and-headphones-on-freebsd.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/bsd/thinkpad/switching-between-speakers-and-headphones-on-freebsd.md')
-rw-r--r--content/bsd/thinkpad/switching-between-speakers-and-headphones-on-freebsd.md50
1 files changed, 28 insertions, 22 deletions
diff --git a/content/bsd/thinkpad/switching-between-speakers-and-headphones-on-freebsd.md b/content/bsd/thinkpad/switching-between-speakers-and-headphones-on-freebsd.md
index 82e842b..3a0c37d 100644
--- a/content/bsd/thinkpad/switching-between-speakers-and-headphones-on-freebsd.md
+++ b/content/bsd/thinkpad/switching-between-speakers-and-headphones-on-freebsd.md
@@ -1,29 +1,31 @@
----
-title: "Switching Between Speakers and Headphones on FreeBSD"
-category: bsd
-abstract: How to change the audio device?
-date: 2023-03-16T22:52:01+01:00
-year: 2023
-draft: false
-tags:
-- FreeBSD
-- headphones
-- speakers
-- ThinkPad
-- audio
-- tutorial
----
-I want my laptop to switch to wired headphones when I attach them. FreeBSD has its own [Sound System](https://wiki.freebsd.org/Sound), so it's a great learning experience. I have yet to automate it (it is possible, but an attempt to do so forced me to do a complete rollback of the system state), but for now, this is working.
++++
+title = "FreeBSD: Switching Between Speakers and Headphones"
+author = ["MichaƂ Sapka"]
+date = 2023-03-16T23:02:00+01:00
+categories = ["bsd"]
+draft = false
+weight = 2003
+abstract = "How to change the audio sevices?"
+[menu]
+ [menu.bsd-thinkpad]
+ weight = 2003
+ identifier = "freebsd-switching-between-speakers-and-headphones"
+ name = "Switching beteen headphnes and speakers"
++++
+
+I want my laptop to switch to wired headphones when I attach them.
+FreeBSD has its own [Sound System](https://wiki.freebsd.org/Sound), so it's a great learning experience.
+I have yet to automate it (it is possible, but an attempt to do so forced me to do a complete rollback of the system state), but for now, this is working.
First, check which audio outputs your device supports:
-```
+```shell
$ cat /dev/sndstat
```
In the case of my ThinkPad, this returns
-```
+```shell
Installed devices:
pcm0: <NVIDIA (0x0094) (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA (0x0094) (HDMI/DP 8ch)> (play)
@@ -39,13 +41,17 @@ pcm4 - the headphone jack
I can now easily switch between them:
-```
+```shell
# enable speakers
$ sysctl hw.snd.default_unit=3
-# enable headphones
+# enable headphones
$ sysctl hw.snd.default_unit=4
```
-(replace the value with the correct id from `sndstat` file.)
+(replace the value with the correct id from \`sndstat\` file.)
-This, however, comes with a huge caveat. Some apps (khem khem, Firefox) not native to FreeBSD come configured with PulseAudio instead of FreeBSD's Sound System. This creates a level of indirection, and changing system output may not work instantly. In the case of Firefox, I need to reload the tab. Some apps, as I've heard, require a restart.
+This, however, comes with a huge caveat.
+Some apps (khem khem, Firefox) not native to FreeBSD come configured with PulseAudio instead of FreeBSD's Sound System.
+This creates a level of indirection, and changing system output may not work instantly.
+In the case of Firefox, I need to reload the tab.
+Some apps, as I've heard, require a restart.