Helios64: Added Scheduled Power ON using RTC

This commit is contained in:
Aditya Prayoga 2020-10-24 15:25:51 +07:00
parent 329c53fa36
commit 8fc1f37f52

View file

@ -14,3 +14,72 @@ To save time information and allow the RTC to keep running while system is power
!!! Note !!! Note
The polarity of the battery holder is indicated on the PCB with **'+'** signs. The polarity of the battery holder is indicated on the PCB with **'+'** signs.
## Scheduled Power On using RTC
User can set up a scheduled power on using RTC alarm.
### Use SYSFS
Run following command to check whether there is any alarm set,
```bash
cat /sys/class/rtc/rtc0/wakealarm
```
If nothing return, it means no alarm set.
To reset/disable the alarm, run
```bash
echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
```
The alarm only accept Unix epoch time. We can use *[date](https://linux.die.net/man/1/date)* utility as helper to get epoch time of our calendar.
To set alarm from absolute calendar time, run
```bash
echo `date '+%s' -d '20 December 2020 02:14:10 PM'` | sudo tee /sys/class/rtc/rtc0/wakealarm
```
You can also set alarm from relative time using this command,
```bash
echo `date '+%s' -d '+ 1 hour 2 minutes 10 seconds'` | sudo tee /sys/class/rtc/rtc0/wakealarm
```
After alarm set, you can power off the system and keep the power plugged in. Helios64 should automatically power on at the scheduled time.
### Use rtcwake
Run following command to check whether there is any alarm set,
```bash
sudo rtcwake -m show
```
To reset/disable the alarm, run
```bash
sudo rtcwake -m disable
```
To set alarm from absolute calendar time, run
```bash
sudo rtcwake -m off --date '2020-12-20 14:14:10'
```
You can also set alarm from relative time using this command,
```bash
sudo rtcwake -m off --date '+ 1 hour 2 minutes 10 seconds'
```
After the command successfully executed, system will shutdown. Keep the power plugged in and Helios64 should autommatically power on at the scheduled time.
## References
[date- Linux manual page](https://linux.die.net/man/1/date)
[rtcwake - Linux manual page](https://linux.die.net/man/8/rtcwake)