Skip to content

Reset hub port on enumeration failure #3000

@tannewt

Description

@tannewt

Operating System

Linux

Board

Fruit Jam

Firmware

CircuitPython with PICO PIO USB Host

What happened ?

Device fails to enumerate.

How to reproduce ?

Enumerate a thrustmaster joystick full speed device connected through a ch334 hub. Also seen with an 8bitdo controller.

When setting the device address the device correctly sees the pack and acks. However if the host doesn't read the ack correctly, the transfer fails and is retried. It perpetually fails because the device is now at the assigned address, not 0.

So, when retrying enumeration we should also issue a reset on the port to reset the device.

This may be related to #2163. We should also check the hub status during enumeration in case the device tries to reset.

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

Set Address = 1
[1:0] Set Address: 00 05 01 00 00 00 00 00 
 on EP 00 with 8 bytes: OK
REPL to disable.
code.py output:
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 2/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 3/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED, xferred_bytes = 0
00 05 01 00 00 00 00 00 

Enumeration attempt 1
[1:0] Set Address: 00 05 01 00 00 00 00 00 
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 1/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 2/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 3/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED, xferred_bytes = 0
00 05 01 00 00 00 00 00 

Enumeration attempt 2
[1:0] Set Address: 00 05 01 00 00 00 00 00 
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 1/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 2/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 3/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED, xferred_bytes = 0
00 05 01 00 00 00 00 00 

Enumeration attempt 3
[1:0] Set Address: 00 05 01 00 00 00 00 00 
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 1/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 2/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED 3/3, retrying
on EP 00 with 0 bytes: FAILED
[1:0] Control FAILED, xferred_bytes = 0
00 05 01 00 00 00 00 00 

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions