Skip to content

tud_hid_set_protocol_cb() is not called when SET_PROTOCOL is sent #1129

@dhalbert

Description

@dhalbert

Operating System

Others

Board

Adafruit MacroPad RP2040

Firmware

circuitpython (post 7.0.0, PR under development) using TinyUSB commit 43aac70

I'm testing this in the BIOS screen on a Dell Latitude E4310, which requires a boot keyboard,, and sends a SET_PROTOCOL. Interestingly, some later Dell BIOS'es no longer require a boot keyboard. I also see this problem on an older MSI motherboard.

What happened ?

I'm implementing boot protocol support in CircuitPython. I set up an HID interface descriptor specifying boot protocol, using the keyboard (device 1), and a keyboard HID report descriptor with no report ID (for failover).

CircuitPython never sees a call to its tud_hid_set_protocol_cb(), to confirm that the host wants to switch to boot protocol. I instrumented the calling routine.

I also instrumented hidd_control_xfer_cb(), which is supposed to call tud_hid_set_protocol_cb(). This routine is never entered, which seems odd. I do see hidd_control_xfer_cb() entered when the same setup is just plugged into Linux, when that the host doesn't ask for boot protocol. So I think my instrumentation is OK.

(The instrumentation consists of setting a float global to various values so I can see which pieces of code were entered. print the value out at various places in my CircuitPython test program, and can see the printouts on the MacroPad display. I. I am hijacking microcontroller.cpu.temperature to get the value: it returns the global instead of the temperature.)

How to reproduce ?

The setup of this is complicated, but I can help you get it set up if necessary. I think this should be testable with your examples/hid_boot_interface. Right now that example does nothing in the callback, but it could be changed to do something (or you could set a breakpoint there).

The trick is to find an old-enough machine whose BIOS wants a boot keyboard.

Debug Log

Here is a Beagle .tdc trace of the USB traffic. I wait five seconds at the beginning of the program to allow plenty of
time for enumeration:
macropad1.tdc.zip

For comparison, here is a conventional Dell keyboard responding to the SET_PROTOCOL request:
dell1.tdc.zip

Screenshots

Macropad: I think the "Set Configuration" is the start of the SET_PROTOCOL transaction, and the 21 0B is the actual SET_PROTOCOL message. Note the repeated Control Transfer stalls after it.
image

In comparison, here's the Dell example, which seems to work smoothly:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions