Issue with laptop sound

Following are some details.
Code:
root@fbsd:~ # uname -a
FreeBSD fbsd 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
root@fbsd:~ # dmesg | grep pcm
pcm0: <Realtek ALC293 (Analog 2.0+HP/2.0)> at nid 20,21 and 25 on hdaa0
pcm1: <Realtek ALC293 (Analog)> at nid 22 and 19 on hdaa0
pcm2: <Intel Skylake (HDMI/DP 8ch)> at nid 3 on hdaa1
root@fbsd:~ # cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC293 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Realtek ALC293 (Analog)> (play/rec)
pcm2: <Intel Skylake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
root@fbsd:~ # sysctl hw.snd.default_unit
hw.snd.default_unit: 0
root@fbsd:~ # beep -D 1000
The last command gives a good beep of approximately 1 second duration. If I understand the above correctly, my laptop has 3 sound cards, of which pcm0 is the default. Therefore the beep sound means, things are working correctly so far. However, I think I should be able to choose a different card as the default and still hear the beep. For example, if
Code:
root@fbsd:~ # sysctl hw.snd.default_unit=1
hw.snd.default_unit: 0 -> 1
root@fbsd:~ # beep -D 1000
then I hear no beep. Same happens if I choose default_unit=2. Is this correct behavior? I think not, because all the three cards show "play" which I assume indicates their capability. Please correct me if I am wrong. If this is a real problem, then I think internally, the cards 2 and 3 may not be signalling the speaker correctly. How is this fixed?

Thanks.
 
To me, pcm0 is for headphone + speaker, pcm1 is something unknown to me, and pcm2 is for audio over hdmi/displayport.
 
Thanks for the reply. Now I understand. I tested pcm0 with external speakers and it works. pcm2 will work if I connected a tv or something by the hdmi port and set pcm2 as default. As for pcm1, I have no idea. Is there a way to find out?
 
Both are Realtek ALC293 so it's the same hardware device, not two separate sound cards. Does your computer have two jack outputs? Many computers have one on the front side and one on the rear side and FreeBSD sometimes registers them as two separate pcm devices. In this case, pcm1 could be the other one you haven't tried yet. Or for example, on my laptop, pcm1 is used for the audio jacks present on a compatible docking station (even if no such hardware is present).
 
tingo said:
pcm1 could be the microphone, if your laptop have one

Yes that turns out to be correct for the laptop. After some reading of snd_hda(4) and of sysctl(8), I get for my system, the following
Code:
# dmesg | grep pcm1
pcm1: <Realtek ALC293 (Analog)> at nid 22 and 19 on hdaa0
# sysctl dev.hdaa.0.nid19 | grep pin
dev.hdaa.0.nid19: pin: Mic (Fixed)
# dmesg | grep pcm0
pcm0: <Realtek ALC293 (Analog 2.0+HP/2.0)> at nid 20,21 and 25 on hdaa0
# sysctl dev.hdaa.0.nid20 | grep pin
dev.hdaa.0.nid20: pin: Speaker (Fixed)
# sysctl dev.hdaa.0.nid21 | grep pin
dev.hdaa.0.nid21: pin: Headphones (Green Jack)
# sysctl dev.hdaa.0.nid25 | grep pin
dev.hdaa.0.nid25: pin: Mic (Pink Jack)

bsduck said:
Both are Realtek ALC293 so it's the same hardware device, not two separate sound cards. Does your computer have two jack outputs? Many computers have one on the front side and one on the rear side and FreeBSD sometimes registers them as two separate pcm devices. In this case, pcm1 could be the other one you haven't tried yet.
It seems that there is only one jack on the laptop. I tested external speakers by plugging into the jack and they worked fine. Maybe the same jack works for an external mic. I don't have one handy though, so I can't tell for sure. I did try to record sound using audacity(1) with recording device set to /dev/dsp1 and that works as well!

I can say that now I have the audio setup roughly figured out. But the reason I was trying to understand this was that connecting Bluetooth earphones hasn't worked for me. I have followed the steps indicated in Thread trying-to-understand-the-relationship-between-bluetooth-headphones-virtual_oss-and-the-mixer.93679. When I issue the commands
Code:
# hccontrol -n ubt0hci create_connection earphones
BD_ADDR: earphones
Connection handle: 256
Encryption mode: Disabled [0]
# virtual_oss -T /dev/sndstat  -S -C 2 -c 2 -r 48000 -b 16 -s 4ms -R /dev/null  -P /dev/bluetooth/earphones -d dsp -t vdsp.ctl
hw.snd.basename_clone: 1 -> 0
backend_bt: PSM=0x19

I can hear the sound confirming that the earphones have connected. /dev/sndstat looks like the following
Code:
$ cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC293 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Realtek ALC293 (Analog)> (play/rec)
pcm2: <Intel Skylake (HDMI/DP 8ch)> (play)
Installed devices from userspace:
dsp: <Virtual OSS> (play/rec)
However, when I play any audio/video file, I do not hear any sound in the earphones. I thought that maybe the volume was 0. So I tried virtual_oss_ctl -f /dev/vdsp.ctl. The GUI shows the TX flickering green to red as the audio file is played for both dsp Ch1 and dsp Ch2 but there is no sound. I think it should be possible to figure this out as the earphones work alright in other operating systems.

Thanks.
 
Back
Top