FS#7341 - Fix freeze if iPod booted with USB cable connected

Attached to Project: Rockbox
Opened by Martin (MCMisenar) - Friday, 22 June 2007, 12:33 GMT
Last edited by Steve Bavin (pondlife) - Wednesday, 05 March 2008, 13:56 GMT
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System iPod 5G
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Freezes if booted with USB cable connected. Happens every time. Same effect on iPod 5G and 5.5G.
This task depends upon

Closed by  Steve Bavin (pondlife)
Wednesday, 05 March 2008, 13:56 GMT
Reason for closing:  Fixed
2008-04-29: A request to re-open the task has been made. Reason for request: The changes made to fix it in the SVN have been reverted, and the problem exists again on all the ipod videos I have access to (tried it with default configuration on at least 10)
Comment by Akio Idehara (idak) - Sunday, 24 June 2007, 00:51 GMT
I made a work around patch...
Comment by Akio Idehara (idak) - Sunday, 24 June 2007, 06:06 GMT
This is more suitable...
Comment by Akio Idehara (idak) - Tuesday, 26 June 2007, 15:58 GMT
This patch changes usb_start_monitoring() call in init().
This works fine for my ipod 5g.
Comment by Martin (MCMisenar) - Tuesday, 26 June 2007, 16:26 GMT
Shall try these out tonight when I get off work and will let you know how it works.

Thanks for the speedy response! Very impressive work and much appreciated.

Comment by Martin (MCMisenar) - Wednesday, 27 June 2007, 23:14 GMT
Worked like a charm :) Thanks a million!
Comment by Tom Ross (midgey34) - Monday, 30 July 2007, 22:39 GMT
Can you see if this is reproducible in SVN? I tested on a 5G (32 MB) with USB attached to the computer and then a wall charger. Throughout my tests, I never experienced a freeze. One time the iPod failed to reboot into diskmode, but I was not able to reproduce that again.
Comment by Martin (MCMisenar) - Tuesday, 31 July 2007, 00:43 GMT
Yes, it's still reproducable in the latest SVN (as of 8:42pm 7/30/2007). However, the patch provided by Akil Idehara (usb-debug4.patch) has been working perfectly for me since it was submitted.
Comment by Martin (MCMisenar) - Tuesday, 31 July 2007, 00:44 GMT
I'm using a 32mb 5G 30gb, the problem occurs reliably anytime the usb cable is attached while the ipod is either off or booting (if attached before the menu displays). I have tried removing all settings and plugins, with no effect.
Comment by Akio Idehara (idak) - Tuesday, 31 July 2007, 14:17 GMT
This problem still occur in svn Version: r14102-070731

Please apply this config.cfg file.

That config file enable dir cache and use Unifont.fnt.
I think that loading large size font and initializing dir cache entry
have a lot of time and this is caused this problem.

And this problem DOES NOT occur with wall charger.
Comment by Akio Idehara (idak) - Tuesday, 04 September 2007, 15:16 GMT
I thought that between usb_start_monitoring() and usb_detect() was very short time.
And within init(), usb_detect() never returns USB_INSERTED if usb was inserted or not.

So I added sleep() before usb_detect().
Comment by Martin (MCMisenar) - Tuesday, 04 September 2007, 15:42 GMT
OK. I've been using the previously attached usb-debug4.patch since it was made available here, and has worked perfectly for me. I just tried the latest build without any patches, and the probem definitely still exists. I also just tried the recently-added usb-debug5.patch, which seems to also work quite nicely.
Comment by Martin (MCMisenar) - Wednesday, 05 September 2007, 18:55 GMT
After a day of using my ipod 5g (30gb) with this usb-debug5.patch, It has exhibited the same problem 3x when booted with the usb cable attached. Rebuilt with the latest svn and the usb-debug4.patch, and it works fine again.
Comment by Mark (Xebozone) - Friday, 07 September 2007, 16:23 GMT
Can we possibly get this to the SVN?
It's been bugging me for some time now...
Comment by Mark (Xebozone) - Friday, 07 September 2007, 16:23 GMT
Perhaps submit to "patch" section?
Comment by Akio Idehara (idak) - Tuesday, 11 September 2007, 14:04 GMT
I think these patches are very ugly.
So nobody will apply one of these patches to svn.
Comment by Martin (MCMisenar) - Tuesday, 11 September 2007, 16:31 GMT
Be that as it may, they work, and nobody with svn access seems to have offered a better solution.
Comment by Mark (Xebozone) - Saturday, 29 September 2007, 08:57 GMT
Today, I filed a new Flyspray about this ( FS#7863 ), forgetting that I posted on this one ages ago!

It was closed as they thought it was to do with the iPod Linux loader, not the rockbox loader, but here we go :)

We need to get this in the SVN!
Comment by Dominik Riebeling (bluebrother) - Saturday, 29 September 2007, 09:57 GMT
I _knew_  FS#7863  was a duplicate :) Nevertheless, the tracker guidelines _require_ you to only use official software and reporting against a system using IPL's Loader2 is not official. Especially in this case, as Loader2 might initialize things differently to the Rockbox bootloader which in turn _could_ cause issues.
Comment by Mark (Xebozone) - Saturday, 29 September 2007, 10:06 GMT
Yeah, fair enough reason. I actually typed out a reply to  FS#7863 ...but you closed it as I hit submit, so it didn't go through :P

But, as you can see, the problem does exist, and there is a solution here!
Why isn't this in the SVN yet?

There are many good improvements and patches here that haven't been committed or have little work remaining to be up to standard (I was just reading through the "Open Patches in Rockbox" mail)

Comment by Mark (Xebozone) - Saturday, 29 September 2007, 10:09 GMT
It may be ugly...but it works. Commit it to the SVN with a note that it still needs cleaning up.

It's better to have a solution than to leave the bug there and frustrate users
Comment by Akio Idehara (idak) - Saturday, 29 September 2007, 11:13 GMT
I always use latest rockbox bootloader and this problem is still occur in r14901.
I think this problem is independent of the bootloader....
Comment by Mark (Xebozone) - Saturday, 29 September 2007, 11:18 GMT
That's because this patch hasn't been committed yet to the SVN. As soon as it is, it shouldn't be a problem
Comment by Akio Idehara (idak) - Wednesday, 05 March 2008, 12:16 GMT
This problem was finally fixed in r16435...