Skip to content

Graceful failure when running out of HID interfaces #2996

@tannewt

Description

@tannewt

Operating System

Linux

Board

Fruit Jam

Firmware

CircuitPython using enhance-hub branch.

What happened ?

An assert is hit. Code would crash without it due to a null pointer.

How to reproduce ?

Plug in more HID devices than TinyUSB is configured for. It tries to open all of the HID interfaces found. If it tries to open more than it's been configured for, then it hits an assert. Instead, it should fail to open the device using the HID driver but still make it available for raw access.

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

I added Not enough interfaces, increase CFG_TUH_HID:

[11:37:27.481] Device configured
[11:37:27.481] Parsing Configuration descriptor (wTotalLength = 59)
[11:37:27.481] [2] HID opening Interface 0
[11:37:27.503]   Open EP 82 with Size = 8
[11:37:27.503]   HID opened
[11:37:27.503]   Bind EP 82 to driver id 0
[11:37:27.503] [2] HID opening Interface 1
[11:37:27.503] [2] Not enough interfaces, increase CFG_TUH_HID
[11:37:27.503] [1:2] Interface 1: class = 3 subclass = 1 protocol = 1 is not supported
[11:37:27.504] HID set config: itf = 0
[11:37:27.526] HID Set Idle 
[11:37:27.526] [1:2] Class Request: 21 0A 00 00 00 00 00 00 
[11:37:27.526] on EP 00 with 8 bytes: OK
[11:37:27.526] on EP 80 with 0 bytes: OK

[11:37:27.526] HID Set Protocol = 0
[11:37:27.526] [1:2] Class Request: 21 0B 00 00 00 00 00 00 
[11:37:27.526] on EP 00 with 8 bytes: OK
[11:37:27.526] on EP 80 with 0 bytes: OK

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