Odroid C4 power button?

Hi,
so been trying to get a power button connected AND working on my Odroid C4.
followed the guide on the Odroid wiki for this (with the exception that i have a button without a led). odroid-n2:application_note:gpio:gpio_key_wakeup [ODROID Wiki]

So connected the power button to GPIO pins 9 and 11, added to the kernel parameters gpiopower=479

cat /proc/cmdline shows the following:
root=UUID=2f2b9a9d-cf08-45b0-abfd-954ea942cea6 rootfstype=ext4 rootwait console=tty1 loglevel=4 consoleblank=0 coherent_pool=2M usb-storage.quirks= rootdelay=60 net.ifnames=0 gpiopower=479

nothing happens when pushing the button: not powering down, and when power down not powering up.
Been reading (a lot) on what might be the cause of this and there is no decisive conclusion (at least for me),

Could this be DietPi related (not loading a required process / kernel module)?

any tips / advice / etc. are appreciated :slight_smile: Thanks in advance,
Ruud.

not sure if @MichaIng has an idea on what the issue could be.

on the odroid forum where I got the instructions from it became clear that the Odroid ‘stock’ kernel has support for this build in.
So I think that DietPi lacks this and we should go the route of a dtoverlay for this.

When installing WiringPi and doing a gpio readall I see that pressing the button toggles the pin value, so that works :slight_smile:

we don’t build own kernel version. We use the one provided by underlying base image. I guess it will be Armbian in your case. But not 100% sure.

Exactly, gpiopower seems to be no regular Linux command-line parameter. You can check dmesg which at some point shows something like:

[    2.441314] Run /sbin/init as init process
[    2.441330]   with arguments:
[    2.441338]     /sbin/init
[    2.441347]   with environment:
[    2.441355]     HOME=/
[    2.441364]     TERM=linux

The parameters shown in the environment block are those which are not understood by the kernel itself. It then passes them to the init system.

There seem to be no device tree overlay included in our meson64 kernel. A generic method to communicate with GPIO in userland is libgpio. Can you check whether it works fine, detecting all pins correctly?

apt install gpiod
gpiodetect
gpioinfo

all works fine, when I do gpioinfo I see that:
line 83: "PIN_5" unused input active-high

now when I do gpiomon gpiochip0 83 with the powerbutton on GPIO pin 5 (and 9 = GND) and press the button I get the following for each button press:

event: FALLING EDGE offset: 83 timestamp: [     500.224512069]
event:  RISING EDGE offset: 83 timestamp: [     500.573694070]