Re: sndiod -F does not switch to device

2020-11-23 Thread Jan Stary
Hi,

On Nov 23 09:43:33, a...@caoua.org wrote:
> On Sun, Nov 22, 2020 at 07:48:14PM +0100, Jan Stary wrote:
> > This is current/amd64 (dmesg below),
> > running /usr/bin/sndiod -f rsnd/0 -F rsnd/1
> > 
> > While the -F feature works with most USB audio devices I have tried,
> > it does not make the switch to use the -F device
> > with this USB camera with a builtin microphone.
> > It's an Audom AF640 and it attaches as follows:
> > 
> > uvideo0 at uhub0 port 1 configuration 1 interface 0 "Sunplus IT Co Full HD 
> > webcam" rev 2.00/0.05 addr 2
> > video0 at uvideo0
> > uaudio0 at uhub0 port 1 configuration 1 interface 3 "Sunplus IT Co Full HD 
> > webcam" rev 2.00/0.05 addr 2
> > uaudio0: class v1, high-speed, sync, channels: 0 play, 1 rec, 2 ctls
> > audio1 at uaudio0
> > 
> > I can confirm that both the camera and the mike themselves work.
> > After plugging it in, sndioctl says
> > 
> > input.level=0.000
> > input.mute=1
> > output.level=0.980
> > output.mute=0
> > server.device=0
> > app/rec0.level=1.000
> > 
> > Notice the server.device=0, meaning it is still using snd/0.
> > Notice the zero input level and the muted input.
> > Is this intended?
> > 
> > If I plug a Sennheiser haedset instead, sndioctl says
> > 
> > input.level=0.800
> > input.mute=0
> > output.level=0.800
> > output.mute=0
> > server.device=1
> > app/rec0.level=1.000
> > 
> > switching to the USB device plugged in.
> > 
> > Is it because the camera's mike has no output channels?
> > "channels: 0 play, 1 rec, 2 ctls" - indeed, it only
> > records mono and has no playback capabilities.
> > 
> > According to the manpage
> > 
> > -F device
> > Specify an alternate device to use.  If it doesn't work,
> > the one given with the last -f or -F options will be used.
> > For instance, specifying a USB device following a PCI device
> > allows sndiod to use the USB one preferably when it's
> > connected and to fall back to the PCI one when it's
> > disconnected. Alternate devices may be switched with the
> > server.device control of the sndioctl(1) utility.
> > 
> > Is the -F device required to have at least one playback
> > and pne record channel to "work"?
> > 
> > Switching with a manual "sndioctl server.device=1"
> > doesn't work either: sndioctl still shows server.device=0
> > 
> > Is this intended?
> > How can I further debug this?
> > 
> 
> Hi,
> 
> The -F option works only if two devices have the same capabilities,
> this allows to pull the USB cable and continue using the internal
> device.
> 
> In your case the webcam can't play but sndiod is configured to use
> full-duplex mode. From this stand-point, the webcam is not usable and
> sndiod tries the next device.

thank you for the insight.

Do you think a short sentence to that effect
would be an improvement to sndiod.8 ?

Jan

Index: sndiod.8
===
RCS file: /cvs/src/usr.bin/sndiod/sndiod.8,v
retrieving revision 1.8
diff -u -p -u -p -r1.8 sndiod.8
--- sndiod.828 Jun 2020 05:21:39 -  1.8
+++ sndiod.823 Nov 2020 17:17:53 -
@@ -186,7 +186,10 @@ Examples:
 .Va u8 , s16le , s24le3 , s24le4lsb .
 .It Fl F Ar device
 Specify an alternate device to use.
-If it doesn't work, the one given with the last
+If it doesn't work or doesn't have the capabilities
+required by the current
+.Fl m
+mode, the device given with the last
 .Fl f
 or
 .Fl F






Re: sndiod -F does not switch to device

2020-11-23 Thread Alexandre Ratchov
On Sun, Nov 22, 2020 at 07:48:14PM +0100, Jan Stary wrote:
> This is current/amd64 (dmesg below),
> running /usr/bin/sndiod -f rsnd/0 -F rsnd/1
> 
> While the -F feature works with most USB audio devices I have tried,
> it does not make the switch to use the -F device
> with this USB camera with a builtin microphone.
> It's an Audom AF640 and it attaches as follows:
> 
> uvideo0 at uhub0 port 1 configuration 1 interface 0 "Sunplus IT Co Full HD 
> webcam" rev 2.00/0.05 addr 2
> video0 at uvideo0
> uaudio0 at uhub0 port 1 configuration 1 interface 3 "Sunplus IT Co Full HD 
> webcam" rev 2.00/0.05 addr 2
> uaudio0: class v1, high-speed, sync, channels: 0 play, 1 rec, 2 ctls
> audio1 at uaudio0
> 
> I can confirm that both the camera and the mike themselves work.
> After plugging it in, sndioctl says
> 
> input.level=0.000
> input.mute=1
> output.level=0.980
> output.mute=0
> server.device=0
> app/rec0.level=1.000
> 
> Notice the server.device=0, meaning it is still using snd/0.
> Notice the zero input level and the muted input.
> Is this intended?
> 
> If I plug a Sennheiser haedset instead, sndioctl says
> 
> input.level=0.800
> input.mute=0
> output.level=0.800
> output.mute=0
> server.device=1
> app/rec0.level=1.000
> 
> switching to the USB device plugged in.
> 
> Is it because the camera's mike has no output channels?
> "channels: 0 play, 1 rec, 2 ctls" - indeed, it only
> records mono and has no playback capabilities.
> 
> According to the manpage
> 
> -F device
> Specify an alternate device to use.  If it doesn't work,
> the one given with the last -f or -F options will be used.
> For instance, specifying a USB device following a PCI device
> allows sndiod to use the USB one preferably when it's
> connected and to fall back to the PCI one when it's
> disconnected. Alternate devices may be switched with the
> server.device control of the sndioctl(1) utility.
> 
> Is the -F device required to have at least one playback
> and pne record channel to "work"?
> 
> Switching with a manual "sndioctl server.device=1"
> doesn't work either: sndioctl still shows server.device=0
> 
> Is this intended?
> How can I further debug this?
> 

Hi,

The -F option works only if two devices have the same capabilities,
this allows to pull the USB cable and continue using the internal
device.

In your case the webcam can't play but sndiod is configured to use
full-duplex mode. From this stand-point, the webcam is not usable and
sndiod tries the next device.

sndiod could/should be changed to simply discard samples to play and
always present the webcam as a full-duplex device (similarly, produce
silence for play-only devices). The code to do so is not there yet,
unfortunately.



Re: sndiod -F does not switch to device

2020-11-22 Thread Jan Stary
On Nov 22 21:31:38, mih...@gmail.com wrote:
> https://marc.info/?l=openbsd-misc&m=158436621701274&w=2

I'm not trying to combine two devices as they discuss there.
I'm trying to have sndiod -F rsnd/1 switch to audio1.

(Is it related, though, to the webcam
not having a playback channel?)




Re: sndiod -F does not switch to device

2020-11-22 Thread Mihai Popescu
https://marc.info/?l=openbsd-misc&m=158436621701274&w=2


sndiod -F does not switch to device

2020-11-22 Thread Jan Stary
This is current/amd64 (dmesg below),
running /usr/bin/sndiod -f rsnd/0 -F rsnd/1

While the -F feature works with most USB audio devices I have tried,
it does not make the switch to use the -F device
with this USB camera with a builtin microphone.
It's an Audom AF640 and it attaches as follows:

uvideo0 at uhub0 port 1 configuration 1 interface 0 "Sunplus IT Co Full HD 
webcam" rev 2.00/0.05 addr 2
video0 at uvideo0
uaudio0 at uhub0 port 1 configuration 1 interface 3 "Sunplus IT Co Full HD 
webcam" rev 2.00/0.05 addr 2
uaudio0: class v1, high-speed, sync, channels: 0 play, 1 rec, 2 ctls
audio1 at uaudio0

