Skip to content
Get 5% off your entire order with a minimum purchase of $30 – automatically applied at checkout ! Black Friday Exclusive Deals Await!
PIKVM X680 GPIO LED adding | Geekworm

PIKVM X680 GPIO LED adding


  • nano /etc/kvmd/override.yaml

    kvmd:
        gpio:
            drivers: 
                switch_input_1:
                    type: cmd
                    cmd: [/usr/bin/bash, /etc/kvmd/scripts/switch_input.sh, 1]
                switch_input_2:
                    type: cmd
                    cmd: [/usr/bin/bash, /etc/kvmd/scripts/switch_input.sh, 2]
                switch_input_3:
                    type: cmd
                    cmd: [/usr/bin/bash, /etc/kvmd/scripts/switch_input.sh, 3]
                switch_input_4:
                    type: cmd
                    cmd: [/usr/bin/bash, /etc/kvmd/scripts/switch_input.sh, 4]
            scheme:
                switch_input_1_button:
                    driver: switch_input_1
                    mode: output
                    switch: false
                switch_input_2_button:
                    driver: switch_input_2
                    mode: output
                    switch: false
                switch_input_3_button:
                    driver: switch_input_3
                    mode: output
                    switch: false
                switch_input_4_button:
                    driver: switch_input_4
                    mode: output
                    switch: false
            view:
                header:
                    title: Source Control
                table:
                    - ["#OS Select"]
    				- []
                    - ["#[1] Windows", led1, "switch_input_1_button|Switch"]
                    - ["#[2] macOS", led2, "switch_input_2_button|Switch"]
                    - ["#[3] HDMI3", led3, "switch_input_3_button|Switch"]
                    - ["#[4] HDMI4", led4, "switch_input_4_button|Switch"]

    and create /etc/kvmd/scripts/switch_input.sh

    #!/bin/bash
    
    # Check for a valid argument (1, 2, 3, or 4)
    if [ "$#" -ne 1 ] || ! [[ "$1" =~ ^[1-4]$ ]]; then
    echo "Usage: $0 [1, 2, 3, or 4]"
    exit 1
    fi
    
    # Define the USB keyboard codes for 1, 2, 3, and 4
    usb_codes=("1e" "1f" "20" "21")
    
    # Send two Ctrl key presses
    echo -ne "\x1\0\0\0\0\0\0\0" > /dev/kvmd-hid-keyboard
    echo -ne "\0\0\0\0\0\0\0\0" > /dev/kvmd-hid-keyboard
    echo -ne "\x1\0\0\0\0\0\0\0" > /dev/kvmd-hid-keyboard
    echo -ne "\0\0\0\0\0\0\0\0" > /dev/kvmd-hid-keyboard
    
    
    # Send the USB keyboard code corresponding to the argument value
    usb_code="${usb_codes[$1 - 1]}"
    echo -ne "\0\0\x$usb_code\0\0\0\0\0" > /dev/kvmd-hid-keyboard
    echo -ne "\0\0\0\0\0\0\0\0" > /dev/kvmd-hid-keyboard

     

    I want to set the LED to turn on for the selected source.

    Is it possible?



  • When selected, the switch turns green.


  • @JinGyu Choi Were you able to get this to work?  I'd like to do this as well.


  • @Kevin Sporinsky It is possible without LED display. It is easy to do if you apply what I wrote.


Please login to reply this topic!