Rockbox Technical Forums

Rockbox General => Rockbox General Discussion => Topic started by: rossheth on August 11, 2008, 04:27:21 PM

Title: IPod constantly power cycles while charging
Post by: rossheth on August 11, 2008, 04:27:21 PM
I have a 4GB 1st gen ipod nano running rockbox r18244. When I connect my ipod to a wall adaptor, it constantly power cycles as the idle timeout kicks in, then restarts because of the inserted power connector. Is it possible to stop this happening without booting into the original firmware (which clutters up the ipod's root directory)?
Title: Re: IPod constantly power cycles while charging
Post by: MarcGuay on August 11, 2008, 04:32:28 PM
Here's some reading material:

http://www.rockbox.org/tracker/task/6465
Title: Re: IPod constantly power cycles while charging
Post by: rossheth on August 11, 2008, 04:37:19 PM
Well, at least it's a known issue, not just dodgy hardware on my end. On the other hand, I notice that this bug has been listed since 2007. I suppose it isn't that serious. I could just turn off idle poweroff while charging. And then try to remember to turn it back on :-/.
Title: Re: IPod constantly power cycles while charging
Post by: MarcGuay on August 11, 2008, 04:47:12 PM
Other options include fixing it yourself and bringing it to the attention of someone who can.  The logic is simple enough:  If the player is charging, don't idle timeout.   Which says nothing about how complicated it may be to actually fix it, o' course.
Title: Re: IPod constantly power cycles while charging
Post by: rossheth on August 11, 2008, 05:04:59 PM
I note that powermgmt.c contains the following code
Code: [Select]
/*
 * We shut off in the following cases:
 * 1) The unit is idle, not playing music
 * 2) The unit is playing music, but is paused
 * 3) The battery level has reached shutdown limit
 *
 * We do not shut off in the following cases:
 * 1) The USB is connected
 * 2) The charger is connected
 * 3) We are recording, or recording with pause
 * 4) The radio is playing
 */
static void handle_auto_poweroff(void)
{
    long timeout = poweroff_timeout*60*HZ;
    int  audio_stat = audio_status();

#if CONFIG_CHARGING
    /*
     * Inhibit shutdown as long as the charger is plugged in.  If it is
     * unplugged, wait for a timeout period and then shut down.
     */
    if(charger_input_state == CHARGER || audio_stat == AUDIO_STATUS_PLAY) {
        last_event_tick = current_tick;
    }
#endif
Since the correct behaviour is apparently already coded in, I assume the problem is that charger_input_state is not being set properly by the wall charger. Any idea why that might be?

EDIT 2215 11/08/08: Does anyone know where CONFIG_CHARGING is defined? It doesn't seem to be in either power.h or powermgmt.h.
Title: Re: IPod constantly power cycles while charging
Post by: MarcGuay on August 11, 2008, 05:48:38 PM
#CONFIG_CHARGING and similar #ALL_CAPS variables are target-specific commands directed at the compiler.  Take a look in the target/export/config-XXXX.c file that corresponds to your machine and you should see whether or not it has it defined, and if so, what it is defined as.  Enjoy the headache that will surely develop as you try to trace that back to your current position.  :)