Rockbox

Tasklist

FS#12865 - 5G iPod USB connection errors and full speed mode if hard drive is spinning when connecting

Attached to Project: Rockbox
Opened by Boris Gjenero (dreamlayers) - Friday, 24 May 2013, 17:44 GMT
Task Type Bugs
Category Drivers
Status Unconfirmed
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 0%
Votes 0
Private No

Details

With my 5th generation iPod, if I connect USB while the hard drive is spinning, I often get full speed mode instead of high speed mode. This testing is with 00b8563, but I've observed the same problem in the past. Here's the relevant part of Linux 3.8.0-21-generic dmesg output:

[26644.712035] usb 2-2: new high-speed USB device number 18 using ehci-pci
[26644.904471] usb 2-2: device descriptor read/all, error -71
[26644.965905] ehci-pci 0000:00:1d.7: port 2 reset error -110
[26644.967780] ehci-pci 0000:00:1d.7: port 2 reset error -110
[26644.968004] ehci-pci 0000:00:1d.7: port 2 reset error -110
[26644.971577] ehci-pci 0000:00:1d.7: port 2 reset error -110
[26644.973440] ehci-pci 0000:00:1d.7: port 2 reset error -110
[26644.973459] hub 2-0:1.0: hub_port_status failed (err = -32)
[26645.176048] hub 2-0:1.0: unable to enumerate USB device on port 2
[26645.428038] usb 6-2: new full-speed USB device number 8 using uhci_hcd
[26645.979070] usb 6-2: not running at top speed; connect to a high speed hub
[26646.009069] usb 6-2: New USB device found, idVendor=05ac, idProduct=1209
[26646.009076] usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[26646.009080] usb 6-2: Product: Rockbox media player
[26646.009083] usb 6-2: Manufacturer: Rockbox.org
[26646.009087] usb 6-2: SerialNumber: 100000000000A270014B32BEB
[26646.024242] scsi21 : usb-storage 6-2:1.0
[26647.038109] scsi 21:0:0:0: Direct-Access TOSHIBA MK3008GAL BU11 PQ: 0 ANSI: 4
(I've removed the remaining USB storage messages because they don't seem relevant)

If the hard drive is not spinning, I get high speed mode. However, there is a disconnect and the device is detected twice:

[27356.784126] usb 6-2: USB disconnect, device number 9
[27371.208044] usb 2-2: new high-speed USB device number 24 using ehci-pci
[27371.347053] usb 2-2: New USB device found, idVendor=05ac, idProduct=1209
[27371.347058] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[27371.347062] usb 2-2: Product: Rockbox media player
[27371.347065] usb 2-2: Manufacturer: Rockbox.org
[27371.347069] usb 2-2: SerialNumber: 100000000000A270014B32BEB
[27373.079038] scsi25 : usb-storage 2-2:1.0
[27373.337244] usb 2-2: USB disconnect, device number 24
[27373.640029] usb 2-2: new high-speed USB device number 25 using ehci-pci
[27373.779220] usb 2-2: New USB device found, idVendor=05ac, idProduct=1209
[27373.779226] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[27373.779229] usb 2-2: Product: Rockbox media player
[27373.779233] usb 2-2: Manufacturer: Rockbox.org
[27373.779236] usb 2-2: SerialNumber: 100000000000A270014B32BEB
[27373.820382] scsi26 : usb-storage 2-2:1.0
[27374.823266] scsi 26:0:0:0: Direct-Access TOSHIBA MK3008GAL BU11 PQ: 0 ANSI: 4
(Again, I've removed the remaining USB storage messages because they don't seem relevant)

I get the same behaviour regarding high speed vs. full speed mode in Windows 7, but I'm not aware of Windows reporting other USB errors anywhere.

I was sometimes having USB difficulties that seemed to be due to contact oxidization or dust from not using the dock connector in a long time, but I don't think that's the cause here.

I'm attaching USB traces from WireShark using Linux usbmon. In both cases I removed all the USB mass storage stuff after get max lun because it seems irrelevant and increases file size a lot. When the result is full speed, something goes wrong after the set address response. When the result is high speed, something goes wrong after the set configuration request. In both cases the first sign of trouble is an interrupt from the USB hub.

This is on a Gigabyte GA-P35-DS3R rev V1.0 motherboard with Intel P35 + ICH9R chipset.
This task depends upon

Comment by Boris Gjenero (dreamlayers) - Saturday, 25 May 2013, 06:01 GMT
I've narrowed this down to r30701 / 6832175, which fixed  FS#12303  by adding a usb_drv_init() call to usb_drv_attach(). Currently, the same thing is accomplished by a call to usb_drv_init() in usb_attach() in usb-fw-pp502x.c. The associated comment is "FIXME: Some iPod Video's need this 2nd call of usb_drv_init() to establish an USB connection."

The first call to usb_drv_init() happens in response to USB_INSERTED, via usb_core_init() and usb_enable(true). The second call to usb_drv_init() happens after disk_unmount_all() in usb_slave_mode(), in response to the last SYS_USB_CONNECTED_ACK. I'm assuming the disk_unmount_all() needs to access the disk, so it causes a wait until the disk spins up. The second usb_drv_init() resets the USB controller, interrupting the USB connection procedure and causing it to be restarted. The outcome depends on when it happens. At some points the a new high speed connection is formed, while other points causes a switch to full speed mode.

I am basically experiencing  FS#12324 . My iPod does not need the workaround, and the workaround is causing problems just like it did on e200v1. Commenting out that second usb_drv_init() call causes USB to work perfectly in 00b8563.

Loading...