Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fsotdld does not trigger alarm at right time after suspend #2

Open
jake42 opened this issue Apr 2, 2015 · 2 comments
Open

fsotdld does not trigger alarm at right time after suspend #2

jake42 opened this issue Apr 2, 2015 · 2 comments

Comments

@jake42
Copy link

jake42 commented Apr 2, 2015

fsotdld uses g_timeout_add_seconds() for fsotdld to wake up at the alarm
https://github.com/freesmartphone/cornucopia/blob/master/fsotdld/src/plugins/alarm/plugin.vala#L123

The interval given is in terms of monotonic time, not wall clock time. See g_get_monotonic_time().
https://developer.gnome.org/glib/2.36/glib-The-Main-Event-Loop.html#g-timeout-add-seconds

The monotonic time does not advance while in suspend. So if we set an alarm in 10min, suspend the device for 5min and keep it awake after that, the alarm will go off after 15 wall clock minutes.

This is with srv rev: 12843f0

Issue in SHR: http://shr-project.org/trac/ticket/1253

@mickeyl
Copy link
Member

mickeyl commented Apr 7, 2015

I understand the problem, but isn't programming the RTC sufficient? What would be the best way to fix this?

@jake42
Copy link
Author

jake42 commented Apr 7, 2015

Programming the RTC is not sufficient, as fsotdld needs to notify who ever programmed the alarm after the system woke from suspend e.g. org.openmoko.projects.ffalarms.atd. This does not work, because fsotdld keeps waiting for the timer to run down (in monotonic time).

Here are some thoughts of how this could be fixed:

Finding a timer running on wall clock time would certainly help, though I have no clue how realistic that is. glib seeems not to provide such function.

Another approach that comes to mind would be to notify fsotdld of every system wakeup. Then let it check for an expired timer or reset it.

Note:
In the past the monotonic time must have advanced even in suspend (more likely on resume), because it used to work in SHR and uptime accumulated even time in suspend while now it does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants