Page 2 of 2

Re: usb rotary encoder

Posted: Wed Mar 18, 2026 3:53 am
by 1994Blazer
hudiy wrote: Sun Jan 04, 2026 6:10 pm In the Hudiy configuration, you can specify which audio sink should be used for volume control. If no sink is set, the system default (virtual hudiy_equalizer_sink) is selected.

To our knowledge, labwc uses aamixer to handle volume keys. Most likely, aamixer (via PipeWire) controls the volume of the actual audio device sink (not the default sink), which causes the discrepancy in behavior. We recommend to specify the sink associated with the actual audio device in volumeSinkName (pactl list sinks).

Docs:
https://github.com/wiboma/hudiy/blob/ma ... n.md#sound (volumeSinkName)
I set the volume sink name to the proper source, "volumeSinkName" : "surround51_to_41", but the encoder does not work with Hudiy. Sometimes it does affect the desktop audio but it never changes the Hudity audio. Any help would be great. it's the one thing that is hanging me up.

Re: usb rotary encoder

Posted: Wed Mar 18, 2026 2:56 pm
by hudiy
According to the labwc documentation, amixer is used by default to handle XF86_AudioLowerVolume, XF86_AudioRaiseVolume, and XF86_AudioMute. amixer likely has no knowledge of virtual sinks created by PipeWire (such as a remap-sink or an equalizer sink) and operates on real hardware (device sink).

https://github.com/labwc/labwc?tab=read ... le#5-usage

You should change the commands triggered by XF86_AudioLowerVolume, XF86_AudioRaiseVolume and XF86_AudioMute in the $HOME/.config/labwc/rc.xml file to pactl (e. g. pactl set-sink-volume surround51_to_41 -5%).

Since pactl allows you to raise the volume above 100%, you can use a simple bash script that will limit the volume level and be triggered when pressing the aforementioned keys:

volume.sh

Code: Select all

#!/bin/bash

SINK="surround51_to_41"
ACTION=$1
STEP=5

case $ACTION in
    up)
        CURRENT_VOL=$(pactl get-sink-volume "$SINK" | grep -Po '\d+(?=%)' | head -n 1)
        
        if [ $((CURRENT_VOL + STEP)) -gt 100 ]; then
            pactl set-sink-volume "$SINK" 100%
        else
            pactl set-sink-volume "$SINK" +${STEP}%
        fi
        ;;
    down)
        pactl set-sink-volume "$SINK" -${STEP}%
        ;;
    mute)
        pactl set-sink-mute "$SINK" toggle
        ;;
    *)
        exit 1
        ;;
esac
then

Code: Select all

/home/pi/volume.sh up
/home/pi/volume.sh down
/home/pi/volume.sh mute
viewtopic.php?p=797#p797

For the volume level changes from pactl to be visible in Hudiy, you need to modify the volume of the sink that is specified in volumeSinkName (to match the name of the sink controlled via pactl) - https://github.com/wiboma/hudiy/blob/ma ... n.md#sound

Re: usb rotary encoder

Posted: Fri Mar 20, 2026 12:38 am
by 1994Blazer
hudiy wrote: Wed Mar 18, 2026 2:56 pm According to the labwc documentation, amixer is used by default to handle XF86_AudioLowerVolume, XF86_AudioRaiseVolume, and XF86_AudioMute. amixer likely has no knowledge of virtual sinks created by PipeWire (such as a remap-sink or an equalizer sink) and operates on real hardware (device sink).

https://github.com/labwc/labwc?tab=read ... le#5-usage

You should change the commands triggered by XF86_AudioLowerVolume, XF86_AudioRaiseVolume and XF86_AudioMute in the $HOME/.config/labwc/rc.xml file to pactl (e. g. pactl set-sink-volume surround51_to_41 -5%).

Since pactl allows you to raise the volume above 100%, you can use a simple bash script that will limit the volume level and be triggered when pressing the aforementioned keys:

volume.sh

Code: Select all

#!/bin/bash

SINK="surround51_to_41"
ACTION=$1
STEP=5

case $ACTION in
    up)
        CURRENT_VOL=$(pactl get-sink-volume "$SINK" | grep -Po '\d+(?=%)' | head -n 1)
        
        if [ $((CURRENT_VOL + STEP)) -gt 100 ]; then
            pactl set-sink-volume "$SINK" 100%
        else
            pactl set-sink-volume "$SINK" +${STEP}%
        fi
        ;;
    down)
        pactl set-sink-volume "$SINK" -${STEP}%
        ;;
    mute)
        pactl set-sink-mute "$SINK" toggle
        ;;
    *)
        exit 1
        ;;
esac
then

Code: Select all

/home/pi/volume.sh up
/home/pi/volume.sh down
/home/pi/volume.sh mute
viewtopic.php?p=797#p797

For the volume level changes from pactl to be visible in Hudiy, you need to modify the volume of the sink that is specified in volumeSinkName (to match the name of the sink controlled via pactl) - https://github.com/wiboma/hudiy/blob/ma ... n.md#sound
Thank you for the response. So, I was able to change it to Pactl like the viewtopic.php?p=797#p797 thread you posted said to and it worked and it displayed it in Hudiy! The only issue I'm having is like you said it doesn't really have a limit how high it will go. I tried to implement the code you posted but I'm not having any luck. Its most likely me as I'm really new to Linux as a whole and I'm probably not doing it right. I'm extremely green when it comes to the terminal code.

Re: usb rotary encoder

Posted: Fri Mar 20, 2026 5:01 am
by hudiy
Please check that your volume.sh script has correct line endings (dos2unix volume.sh command) and executable permissions (chmod +x volume.sh command).