Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#2720 - bookmark on idle poweroff and sleep poweroff

Attached to Project: Rockbox
Opened by Markus (berndtnm) - Monday, 17 October 2005, 23:26 GMT+1
Last edited by Björn Stenberg (zagor) - Tuesday, 28 August 2007, 10:48 GMT+1
Task Type Patches
Category Settings
Status New   Reopened
Assigned To No-one
Player Type
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
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.
   bookmark-idle-sleep.diff (1.1 KiB)
 powermgmt.c |    5 +++++
 1 file changed, 5 insertions(+)

   bookmark-idle-sleep-v2.diff (1.8 KiB)
 apps/misc.c          |    5 +++++
 firmware/powermgmt.c |    3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

This task depends upon

Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 20 October 2005, 10:29 GMT+1

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, 19:24 GMT+1

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, 19:38 GMT+1

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, 21:59 GMT+1
LinusN?

Loading...