[Gta04-owner] using the gta04 as an alarm clock

T. Munker t.munker at gmx.net
Fri Jul 27 13:29:38 CEST 2018


Hi,

sounds great. I have an addition
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)
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.

regards,
Thomas


Am 27. Juli 2018 09:23:21 MESZ schrieb "H. Nikolaus Schaller" <hns at goldelico.com>:
>
>> Am 27.07.2018 um 09:14 schrieb H. Nikolaus Schaller
><hns at goldelico.com>:
>> 
>> Hi,
>> 
>>> Am 26.07.2018 um 22:14 schrieb Andreas Kemnade
><andreas at kemnade.info>:
>>> 
>>> Hi,
>>> 
>>> 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
>> 
>> touch /tmp/rtcwake
>> if [ /tmp/rtcwake -nt /root/rtcwake ]
>> then # alarm time has been passed
>> 	rm /root/rtcwake
>> 	aplay alarm
>> fi
>> 
>> 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
>
>Python seems to have a library for doing that:
>
>https://stackoverflow.com/questions/4610904/calculate-next-scheduled-time-based-on-cron-spec
>
>> and make the device
>> boot 1 minute before. Then a simple
>> 
>> echo "aplay sound" | at -t time
>> schedule_rtcwake_from_crontab
>> poweroff
>> 
>> would suffice.
>> 
>> BR,
>> Nikolaus
>> 
>> 
>> 
>> _______________________________________________
>> Gta04-owner mailing list
>> Gta04-owner at goldelico.com
>> http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20180727/bcc681ed/attachment.html>


More information about the Gta04-owner mailing list