Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LED-PWR and LED-HDD Support #2

Closed
blazer221 opened this issue Jun 29, 2024 · 6 comments
Closed

LED-PWR and LED-HDD Support #2

blazer221 opened this issue Jun 29, 2024 · 6 comments

Comments

@blazer221
Copy link

Hello,
First of all great project, it seems to be working flawlessly so far. One thing i didn't find a way to make it work is showing the HDD and Power indications which are on GPIO 9 for HDD and GPIO 10 for Power according to blicube website for Allwiner device, is there a possibility this functionality to be added also?

@RainCat1998
Copy link
Owner

RainCat1998 commented Aug 27, 2024

Yes. You can do it by editing the GPIO config file(/etc/kvmd/override.d/atx.yaml). Here is an example.

kvmd:
    gpio:
        scheme:
            on-off-button:
                pin: 228
                mode: output
                switch: false
                pulse:
                    delay: 0.5
                    max_delay: 2
            force-off-button:
                pin: 228
                mode: output
                switch: false
                pulse:
                    delay: 3
                    max_delay: 5
            reset-button:
                pin: 272
                mode: output
                switch: false
                pulse:
                    delay: 0.5
                    max_delay: 2
            power-led:
                pin: 234
                mode: input
            hdd-led:
                pin: 233
                mode: input

        view:
            table:
                - []
                - ["#ATX on BliKVM hardware", "power-led|green", "hdd-led|yellow"]
                - []
                - ["on-off-button|confirm|On/Off", "force-off-button|confirm|Force Off", "reset-button|confirm|Reset"]

@RainCat1998 RainCat1998 pinned this issue Aug 27, 2024
@davidcoulson
Copy link

When I use this atx.yaml (vs the one in the README) I get the following errors when kvmd starts up.


Aug 31 15:25:05 unraid-pikvm systemd[1]: Started PiKVM - The main daemon.
░░ Subject: A start job for unit kvmd.service has finished successfully
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit kvmd.service has finished successfully.
░░
░░ The job identifier is 1377.
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.apps.kvmd                    INFO --- Using internal auth service 'htpasswd'
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg              INFO --- Using OTG gadget 'kvmd' as MSD
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg              INFO --- Probing to remount storage ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg.storage      INFO --- Remounting MSD storage to RW: /usr/bin/sudo --non-interactive /usr/bin/kvmd-helper-otgmsd-remount rw ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- Executing helper ['/usr/bin/sudo', '--non-interactive', '/usr/bin/kvmd-helper-otgmsd-remount', 'rw'] ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Remounting /var/lib/kvmd/msd to RW-mode ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Storage in the RW-mode now
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg.storage      INFO --- Remounting MSD storage to RO: /usr/bin/sudo --non-interactive /usr/bin/kvmd-helper-otgmsd-remount ro ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- Executing helper ['/usr/bin/sudo', '--non-interactive', '/usr/bin/kvmd-helper-otgmsd-remount', 'ro'] ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Remounting /var/lib/kvmd/msd to RO-mode ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Storage in the RO-mode now
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.keyboard.keysym              INFO --- Reading keyboard layout /usr/share/kvmd/keymaps/en-us ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.apps.kvmd.ugpio              INFO --- Preparing User-GPIO drivers ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: Traceback (most recent call last):
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/bin/kvmd", line 8, in <module>
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     sys.exit(main())
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/apps/kvmd/__init__.py", line 75, in main
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     KvmdServer(
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/apps/kvmd/server.py", line 263, in run
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     comp.sysprep()
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/apps/kvmd/ugpio.py", line 294, in sysprep
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     driver.prepare()
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/plugins/ugpio/gpio.py", line 89, in prepare
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     line.request("kvmd::gpio::outputs", gpiod.LINE_REQ_DIR_OUT, default_vals=[int(initial or False)])
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: OSError: [Errno 16] Device or resource busy

@RainCat1998
Copy link
Owner

When I use this atx.yaml (vs the one in the README) I get the following errors when kvmd starts up.


Aug 31 15:25:05 unraid-pikvm systemd[1]: Started PiKVM - The main daemon.
░░ Subject: A start job for unit kvmd.service has finished successfully
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit kvmd.service has finished successfully.
░░
░░ The job identifier is 1377.
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.apps.kvmd                    INFO --- Using internal auth service 'htpasswd'
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg              INFO --- Using OTG gadget 'kvmd' as MSD
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg              INFO --- Probing to remount storage ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg.storage      INFO --- Remounting MSD storage to RW: /usr/bin/sudo --non-interactive /usr/bin/kvmd-helper-otgmsd-remount rw ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- Executing helper ['/usr/bin/sudo', '--non-interactive', '/usr/bin/kvmd-helper-otgmsd-remount', 'rw'] ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Remounting /var/lib/kvmd/msd to RW-mode ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Storage in the RW-mode now
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.plugins.msd.otg.storage      INFO --- Remounting MSD storage to RO: /usr/bin/sudo --non-interactive /usr/bin/kvmd-helper-otgmsd-remount ro ...
Aug 31 15:25:08 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- Executing helper ['/usr/bin/sudo', '--non-interactive', '/usr/bin/kvmd-helper-otgmsd-remount', 'ro'] ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Remounting /var/lib/kvmd/msd to RO-mode ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.aiohelpers                   INFO --- => Storage in the RO-mode now
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.keyboard.keysym              INFO --- Reading keyboard layout /usr/share/kvmd/keymaps/en-us ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: kvmd.apps.kvmd.ugpio              INFO --- Preparing User-GPIO drivers ...
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: Traceback (most recent call last):
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/bin/kvmd", line 8, in <module>
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     sys.exit(main())
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/apps/kvmd/__init__.py", line 75, in main
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     KvmdServer(
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/apps/kvmd/server.py", line 263, in run
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     comp.sysprep()
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/apps/kvmd/ugpio.py", line 294, in sysprep
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     driver.prepare()
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:   File "/usr/lib/python3/dist-packages/kvmd/plugins/ugpio/gpio.py", line 89, in prepare
Aug 31 15:25:09 unraid-pikvm kvmd[2340]:     line.request("kvmd::gpio::outputs", gpiod.LINE_REQ_DIR_OUT, default_vals=[int(initial or False)])
Aug 31 15:25:09 unraid-pikvm kvmd[2340]: OSError: [Errno 16] Device or resource busy

Sorry, I have missed something. The blikvm_server occupied these GPIO ports. Here is the full instruction.

@RainCat1998
Copy link
Owner

RainCat1998 commented Aug 31, 2024

  1. build kvm-main with these lines commented. (blikvm/src/blikvm_server.c) https://github.com/ThomasVon2021/blikvm
//3. init atx module
        /*
        if(blikvm_atx_init() == 0)
        {
            BLILOG_D(TAG,"init atx success\n");
        }
        else
        {
            BLILOG_E(TAG,"init atx failed\n");
        }
        */

make H616=1 ST7789=1
mv ./src/kvmd-main /usr/bin/blikvm/
2. vi /etc/kvmd/override.d/atx.yaml

kvmd:
    gpio:
        scheme:
            on-off-button:
                pin: 228
                mode: output
                switch: false
                pulse:
                    delay: 0.5
                    max_delay: 2
            force-off-button:
                pin: 228
                mode: output
                switch: false
                pulse:
                    delay: 3
                    max_delay: 5
            reset-button:
                pin: 272
                mode: output
                switch: false
                pulse:
                    delay: 0.5
                    max_delay: 2
            power-led:
                pin: 234
                mode: input
            hdd-led:
                pin: 233
                mode: input

        view:
            table:
                - []
                - ["#ATX on BliKVM hardware", "power-led|green", "hdd-led|yellow"]
                - []
                - ["on-off-button|confirm|On/Off", "force-off-button|confirm|Force Off", "reset-button|confirm|Reset"]
  1. reboot

@davidcoulson
Copy link

Great - That works!!

Is there a way to update the kernel on the H616, or is there something custom that requires it to be held back?

@blazer221
Copy link
Author


Thank you @RainCat1998, the main thing i was missing was the code that needs comment in blikvm_server.c, now everything works fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants