Audio Skipping when changing CEC audio via Keymap using System.Exec

  • My audio consistently skips 2-3 times when I increase or decrease the audio using this script:

    Bash
    #!/bin/bash
    
    action() {
            cec-ctl --to 0 --user-control-pressed ui-cmd=volume-up
            exit 1
    }
    
    action &

    The volume up script is the same but using 0x41 instead.

    This is my keymap:

    I'm sure there's a better way to do this, but I'm at my wits end. It doesn't skip when I run it from the command line on root.

    Here is what I think is the relevant part of the logs:

  • Forgot to mention I'm running a raspberry pi 5 on version 12.0.1, plugged into a TCL Roku TV.

    Also forgot to mention that it does indeed control the TV audio as I intend it to.

  • I solved my problem, based on this thread reply. I'm guessing something to do with using system.exec takes over the sound device for some reason, or its some sort of blocking operation. I ended up basically copying the script from that thread and it all works now without skips!