get audio temporarily to a USB headset instead of integral loudspeakers

grahamperrin

Beastie's Twin

Reaction score: 1,705
Messages: 5,088

A few months ago (probably with 13.0-CURRENT) I got FreeBSD to work with a USB headset, but it wasn't easy.

Now (14.0-CURRENT), I can't remember how to temporarily switch:
  • from loudspeakers – pcm1: <IDT 92HD81B1X (Analog 2.0+HP/2.0)> (play/rec)
  • to SteelSeries Siberia 350 – currently at /dev/ugen1.6
2021-05-19 03:55:21.png


– I hear sound, but it's from the loudspeakers, not USB.

What am I missing?

Code:
% cat /dev/sndstat
Installed devices:
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <IDT 92HD81B1X (Analog 2.0+HP/2.0)> (play/rec) default
pcm2: <IDT 92HD81B1X (Analog)> (play/rec)
pcm3: <USB audio> (rec)
pcm4: <USB audio> (play/rec)
Installed devices from userspace:
dsp: <Virtual OSS> (play/rec)
% lsusb | sort
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen0.10: ID 0951:1666 Kingston Technology DataTraveler 100 G3/G4/SE9 G2/50
Bus /dev/usb Device /dev/ugen0.2: ID 0424:5434 Microchip Technology, Inc. (formerly SMSC) Hub
Bus /dev/usb Device /dev/ugen0.3: ID 047d:2048 Kensington Orbit Trackball with Scroll Ring
Bus /dev/usb Device /dev/ugen0.4: ID 03f0:0024 HP, Inc KU-0316 Keyboard
Bus /dev/usb Device /dev/ugen0.5: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus /dev/usb Device /dev/ugen0.6: ID 2a70:f003 OnePlus Technology (Shenzhen) Co., Ltd.
Bus /dev/usb Device /dev/ugen0.7: ID 0bda:58fe Realtek Semiconductor Corp.
Bus /dev/usb Device /dev/ugen0.8: ID 0424:5434 Microchip Technology, Inc. (formerly SMSC) Hub
Bus /dev/usb Device /dev/ugen0.9: ID 174c:5106 ASMedia Technology Inc. ASM1051 SATA 3Gb/s bridge
Bus /dev/usb Device /dev/ugen1.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen1.2: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus /dev/usb Device /dev/ugen1.3: ID 04f2:b230 Chicony Electronics Co., Ltd Integrated HP HD Webcam
Bus /dev/usb Device /dev/ugen1.4: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus /dev/usb Device /dev/ugen1.5: ID 03f0:3d1d HP, Inc
Bus /dev/usb Device /dev/ugen1.6: ID 1038:1229 SteelSeries ApS
Bus /dev/usb Device /dev/ugen2.1: ID 0000:0000
Bus /dev/usb Device /dev/ugen2.2: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus /dev/usb Device /dev/ugen2.3: ID 0951:1666 Kingston Technology DataTraveler 100 G3/G4/SE9 G2/50
Bus /dev/usb Device /dev/ugen2.4: ID 0a5c:21e1 Broadcom Corp. HP Portable SoftSailing
% usbconfig | sort
ugen0.1: <0x8086 XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.10: <Kingston DataTraveler 3.0> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (74mA)
ugen0.2: <vendor 0x0424 product 0x5434> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (2mA)
ugen0.3: <Primax Kensington Eagle Trackball> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen0.4: <CHICONY HP Basic USB Keyboard> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen0.5: <vendor 0x0424 product 0x2514> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (2mA)
ugen0.6: <Android Android> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.7: <317GAWCM001LON33N1ED USB Video device> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.8: <SMSC USB5534> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.9: <StoreJet Transcend StoreJet Transcend> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (36mA)
ugen1.1: <Intel EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen1.2: <vendor 0x8087 product 0x0024> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen1.3: <Chicony Electronics Co., Ltd. HP HD Webcam Fixed> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen1.4: <vendor 0x0424 product 0x2514> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (2mA)
ugen1.5: <HP HP hs2350 HSPA+ MobileBroadband> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (0mA)
ugen1.6: <SteelSeries SteelSeries Siberia 350> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (250mA)
ugen2.1: <Intel EHCI root HUB> at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen2.2: <vendor 0x8087 product 0x0024> at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen2.3: <Kingston DataTraveler 3.0> at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (200mA)
ugen2.4: <Broadcom Corp BCM20702A0> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (0mA)
% sysctl hw.snd
hw.snd.maxautovchans: 16
hw.snd.default_unit: 1
hw.snd.version: 2009061500/amd64
hw.snd.default_auto: 0
hw.snd.verbose: 0
hw.snd.vpc_mixer_bypass: 1
hw.snd.feeder_rate_quality: 1
hw.snd.feeder_rate_round: 25
hw.snd.feeder_rate_max: 2016000
hw.snd.feeder_rate_min: 1
hw.snd.feeder_rate_polyphase_max: 183040
hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97
hw.snd.feeder_eq_exact_rate: 0
hw.snd.feeder_eq_presets: PEQ:16000,0.2500,62,0.2500:-9,9,1.0:44100,48000,88200,96000,176400,192000
hw.snd.basename_clone: 0
hw.snd.compat_linux_mmap: 0
hw.snd.syncdelay: -1
hw.snd.usefrags: 0
hw.snd.vpc_reset: 0
hw.snd.vpc_0db: 45
hw.snd.vpc_autoreset: 1
hw.snd.timeout: 5
hw.snd.latency_profile: 1
hw.snd.latency: 2
hw.snd.report_soft_matrix: 1
hw.snd.report_soft_formats: 1
%

From my /etc/rc.conf:

