FS#9900 - Update for FS#6465 on 3G ipod

Attached to Project: Rockbox
Opened by Rick Sayre (whorfin) - Thursday, 12 February 2009, 21:21 GMT
Last edited by Nils Wallménius (nls) - Sunday, 15 February 2009, 08:51 GMT
Task Type Bugs
Category Battery/Charging
Status Closed
Assigned To No-one
Operating System iPod 3G
Severity Low
Priority Normal
Reported Version Version 3.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This relates to  FS#6465  [sorry, i couldn't figure out how to reopen
that task, and did attempt to contact jdgordon first].

 FS#6465  was closed with this note:
this should be fixed for all targets except the 3rd gen ipod which doesnt
have usb detection code.

I think this is a slight mis-statement of the issue. The 3G ipod
can't charge over USB [and thus wouldn't have usb detection
code] but it CAN charge over Firewire, and it seems that
firewire charge detection should serve the same purpose on
this platform?

I definitely have the  FS#6465  problem with a 3G ipod:
if one has "idle poweroff" set, the rockbox goes into an infinite loop.

I noticed that when running ipod firmware [ie running the apple version], ipod goes into a "charging..."
screen when in the dock with power if you try to "shut down" [long play], and will turn the screen entirely off if you remove it from the dock in that mode. The screen stays off until you press a button, then it wakes up instantly. So presumably this ipod can't be really shut down while in the dock and with power, but rockbox could/should treat it just as it treats USB charging, ie never idle, and displays charging lighting bolt.

In rockbox, you get the infinite loop idle poweroff behavior. Similarly,
if you attempt to shut down in rockbox [very long play button holding],
it shuts down, then immediately reboots.

Further, in rockbox, I never get a "charging" indication.

So. It seems rockbox assumes that the only way to charge is via USB, which isn't the case with 3G ipods, which can in fact only charge via Firewire.

I don't know if this is a similar problem for other ipods when charging
via firewire instead of USB.

It does seem that rockbox could "know" enough to fix this.
Which I base on the following three observations; in all cases,
"in dock" means "in dock with power applied via firewire charging

1) in the ipod diagnostic mode, when running "A2D", the "ACC2" status changes from 00FF [not in dock] to 00D8 [in dock]

2) in the ipod diagnostic mode, when running "CHG STS"
the "FW" status changes from 1 [not in dock] to 0 [in dock]. "USB"
stays at 0 [though probably changes if USB is actually connected through the dock; didn't check]

3) In rockbox's Debug menu under io ports, "GPIO_C" changes from
F7 [undocked] to E7 [docked].

Hopefully this is helpful and we can fix this behavior.
[this was also a problem in 3.0]
This task depends upon

Closed by  Nils Wallménius (nls)
Sunday, 15 February 2009, 08:51 GMT
Reason for closing:  Fixed
Additional comments about closing:  Boris' fix was committed, thanks!
Comment by Boris Gjenero (dreamlayers) - Saturday, 14 February 2009, 06:29 GMT
I don't have a 3G iPod but the GPIO_C observation may be enough. Here is a simple patch. Make sure it works both when the battery is charging and when it is fully charged.
Comment by Rick Sayre (whorfin) - Sunday, 15 February 2009, 00:01 GMT

I applied this patch against 3.1 [r19569], and this does exactly the right thing!
Power is detected, both when charging and when charged, and thus shutdown
is precluded [either forced or via idle timeout] and the bad behavior avoided.

I don't have the ability to test other platforms, but the patch looks safe.