Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: system ready / shutdown events
#1
Hi,

Based on CM4, I made an I/O board, which is built-in a MCU to manage the power supplies, mainly for the safe-shutdown, and then cut down the linear power to system.
Currently I am using [GPIO buttons] of System Peripherals for the shutdown event without problem.


May I know how to detect the system ready event (MoOde system booted completely) ? this event will stop flashing LED (ex. gpio 26) after system is ready.

Thank you in advance.


Attached Files Thumbnail(s)
   
Reply
#2
@franktw956 concerning the safe-shutdown you can arrange it almost with only use of overlays.

You can find more back about it on:
Reply
#3
(03-03-2023, 08:03 AM)bitlab Wrote: @franktw956 concerning the safe-shutdown you can arrange it almost with only use of overlays.

You can find more back about it on:

Thank you, bitlab, it helps for the shutdown event.
I am using the power-off cmd in GPIO button settings, and it is running good.

I just have no idea for the system-ready event, may be a log file/registers/flags...to indicate moode has booted completely already?
Reply
#4
(03-03-2023, 10:39 AM)franktw956 Wrote:
(03-03-2023, 08:03 AM)bitlab Wrote: @franktw956 concerning the safe-shutdown you can arrange it almost with only use of overlays.

You can find more back about it on:

Thank you, bitlab, it helps for the shutdown event.
I am using the power-off cmd in GPIO button settings, and it is running good.

I just have no idea for the system-ready event, may be a log file/registers/flags...to indicate moode has booted completely already?

The boot sequence has two parts: Linux startup and moOde startup. 

When Linux startup is complete it runs the system script /etc/rc.local. At the end of this script the PHP script (/var/www/daemon/worker.php) that performs moOde startup and subsequent job processing is run.

At the beginning of worker.php the SQL param 'wrkready' is set to '0'. When the startup section of worker.php completes the param is set to '1'. This signifies "moOde startup complete" which means that all daemons including MPD have been started, the WebUI can connect and all functions are available. 

Run the command below to get the value.

Code:
# Using moodeutl
moodeutl -q "select value from cfg_system where param='wrkready'"

# Using sqlite3
sqlite3 /var/local/www/db/moode-sqlite3.db "select value from cfg_system where param='wrkready'"

Also, when Menu, Shutdown, Restart or Power off is clicked the param 'wrkready' is set to '0'. This is to signal another script in moOde that it should ignore requests from the WebUI.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
@Tim Curtis
Thank you, Tim, now I know how to implement.
Reply


Forum Jump: