Rockbox

Tasklist

FS#2720 - bookmark on idle poweroff and sleep poweroff

Attached to Project: Rockbox
Opened by Markus (berndtnm) - Monday, 17 October 2005, 21:26 GMT
Last edited by Torne Wuff (torne) - Sunday, 28 March 2010, 23:29 GMT
Task Type Patches
Category Settings
Status Closed
Assigned To No-one
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

This patch adds a few lines of code to powermgmt.c to
modify handle_auto_poweroff.

Before actually shutting down because of idle powerdown
or sleep timer, fake the pressing of the stop button,
if the user has chosen the setting YES for auto create
bookmark. This causes a bookmark to be written before
the player powers down.

I find this behavior desirable, because I often listen
to audio books. When I press pause, and wait too long
the player powers down and the only way to get to the
place where the book stopped, is to resume. If I forget
to resume the location where I stopped listening to the
book is lost. This patch fixes this problem.
This task depends upon

Closed by  Torne Wuff (torne)
Sunday, 28 March 2010, 23:29 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed by some other past commit :)
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 20 October 2005, 08:29 GMT

That is definitely not the way to do it.

The sys_poweroff() event ends up in the clean_shutdown()
function in misc.c, and you should add a
bookmark_autobookmark() call there, or in the system_flush()
function. However, it should only be done if it is an
automatic shutdown, and if the music is paused. That will
require some extra hacking in the sys_poweroff() function so
it can distinguish between manual and automatic poweroff.

Comment by Markus (berndtnm) - Thursday, 20 October 2005, 17:24 GMT

I agree that my original patch was exceedingly ugly... but
it worked. Anyway, I followed Linus' instructions and creted
another patch that modifies clean_shutdown in apps/misc.c.
The rationale of this patch is that if clean_shutdown is
called and audio_status() has the AUDIO_STATUS_PLAY bit set,
this could only have happened in the case of an idle
poweroff or sleep timer poweroff, so a bookmark is created
if the global setting for autocreatebookmark is BOOKMARK_YES
(in the other cases, user interaction is required, which is
not desirable in the case of idle poweroff or sleep timer
poweroff).

To make the behavor of idle poweroff and sleep timer
poweroff consistent, I had to modify firmware/powermgmt.c,
such that there is not audio_stop() call before the sleep
timer shuts down the player. I moved the this call so that
now only occurs if the player is plugged in. I think, this
is more consistent with the way the player is shut down due
to an idle poweroff.

This patch obviously does not give clean_shutdown the
ability to explicitly distinguish between auto poweroff and
manual poweroff. This information is implicitly given by the
fact that we somehow ended up in clean_shutdown and the
player is still playing.

- M
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 20 October 2005, 17:38 GMT

There are cases when the music might be playing on a manual
poweroff, like when you leave the WPS with the music paused
or playing.

On the other hand, you still want to save a bookmark in
those cases, so I guess this would work. I'll have a look at
your patch soonish.
Comment by Peter D'Hoye (petur) - Thursday, 02 August 2007, 19:59 GMT
LinusN?
Comment by Ryan Melena (iolaus) - Monday, 08 February 2010, 17:18 GMT
This would be a very useful feature for those of us that listen to audiobooks in the car.
Comment by Marcus Lowe (skyfish) - Wednesday, 10 February 2010, 01:42 GMT
Could someone please be so kind to sync with svn?
Comment by Marcus Lowe (skyfish) - Sunday, 14 February 2010, 16:34 GMT
Oh, god. It IS on svn, it seems I've reopened an accepted task.
Sorry, it's the lack of sleep.
Comment by Václav Brožík (pabouk) - Tuesday, 16 February 2010, 17:50 GMT
Marcus, when it was committed? I still do not get bookmark when my paused player turns off automatically.
Comment by Torne Wuff (torne) - Sunday, 28 March 2010, 22:48 GMT
This patch wasn't committed, but a different change was made which does indeed make bookmarks get saved on poweroff. I tested by setting bookmark on stop to yes, and idle poweroff to one minute. On playing something, then pausing and leaving the player alone, it shuts down and during shutdown the "Bookmark Saved" splash appears, and when the player is turned back on the bookmark is there.

However, if you have bookmark on stop set to "ask" it appears to screw everything up: it prompts you, but if you don't answer the prompt the player powers off anyway, seemingly without completing the rest of the tasks in the clean shutdown procedure!

The patch above doesn't save a bookmark in this situation; does anyone have an opinion on whether it should work that way?
Comment by Torne Wuff (torne) - Sunday, 28 March 2010, 23:29 GMT
OK, I've fixed that in r25376 - if you have it set to "ask" it will just assume you don't want one on idle poweroff. I'm going to close this again, as from my testing it now works as desired.

Loading...