Hi,

> Am 26.07.2018 um 22:14 schrieb Andreas Kemnade <andr...@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 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



Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
Gta04-owner mailing list
Gta04-owner@goldelico.com
http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner

Reply via email to