drivers/usbhost: Report which xHCI command was rejected.

A failed command logged only its completion code.  The difference between
a refused Address Device and a refused Evaluate Context is most of the
diagnosis, and the completion code does not give it.

Keep the command type before the result overwrites the TRB, and name it in
the message.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
This commit is contained in:
Justin Hammond 2026-08-16 17:14:53 +08:00 • committed by Xiang Xiao
parent cf93053f74
commit ecbd1870d3

View file

@ -1915,7 +1915,8 @@ static void xhci_context_ctrl(FAR struct usbhost_xhci_s *priv,
static int xhci_command(FAR struct usbhost_xhci_s *priv,
FAR struct xhci_trb_s *trb, uint16_t timeout_ms)
{
int ret;
uint32_t cmdtype;
int ret;
/* Lock bus */
@ -1925,6 +1926,10 @@ static int xhci_command(FAR struct usbhost_xhci_s *priv,
return ret;
}
/* Remember what this was before the result overwrites it */
cmdtype = XHCI_TRB_D2_TYPE_GET(trb->d2);
/* Add command to ring */
xhci_add_trb(priv, &priv->cmd, trb, 1);
@ -1960,7 +1965,8 @@ static int xhci_command(FAR struct usbhost_xhci_s *priv,
}
else
{
uerr("event CC = %d\n", XHCI_TRB_D1_CC_GET(trb->d1));
uerr("command type %d failed, CC = %d\n", cmdtype,
XHCI_TRB_D1_CC_GET(trb->d1));
ret = -EIO;
}