ThomasVon2021 / blikvm

Open and cost-effective "KVM-over-IP". BliKVM comes in 4 different models, v1 CM4, v2 PCIe, v3 HAT and v4 Allwinner, based on Raspberry Pi and Allwinner SoC.
https://thomasvon2021.github.io/blikvm/
GNU General Public License v3.0
355 stars 30 forks source link

BliKVM v4 Multiport control not working #168

Open nathcoad opened 1 month ago

nathcoad commented 1 month ago

I'm using the BliKVM-Switch-V1.0 with the BliKVM v4 Allwinner. Running blikvm, all works fine, but I prefer the interface of pikvm since I already have one of those.

I flashed blikvm-armbian-v4-pikvm-20240504.img onto a new micro sd card and booted off that. I re-configured the /etc/kvmd/override.yaml file to include the gpio configuration for the kvm switch. Unfortunately the GPIO control in pikvm doesn't work. I tried adding the protocol: 2 line and without. Manual control over the kvm switch (eg echo "SW2\r\nG02gA" > /dev/ttyUSB0) works fine.

Here are the contents of my /etc/kvmd/override.yaml file:

kvmd:
    hid:
        mouse_alt:
            device: /dev/kvmd-hid-mouse-alt  # allow relative mouse mode
    msd:
        type: disabled
    atx:
        type: disabled
    streamer:
        forever: true
        cmd_append:
            - "--slowdown"      # so target doesn't have to reboot
        resolution:
            default: 1280x720
    gpio:
        drivers:
            hk:
                type: xh_hk4401
                protocol: 2
                device: /dev/ttyUSB0
        scheme:
            ch0_led:
                driver: hk
                pin: 0
                mode: input
            ch1_led:
                driver: hk
                pin: 1
                mode: input
            ch2_led:
                driver: hk
                pin: 2
                mode: input
            ch3_led:
                driver: hk
                pin: 3
                mode: input
            ch0_button:
                driver: hk
                pin: 0
                mode: output
                switch: false
            ch1_button:
                driver: hk
                pin: 1
                mode: output
                switch: false
            ch2_button:
                driver: hk
                pin: 2
                mode: output
                switch: false
            ch3_button:
                driver: hk
                pin: 3
                mode: output
                switch: false
        view:
            table:
                - ["#Input 1", ch0_led, ch0_button]
                - ["#Input 2", ch1_led, ch1_button]
                - ["#Input 3", ch2_led, ch2_button]
                - ["#Input 4", ch3_led, ch3_button]

However, I discovered that if i take the xh_hk4401.py file from https://files.pikvm.org/repos/arch/rpi4/kvmd-4.2-1-any.pkg.tar.xz and place it in /usr/lib/python3.11/site-packages/kvmd/plugins/ugpio/xh_hk4401.py then the GPIO control in pikvm works as expected (green indicator showing currently selected input, buttons switch inputs).

I also note that the code in /usr/lib/python3.11/site-packages/kvmd/plugins/ugpio/xh_hk4401.py from the blikvm-armbian-v4-pikvm-20240504.img image, makes no mention of protocol whereas the code from kvmd-4.2-1-any.pkg.tar.xz does mention it.

Perhaps more content from kvmd-4.2-1-any.pkg.tar.xz needs to be backported as part of the patches applied by install.sh from https://github.com/srepac/kvmd-armbian.git ?