FS#10894 - iPod Nano 2G USB Issues

Attached to Project: Rockbox
Opened by Franz-Josef Haider (liar) - Monday, 04 January 2010, 23:42 GMT
Last edited by Andree Buschmann (Buschel) - Sunday, 13 February 2011, 22:31 GMT
Task Type Bugs
Category Drivers
Status Closed
Assigned To No-one
Operating System iPod Nano 2G
Severity Low
Priority Normal
Reported Version Release 3.4
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


the nano2g usb driver in rockbox contains many bugs.

those do not happen on all nano2gs(they all behave very different):

1.1. if the usb cable is connected during boot the ipod freezes(backlight thread still works).

commenting out while (GRSTCTL & 1); in firmware/target/arm/usb-s3c6400x.c in usb_reset does not freeze the nano2g during boot(but 1.2. still happens on some players). the ipod needs to be reset by pressing menu+select.

1.2. the ipod freezes after the usb cable gets connected(after some seconds). but its a very "hard" freeze. nothing does work, backlight thread and everything do not work anymore. even interrupts are not triggered anymore. the ipod needs to be reset by menu+select

commenting out usb_drv_recv and usb_drv_send in request_handler_interface_standard in firmware/usbstack/usb_core.c after case USB_REQ_GET_STATUS makes it working again.
BUT thats a VERY UGLY and strange HACK

2. some ipods show panc stkov usb. even if we increase the usb stack size by 8kB they still panic.
This task depends upon

Closed by  Andree Buschmann (Buschel)
Sunday, 13 February 2011, 22:31 GMT
Reason for closing:  Fixed
Additional comments about closing:  Was reported to work fine with svn (r29299).
Comment by Franz-Josef Haider (liar) - Tuesday, 05 January 2010, 21:11 GMT
1.2 happens when the driver sends data with content 0. (response_data[0]=0;)
i am not sure if that happens with every message where response_data[0]=0. i need to check that
Comment by Franz-Josef Haider (liar) - Wednesday, 06 January 2010, 18:14 GMT
1.2 may also have to do with calls like:
if i comment out those messages rockbox does not freeze(but that may also be a side effect).

i think it is only coincidence that it fails after the message with length==2(i've seen only one with length==2).
it seems the interrupts are already blocked before the message with length==2 is sent.
Comment by Franz-Josef Haider (liar) - Tuesday, 12 January 2010, 00:11 GMT
this patch fixes 1.2(the usb chip wrote to a NULL pointer. that could have caused many other problems too).
it may even fix 2. but that needs testing.

there is a typo in the current svn which is fixed too(DIEPTSIZ instead of DOEPTSIZ in: ep_recv)
Comment by Franz-Josef Haider (liar) - Tuesday, 12 January 2010, 23:13 GMT
this was not enough. sometimes this message appears in dmesg:
usb 1-3: ctrl urb status -75 received
and some messages afterwards the driver fails => many descriptor read errors in dmesg.

this did not happen on a windows computer, but i've only tried it 3 times there.

this patch may be a fix to this(wait before sending/recieving new data if the endpoint is busy) but it needs testing.
Comment by Franz-Josef Haider (liar) - Tuesday, 12 January 2010, 23:14 GMT
sorry forgot to add the patch
Comment by Franz-Josef Haider (liar) - Tuesday, 12 January 2010, 23:16 GMT
the previous one included some code comments which are unnecessary.
Comment by Tim (timn) - Sunday, 24 January 2010, 17:32 GMT
I've applied the patch and was able to copy files from and to the iPod while having Rockbox started. After rebooting, though, the boot loader did not show up anymore. After connecting it with my computer, fdisk claimed that the partition table isn't valid.

Is this problem related to that patch? I had been using rockbox-svn with it as well as the NAND patch (from successfully without any data corruption so far. I'm wondering why this happened so sudden now.
Comment by Franz-Josef Haider (liar) - Monday, 25 January 2010, 22:04 GMT
rebased to the current svn.
Comment by Michael Sparmann (TheSeven) - Thursday, 11 March 2010, 03:02 GMT
What's that status of this?