This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#2720 - bookmark on idle poweroff and sleep poweroff
Attached to Project:
Rockbox
Opened by Markus (berndtnm) - Monday, 17 October 2005, 23:26 GMT+2
Last edited by Torne Wuff (torne) - Monday, 29 March 2010, 01:29 GMT+2
Opened by Markus (berndtnm) - Monday, 17 October 2005, 23:26 GMT+2
Last edited by Torne Wuff (torne) - Monday, 29 March 2010, 01:29 GMT+2
|
DetailsThis 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)
Monday, 29 March 2010, 01:29 GMT+2
Reason for closing: Fixed
Additional comments about closing: Fixed by some other past commit :)
Monday, 29 March 2010, 01:29 GMT+2
Reason for closing: Fixed
Additional comments about closing: Fixed by some other past commit :)
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.
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
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.
Sorry, it's the lack of sleep.
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?