[Gta04-owner] using the gta04 as an alarm clock
H. Nikolaus Schaller
hns at goldelico.com
Fri Jul 27 09:14:20 CEST 2018
> Am 26.07.2018 um 22:14 schrieb Andreas Kemnade <andreas at kemnade.info>:
> I just stumbled upon the fact that the device can be started by rtc
> alarm. So you can use it as an alarm clock without having the suspend
> current. So
> 1. turn off modem
> 2. rtcwake -m off -s seconds | -t time_t
> And then you have to make sure that the device starts an alarm after
> boot in that case. I do not know yet how to check that it was powered on
> by rtc.
Interesting idea! I did know the rtcwake command only for measuring
suspend current but I wasn't aware that it also works for power-off/on.
> Maybe set file as a kind of flag before shutdown and then if present,
> remove it and start the alarm.
Yes, it is probably not possible to query the twl4030 through MLO/U-Boot/kernel
boot to find out if it was started by button or event.
So this should be solved in user-space.
Maybe the best thing is to store the wakeup time in some file and check
if it was passed. I.e. no alarm if you manually turn on before.
> Of course you should have a login with password, so you will not just
> turn off the alarm.
We should probably put that into some script running during init/boot.
Maybe we can simply set the modification time of some file to the future
alarm time and then do a simple
if [ /tmp/rtcwake -nt /root/rtcwake ]
then # alarm time has been passed
and triggering the alarm is like:
/root/wwan-off || exit 1
touch -t [[CC]YY]MMDDhhmm[.SS]] /root/rtcwake
rtcwake -m off -t time
Another option would be to mix this with cron, i.e. find out
when the next cron event is to be scheduled and make the device
boot 1 minute before. Then a simple
echo "aplay sound" | at -t time
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
More information about the Gta04-owner