Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

Compute Module • Re: How to read rpiboot level?

$
0
0
At least for cm5 the nrpiboot signal is internally muxed with the power button. You can disable the shutdown by creating a file /etc/systemd/logind.conf.d/disable-power-button.conf with the following contents:

Code:

[Login] HandlePowerKey=ignore
But I'm not sure if there is such a muxing in recent cm4 firmware versions. Especially because pi4/cm4 had no power button. Maybe Tim can shed some light on this.

Nicolai
ah, for that, you also have a second option, that is also closer to OP's question

Code:

root@raspberrypi:~# evtest --grabNo device specified, trying to scan all of /dev/input/event*Available devices:/dev/input/event0:      pwr_button/dev/input/event1:      vc4-hdmi-0/dev/input/event2:      vc4-hdmi-0 HDMI Jack/dev/input/event3:      vc4-hdmi-1/dev/input/event4:      vc4-hdmi-1 HDMI JackSelect the device event number [0-4]: 0Input driver version is 1.0.1Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100Input device name: "pwr_button"Supported events:  Event type 0 (EV_SYN)  Event type 1 (EV_KEY)    Event code 116 (KEY_POWER)Properties:Testing ... (interrupt to exit)
the power button is rigged up as an input device
and if you open it in grab mode, then you steal all events for it, and prevent the normal execution of actions, so you can skip the HandlePowerKey=ignore part

https://github.com/librerpi/rpi-tools/b ... #L103-L106
and here is an example of doing a grab in C, you just need to use the right device, the paths can change

Code:

root@raspberrypi:~# ls -lh /dev/input/by-path/platform-pwr_button-event lrwxrwxrwx 1 root root 9 Dec 27 22:59 /dev/input/by-path/platform-pwr_button-event -> ../event0
and there is a handy symlink you can use to solve that!

Statistics: Posted by cleverca22 — Wed Feb 12, 2025 11:26 am



Viewing all articles
Browse latest Browse all 8037

Trending Articles