<html><head></head><body>Hi,<br>
<br>
sounds great. I have an addition<br>
Assuming there is already some Alarn application running (as you propose cron), there should be a check of it in the shutdown scripts. When the alarm is set, then an rtc call would only have to ensure that the phone is running before that and the rest will do the alarm software by itself (which has to be active right after system boot)<br>
So a user of the alarm application will not notice that there was something special about turning off the phone. There should be a user interface defined for that shutdown script. I like the idea, of a file which has the timestamps at which point(s) in future the device should be up.<br>
<br>
regards,<br>
Thomas<br>
<br><br><div class="gmail_quote">Am 27. Juli 2018 09:23:21 MESZ schrieb "H. Nikolaus Schaller" <hns@goldelico.com>:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Am 27.07.2018 um 09:14 schrieb H. Nikolaus Schaller <hns@goldelico.com>:<br /> <br /> Hi,<br /> <br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> Am 26.07.2018 um 22:14 schrieb Andreas Kemnade <andreas@kemnade.info>:<br /> <br /> Hi,<br /> <br /> I just stumbled upon the fact that the device can be started by rtc<br /> alarm. So you can use it as an alarm clock without having the suspend<br /> current. So<br /> 1. turn off modem<br /> 2. rtcwake -m off -s seconds | -t time_t<br /> <br /> And then you have to make sure that the device starts an alarm after<br /> boot in that case. I do not know yet how to check that it was powered on<br /> by rtc.<br /></blockquote> <br /> Interesting idea! I did know the rtcwake command only for measuring<br /> suspend current but I wasn't aware that it also works for power-off/on.<br /> <br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> Maybe set file as a kind of flag before shutdown and then if present,<br /> remove it and start the alarm.<br /></blockquote> <br /> Yes, it is probably not possible to query the twl4030 through MLO/U-Boot/kernel<br /> boot to find out if it was started by button or event.<br /> <br /> So this should be solved in user-space.<br /> <br /> Maybe the best thing is to store the wakeup time in some file and check<br /> if it was passed. I.e. no alarm if you manually turn on before.<br /> <br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> Of course you should have a login with password, so you will not just<br /> turn off the alarm.<br /></blockquote> <br /> We should probably put that into some script running during init/boot.<br /> <br /> Maybe we can simply set the modification time of some file to the future<br /> alarm time and then do a simple<br /> <br /> touch /tmp/rtcwake<br /> if [ /tmp/rtcwake -nt /root/rtcwake ]<br /> then # alarm time has been passed<br />  rm /root/rtcwake<br />  aplay alarm<br /> fi<br /> <br /> and triggering the alarm is like:<br /> <br /> /root/wwan-off || exit 1<br /> touch -t [[CC]YY]MMDDhhmm[.SS]] /root/rtcwake<br /> rtcwake -m off -t time<br /> <br /> <br /> Another option would be to mix this with cron, i.e. find out<br /> when the next cron event is to be scheduled<br /></blockquote><br />Python seems to have a library for doing that:<br /><br /><a href="https://stackoverflow.com/questions/4610904/calculate-next-scheduled-time-based-on-cron-spec">https://stackoverflow.com/questions/4610904/calculate-next-scheduled-time-based-on-cron-spec</a><br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> and make the device<br /> boot 1 minute before. Then a simple<br /> <br /> echo "aplay sound" | at -t time<br /> schedule_rtcwake_from_crontab<br /> poweroff<br /> <br /> would suffice.<br /> <br /> BR,<br /> Nikolaus<br /> <br /> <br /> <br /><hr /><br /> Gta04-owner mailing list<br /> Gta04-owner@goldelico.com<br /> <a href="http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner">http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner</a><br /></blockquote><br /></pre></blockquote></div></body></html>