raspberrypi / tinyusb

MIT License
68 stars 18 forks source link

Infinite loop when trying Pi Pico example `host_hid` and USB dongle from Logitech K400r #4

Closed matemaciek closed 3 years ago

matemaciek commented 3 years ago

Set up [Mandatory] Provide details of your setup help us to reproduce the issue as quick as possible

Describe the bug When running unmodified example it gets stuck - led stops blinking. There is a USB dongle from Logitech K400r connected via usb-otg adapter.

After some debugging I see that execution loops in lines https://github.com/raspberrypi/tinyusb/blob/pico/src/host/usbh.c#L911-L917 :

  while( p_desc < _usbh_ctrl_buf + desc_cfg->wTotalLength )
  {
    // skip until we see interface descriptor
    if ( TUSB_DESC_INTERFACE != tu_desc_type(p_desc) )
    {
      p_desc = tu_desc_next(p_desc); // skip the descriptor, increase by the descriptor's length
    }else {...}
  }

with p_desc having constant value.

matemaciek commented 3 years ago

Log:

HID init
HUB init
USBH DEVICE ATTACH
Get 8 byte of Device Descriptor
Control Setup: 80 06 00 01 00 00 08 00
on EP 00 with 8 bytes
on EP 80 with 8 bytes
Control data:
  0000:  12 01 00 02 00 00 00 08                          |........|
on EP 00 with 0 bytes
Port reset
Set Address
Control Setup: 00 05 01 00 00 00 00 00
on EP 00 with 8 bytes
on EP 80 with 0 bytes
Control Setup: 80 06 00 01 00 00 12 00
on EP 00 with 8 bytes
on EP 80 with 8 bytes
Control data:
  0000:  12 01 00 02 00 00 00 08 00 00 00 00 00 00 00 00  |................|
  0010:  00 00                                            |..|
on EP 00 with 0 bytes
Get 9 bytes of Configuration Descriptor
Control Setup: 80 06 00 02 00 00 09 00
on EP 00 with 8 bytes
on EP 80 with 8 bytes
Control data:
  0000:  09 02 54 00 03 01 04 A0 00                       |..T......|
on EP 00 with 0 bytes
Control Setup: 80 06 00 02 00 00 54 00
on EP 00 with 8 bytes
on EP 80 with 8 bytes
Control data:
  0000:  09 02 54 00 03 01 04 A0 00 00 00 00 00 00 00 00  |..T.............|
  0010:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
  0020:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
  0030:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
  0050:  00 00 00 00                                      |....|
on EP 00 with 0 bytes
aallan commented 3 years ago

The TinyUSB port has now been merged upstream to the main repo, see https://github.com/hathach/tinyusb/pull/598 and other followup PRs. So going forward you need to report problems with the port there, https://github.com/hathach/tinyusb.