I can confirm that both the camera and the mike themselves work.
After plugging it in, sndioctl says

input.level=0.000
input.mute=1
output.level=0.980
output.mute=0
server.device=0
app/rec0.level=1.000

Notice the server.device=0, meaning it is still using snd/0.
Notice the zero input level and the muted input.
Is this intended?

If I plug a Sennheiser haedset instead, sndioctl says

input.level=0.800
input.mute=0
output.level=0.800
output.mute=0
server.device=1
app/rec0.level=1.000

switching to the USB device plugged in.

Is it because the camera's mike has no output channels?
"channels: 0 play, 1 rec, 2 ctls" - indeed, it only
records mono and has no playback capabilities.

According to the manpage

-F device
Specify an alternate device to use.  If it doesn't work,
the one given with the last -f or -F options will be used.
For instance, specifying a USB device following a PCI device
allows sndiod to use the USB one preferably when it's
connected and to fall back to the PCI one when it's
disconnected. Alternate devices may be switched with the
server.device control of the sndioctl(1) utility.

Is the -F device required to have at least one playback
and pne record channel to "work"?

Switching with a manual "sndioctl server.device=1"
doesn't work either: sndioctl still shows server.device=0

Is this intended?
How can I further debug this?

Jan



OpenBSD 6.8-current (GENERIC.MP) #0: Sun Nov 22 17:22:47 CET 2020
h...@lenovo.stare.cz:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8463781888 (8071MB)
avail mem = 8191975424 (7812MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0010 (80 entries)
bios0: vendor LENOVO version "7UET94WW (3.24 )" date 10/17/2012
bios0: LENOVO 64741EG
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET SLIC BOOT ASF! SSDT TCPA SSDT 
SSDT SSDT
acpi0: wakeup devices LID_(S3) SLPB(S3) IGBE(S4) EXP0(S4) EXP1(S4) EXP2(S4) 
EXP3(S4) EXP4(S4) PCI1(S4) USB0(S3) USB3(S3) USB5(S3) EHC0(S3) EHC1(S3) HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz, 2261.40 MHz, 06-17-06
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,NXE,LONG,LAHF,PERF,SENSOR,MELTDOWN
cpu0: 3MB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 7 var ranges, 88 fixed ranges
cpu0: apic clock running at 266MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2.1.3, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz, 2261.01 MHz, 06-17-06
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,NXE,LONG,LAHF,PERF,SENSOR,MELTDOWN
cpu1: 3MB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins, remapped
acpimcfg0 at acpi0
acpimcfg0: addr 0xe000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (AGP_)
acpiprt2 at acpi0: bus 2 (EXP0)
acpiprt3 at acpi0: bus 3 (EXP1)
acpiprt4 at acpi0: bus -1 (EXP2)
acpiprt5 at acpi0: bus 5 (EXP3)
acpiprt6 at acpi0: bus 13 (EXP4)
acpiprt7 at acpi0: bus 21 (PCI1)
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpipci0 at acpi0 PCI0: 0x 0x0011 0x0001
acpicmos0 at acpi0
tpm0 at acpi0 TPM_ addr 0xfed4/0x5000, device 0x10208086 rev 0x6
acpibat0 at acpi0: BAT0 model "92P1137" serial57 type LION oem "SANYO"
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0: version 1.0
"PNP0C14" at acpi0 not configured
acpicpu0 at acpi0: !C3(100@57 mwait.3@0x30), !C2(500@1 mwait.1@0x10), C1(1000@1 
mwait.1), PSS
acpicpu1 at acpi0: !C3(100@57 mwait.3@0x30), !C2(500@1 mwait.1@0x10), C1(1000@1 
mwait.1), PSS
acpipwrres0 at acpi0: PUBS, resource for USB0, USB3, USB5, EHC0, EHC1
acpitz0 at acpi0: critical temperature is 127 degC
acpitz1 at acpi0