Rockbox Technical Forums

Support and General Use => User Interface and Voice => Topic started by: PMW on July 06, 2009, 01:50:01 AM

Title: Sleep Timer Sansa E200 V1
Post by: PMW on July 06, 2009, 01:50:01 AM

Is there a way for a non-programmer to add the sleep timer to the quick screen?  It currently can not be added r21682.

Is there a way to set the sleep timer on start up using the config file?  I checked the manual, it is not documented.

This link appears to have a patch that would do what I want.  It is kind of old.  Would it work with the current build?  If so, I guess it's time for me to learn how to apply a patch. http://forums.rockbox.org/index.php?topic=15518.15

I have a Sansa E260 V1 in a speaker dock.  I would like to have the player shut off automatically after I turn it on, without having to set the timer manually.



Title: Re: Sleep Timer Sansa E200 V1
Post by: JdGordon on July 06, 2009, 09:22:30 PM
no, the sleep timer cant be added to the quickscreen or regular settings without a bit of leg work... that patch might still work... only one way to find out
Title: Re: Sleep Timer Sansa E200 V1
Post by: PMW on July 07, 2009, 02:19:54 AM
I think I just found out.
Cygwin outputs this:
patching file settings_list.c
Hunk #1 FAILED at 1235
1 out of 1 hunk FAILED -- saving rejects to file settings_list.c.rej
patching file settings.h
Hunk #1 FAILED at 727
1 out of 1 hunk FAILED -- saving rejects to file settings.h.rej
patching file settings.c
Hunk #1 FAILED at 951
1 out of 1 hunk FAILED -- saving rejects to file settings.c.rej

I tried both current build and 3.0 - same results. 
I'm not sure that I did the patching right.  But I suspect the patch is no longer compatible.

I did manage to install Cygwin and assemble the current build for my E260 with no modifications.  The build  does run but it shows "unknown" instead of 21695 for the revision number.

Unfortunately the contents of the patch file don't currently mean much to me.
Oh well, maybe I learned enough to assemble and test other current patches.
 ??? ???
Title: Re: Sleep Timer Sansa E200 V1
Post by: JdGordon on July 07, 2009, 02:56:57 AM
the order in settings_list.c doesnt matter so unless a line gets changed (i dont ihnk it does) you can add the new lines anywhere in the general region...
setings.[hc] are probably just additions so add them at the end of the global_settings struct
Title: Re: Sleep Timer Sansa E200 V1
Post by: PMW on July 07, 2009, 11:06:16 PM
Success!!!
Must be my lucky day because I really don't know what the heck I'm doing.

After reading your last post, I manually inserted the lines from the patch into the source files from rockbox-21704.
I searched for text similar to that referenced in what I guess must be the patch insertion point definition.  Then I copied the lines from the patch that begin with + into those locations.

I then compiled and installed the resulting build and added "auto shutdown: 3" to the config file.  Upon reboot the sleep timer was set to 3 minutes and proceeded to countdown.  Other values also work.  I did notice that the timer goes negative before the shutdown actually occurs.  The negative timer count is not unique to my build.

If you enter "auto shutdown: 0" into the config file the sleep timer does not set on start-up but rockbox removes the line from the file.  What's up with that??

This patch does exactly what I wanted since I usually turn the E200 on at bedtime.
If I want to use it at other times it is simple enough to turn the sleep timer off after I start the player. 

It would be nice to be able to set/enable/disable the auto shutdown in the Rockbox settings menu.

I have managed a workaround by creating multiple config files.
"auto shutdown: ###" is the only line in them.  I load the config file with the amount of time I want in the sleep timer and then save the current configuration to "config.cfg" When player is restarted the sleep timer is set. 

To disable auto shutdown I load a config file that contains "auto shutdown: 0" and save the current configuration to "config.cfg" When player is restarted auto shutdown is removed from the config file and sleep timer is not set.

If I can figure out how to correct the original patch so it will apply to current code is there much of a chance of getting it committed?

Thank you very much for your help. :)
Title: Re: Sleep Timer Sansa E200 V1
Post by: JdGordon on July 08, 2009, 12:06:22 AM
0 is the default value, and if the actual value hasnt changed it doesnt bother getting written to config.cfg which is why its  not there...
you can very probably add the setting to the quickscreen.. look in the manual for how to do that.
as for having it commited... there is probabl,y going to be an arguemtn about that (and probaly already happened)... you can try emailing the dev mailing list and getting some discussion happening