Re: Who is responding to my audio volume keys?

2022-02-01 Thread Jan Stary
On Dec 18 10:27:19, maillists.rul...@mailbox.org wrote:
> /etc/rc.conf.local:
>   sndiod_flags=-f rsnd/0 -F rsnd/1
>   ...
> 
> /etc/hotplug/{attach,detach}:
>   ...
>   DEVCLASS=$1
>   DEVNAME=$2
>   case $DEVCLASS in
>   0)
>   case $DEVNAME in
>   uaudio0)
>   rcctl reload sndiod

'rcctl reload' tells sndiod to reload its configuration.
AFAIK, sndiod has no configuration.

Given the sndiod -F above, it shouldn't be necessary
to do anything here.

Jan



Re: Who is responding to my audio volume keys?

2021-12-20 Thread Alexandre Ratchov
On Mon, Dec 20, 2021 at 09:59:29AM +0100, Richard Ulmer wrote:
> Hi Alexandre, Hi Christian,
> thanks for you responses! In the meantime Ralf Horstmann had also
> contacted me and helped me find a workaround.
> 
> Alexandre Ratchov  wrote:
> > Keyboard volume keys control volume of first audio device.
> 
> We probably have different definitions of 'first audio device', but even
> if I put 'rcctl set sndiod flags -f rsnd/1' into /etc/hotplug/attach and
> 'rcctl set sndiod flags -f rsnd/0' into /etc/hotplug/detach, so that
> only one audio device is configured at a time, the volume keys only work
> for the internal device.
> 

Sorry, I was refering to the first instance of the audio(4) driver,
a.k.a the "audio0 at ..." in dmesg output. The volume keys are handled
entierly inside the kernel with direct calls from the wskbd driver to
audio driver, so the logic is completely out of the scope of sndiod or
any program.



Re: Who is responding to my audio volume keys?

2021-12-19 Thread Alexandre Ratchov
On Sat, Dec 18, 2021 at 10:27:19AM +0100, Richard Ulmer wrote:
> Hi all,
> with the help of https://www.openbsd.org/faq/faq13.html I have set up a
> USB sound card for my laptop. I use when it is attached and the internal
> one when it is not (just like the example in FAQ #13).
> 
> This works nicely, but one thing is missing: The volume keys on my
> Laptop (ThinkPad T450) don't change the volume when the USB sound card
> is used. They work when the internal sound card is used, but I don't
> recall ever configuring this. There has to be someone listening to these
> keys, but I couldn't find who it is.
> 
> I can see the volume key events with xev(1) and the output of 'sndioctl
> output.level' changes when pressing the keys (only for the internal
> sound card), so I assume the volume is not controlled "by the hardware
> itself".
> 
> Can someone point me to the relevant man page?
> 

Keyboard volume keys control volume of first audio device. This is not
configurable. Unfortunately key strokes are not consumed, so they
propagate to Xorg and generate XF86XK_Audio{Raise,Lower}Volume which
may cause programs to change the volume a second time in a different
way.

I'd suggest to configure in your window manager hot-keys of your
choice to call sndioctl.

Alternatively, here's a tiny program to control sndiod(8) volume with
ctrl-alt-plus and ctrl-alt-minus; I mostly use it because my keyboard
has no volume keys but I realise it may be useful for setups with
multiple devices, so I throw it here:

https://caoua.org/alex/obsd/sndiokeys.tar.gz

HTH



Re: Who is responding to my audio volume keys?

2021-12-19 Thread Christian Weisgerber
On 2021-12-18, "Richard Ulmer"  wrote:

> This works nicely, but one thing is missing: The volume keys on my
> Laptop (ThinkPad T450) don't change the volume when the USB sound card
> is used. They work when the internal sound card is used, but I don't
> recall ever configuring this. There has to be someone listening to these
> keys, but I couldn't find who it is.

It's handled by the kernel.  There are a bunch of drivers that pick
up volume key presses--mostly wskbd(4), but also umstc(4) and some
acpi drivers--and call a function provided by audio(4) that changes
the volume of the audio0 device.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de