Code:
virtual_oss_enable="NO"
virtual_oss_default_args="\
  -T /dev/sndstat \
  -S \
  -i 8 \
  -C 2 -c 2 \
  -r 48000 \
  -b 24 \
  -s 8.0ms \
  -f /dev/dsp1 \
  -c 2 \
  -d dsp \
  -t vdsp.ctl"
sndiod_enable="YES"

I can use Audio Mixer a.k.a. GTK-Mixer audio/gtk-mixer to change the default:

2021-05-19 03:58:16.png

2021-05-19 03:58:28.png

Code:
% date ; cat /dev/sndstat
Wed 19 May 2021 04:53:25 BST
Installed devices:
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <IDT 92HD81B1X (Analog 2.0+HP/2.0)> (play/rec)
pcm2: <IDT 92HD81B1X (Analog)> (play/rec)
pcm3: <USB audio> (rec)
pcm4: <USB audio> (play/rec) default
Installed devices from userspace:
dsp: <Virtual OSS> (play/rec)
% pkg rquery '%o %v %R' gtk-mixer
audio/gtk-mixer 1.0.0 FreeBSD
%

– but still, nothing from the USB headset. I open a new instance of Firefox, there's playback through the loudspeakers.
 

sko

Aspiring Daemon

Reaction score: 560
Messages: 879

I switch between my 5.1 speakers and USB headset DAC with sysctl hw.snd.default_unit = N.
Already running streams have to be stopped/restarted to use the new default device (and e.g. deadbeef needs to be restarted entirely)

Firefox is a very own and massively annoying piece of work. especially if you have pulseaudio installed things break left and right (and for whatever reason the OSS mixer drags that crap in as a dependency...). Get rid of pulseaudio and sound from firefox will work as expected again (i.e. always use the default device).
 
OP
grahamperrin

grahamperrin

Beastie's Twin

Reaction score: 1,705
Messages: 5,088

Thanks, I prefer the mixer GUI (pictured above) for switching, and switching does work, but this morning the effect of switching was not audible. The complication seemed to be use of virtual_oss.

… Get rid of pulseaudio …

PulseAudio is not the problem here. Deletion is not appropriate; it's required for some of what I use.

Firefox … annoying …

Firefox is not annoying. Re: <https://www.freshports.org/www/firefox/#message> I have media.cubeb.backend oss
 
OP
grahamperrin

grahamperrin

Beastie's Twin

Reaction score: 1,705
Messages: 5,088

Anyone – please – how can I temporarily allow Virtual OSS Control to control audio output to a USB headset?

When I next connect, the headset will probably be at pcm5 in /dev/sndstat
 
OP
grahamperrin

grahamperrin

Beastie's Twin

Reaction score: 1,705
Messages: 5,088

I've been ignoring this unsolved problem (not using headphones) for the past three months.

still, nothing from the USB headset. I open a new instance of Firefox, there's playback through the loudspeakers.

Today with audio working to the USB headset but not loud enough, I ran service virtual_oss onestart (hoping to use Virtual OSS Control to boost things beyond the normal maximum), lost audio 😧

Experimented with a change to rc.conf(5) – the unchanged edition, from May, is above:

From my /etc/rc.conf:

– then service virtual_oss onerestart.

Code:
root@mowa219-gjp4-8570p-freebsd:~ # service virtual_oss onestart
Starting Virtual OSS config dsp ...hw.snd.basename_clone: 1 -> 0
 done
root@mowa219-gjp4-8570p-freebsd:~ # service virtual_oss onerestart
Stopping Virtual OSS config dsp ... done
Starting Virtual OSS config dsp ...hw.snd.basename_clone: 0 -> 0
virtual_oss: Could not create CUSE DSP device
 done
root@mowa219-gjp4-8570p-freebsd:~ # service virtual_oss onestop
root@mowa219-gjp4-8570p-freebsd:~ # service virtual_oss onestatus
virtual_oss is not running.
root@mowa219-gjp4-8570p-freebsd:~ # cat /dev/sndstat
Installed devices:
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <IDT 92HD81B1X (Analog 2.0+HP/2.0)> (play/rec)
pcm2: <IDT 92HD81B1X (Analog)> (play/rec)
pcm3: <USB audio> (rec)
pcm4: <USB audio> (play/rec) default
No devices installed from userspace.
root@mowa219-gjp4-8570p-freebsd:~ #

… and so on. Eventually I have virtual_oss confirmed stopped (it sometimes does not stop following a stop instruction):

Code:
root@mowa219-gjp4-8570p-freebsd:~ # service virtual_oss onestop
Stopping Virtual OSS config dsp ... done
root@mowa219-gjp4-8570p-freebsd:~ # service virtual_oss onestatus
virtual_oss is running as pid 65924.
root@mowa219-gjp4-8570p-freebsd:~ # service virtual_oss onestatus
virtual_oss is not running.
root@mowa219-gjp4-8570p-freebsd:~ #

I reverted my rc.conf to its original state.



I'm left with no audio – nothing from integral loudspeakers or the headset on USB, which is frustrating.

Code:
% ls -hl /dev/dsp*
crw-rw-rw-  1 root  wheel   0x91 21 Dec 08:39 /dev/dsp0.0
crw-rw-rw-  1 root  wheel  0x244 23 Dec 05:44 /dev/dsp1.1
crw-rw-rw-  1 root  wheel   0x8f 21 Dec 08:39 /dev/dsp2.0
crw-rw-rw-  1 root  wheel   0x56 22 Dec 11:26 /dev/dsp3.0
crw-rw-rw-  1 root  wheel  0x23a 23 Dec 05:25 /dev/dsp4.0
%

Without restarting the entire system, how can I recover in a situation such as this?
 
Top