On Montag, 7. September 2020 17:34:19 CEST Ludwig Nussel wrote:
Stefan Brüns wrote:
[...] requesttype: 0x21 - Class specific request to interface request: 0xA - Set_Idle
value: 0xA00 - 0xA * 4ms = 40ms report interval during idle, 0x0: applies to
all reports
So according to the request, the OTG device should send report at regular intervals even without state changes, but the keyboard poll code times
out.
Maybe an interval is not supported by the gadget code, while U-Boot
requires
it. Would be interesting what a "Get_Idle" request returns.
I've added debug calls to log the return value and also enabled debug in the dwc2 controller code. Logs of the gadget as well as the ps2adapter attached.
In case of the gadget the idle call return -22. For the ps2adapter it's zero but that one still doesn't work either.
cu Ludwig
usb_kbd_probe_dev() USB KBD: set boot protocol usb_control_msg() usb_control_msg: request: 0xB, requesttype: 0x21, value 0x0 index 0x0 length 0x0 dwc2_submit_control_msg() dwc2_submit_control_msg: dev='usb@7e980000', udev=000000003db30210, udev->dev='usb_kbd', portnr=2 chunk_msg() chunk_msg: msg: pipe 80000403 pid 3 in 0 len 8 transfer_chunk() transfer_chunk: chunk: pid 3 xfer_len 8 pkts 1 PID: Setup
wait_for_chhltd() wait_for_chhltd: HCINT=00000023 sub=8 toggle=1 HCINT (*): XFER_COMPLETE | CHANNEL_HALTED | ACK
chunk_msg() chunk_msg: msg: pipe 80000403 pid 2 in 1 len 0 transfer_chunk() transfer_chunk: chunk: pid 2 xfer_len 0 pkts 1 PID: Data1 (Status stage) -> OK
wait_for_chhltd() wait_for_chhltd: HCINT=00000023 sub=0 toggle=0 usb_kbd_probe_dev() USB KBD: set boot protocol returned 0 usb_kbd_probe_dev() USB KBD: set idle interval... usb_control_msg() usb_control_msg: request: 0xA, requesttype: 0x21, value 0xA00 index 0x0 length 0x0 dwc2_submit_control_msg() dwc2_submit_control_msg: dev='usb@7e980000', udev=000000003db30210, udev->dev='usb_kbd', portnr=2 chunk_msg() chunk_msg: msg: pipe 80000403 pid 3 in 0 len 8 transfer_chunk() transfer_chunk: chunk: pid 3 xfer_len 8 pkts 1 wait_for_chhltd() wait_for_chhltd: HCINT=00000023 sub=8 toggle=1 Setup, XFER_COMPLETE | CHANNEL_HALTED | ACK
chunk_msg() chunk_msg: msg: pipe 80000403 pid 2 in 1 len 0 transfer_chunk() transfer_chunk: chunk: pid 2 xfer_len 0 pkts 1 wait_for_chhltd() wait_for_chhltd: HCINT=0000000a sub=0 toggle=2 wait_for_chhltd() wait_for_chhltd: Error (HCINT=0000000a) Status: CHANNEL_HALTED | STALL
usb_kbd_probe_dev() USB KBD: set idle 10 returned -22 U-Boot obviously ignores the failing request, and commences as it had succeeded. Though, apparently this is only relevant for Linux Gadget mode, as
USB 2.0 spec: " STALL indicates that the function cannot complete the command." the Holtek HID fails silently.
usb_kbd_probe_dev() USB KBD: enable interrupt pipe... dwc2_submit_int_msg() dwc2_submit_int_msg: dev='usb@7e980000', udev=000000003db30210 ... chunk_msg() chunk_msg: msg: pipe 40408483 pid 0 in 1 len 8 transfer_chunk() transfer_chunk: chunk: pid 0 xfer_len 8 pkts 1 wait_for_chhltd() wait_for_chhltd: HCINT=00000012 sub=8 toggle=0 Status: CHANNEL_HALTED | NACK "I really have no keyboard status change for you" ...
Timeout poll on interrupt endpoint Failed to get keyboard state from device 1d6b:0104
Kind regards, Stefan *) https://elixir.bootlin.com/u-boot/v2020.07/source/drivers/usb/host/ dwc2.h#L648 -- Stefan Brüns / Bergstraße 21 / 52062 Aachen home: +49 241 53809034 mobile: +49 151 50412019