audio – ALSA/Pipewire: Make both internal speakers and headphone jack visible for selection

I am running Fedora 35 (previously 34) on a laptop. All is well except that I can’t make the system auto-detect the sound card. So I manually created the ~/.asoundrc file:

defaults.pcm.card 0
defaults.pcm.device 5
defaults.ctl.card 0

This sent sound to internal speakers. To send sound to headphones, I manually:

1/ Change the contents of .asoundrc to:

defaults.pcm.card 0
defaults.pcm.device 0
defaults.ctl.card 0

2/ Restart the pipewire service:

systemctl --user restart pipewire.service

Is there a way to specify BOTH device 0 and device 5 in this file (or elsewhere) so that I can select one or the other from the Sound control panel?

Many thanks!!!

bash-5.1$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sofrt5682 [sof-rt5682], device 0: Port1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofrt5682 [sof-rt5682], device 2: HDMI1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofrt5682 [sof-rt5682], device 3: HDMI2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofrt5682 [sof-rt5682], device 4: HDMI3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofrt5682 [sof-rt5682], device 5: Speakers (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0


bash-5.1$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
pipewire
    PipeWire Sound Server
sysdefault:CARD=sofrt5682
    sof-rt5682, 
    Default Audio Device

Read more here: Source link