From a8dc67c795bf65fff87f01f1164078b107275508 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 7 Jan 2022 22:14:38 -0500 Subject: [PATCH] XHCI: Print the actual error for some more things in AllocateDevice. May help with diagnosing #17464 and others. --- src/add-ons/kernel/busses/usb/xhci.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp index 6f22d2f17d..19528362cf 100644 --- a/src/add-ons/kernel/busses/usb/xhci.cpp +++ b/src/add-ons/kernel/busses/usb/xhci.cpp @@ -1357,8 +1357,9 @@ XHCI::AllocateDevice(Hub *parent, int8 hubAddress, uint8 hubPort, hubPort, speed); uint8 slot = XHCI_MAX_SLOTS; - if (EnableSlot(&slot) != B_OK) { - TRACE_ERROR("AllocateDevice: failed to enable slot\n"); + status_t status = EnableSlot(&slot); + if (status != B_OK) { + TRACE_ERROR("failed to enable slot: %s\n", strerror(status)); return NULL; } @@ -1516,8 +1517,9 @@ XHCI::AllocateDevice(Hub *parent, int8 hubAddress, uint8 hubPort, } // device should get to addressed state (bsr = 0) - if (SetAddress(device->input_ctx_addr, false, slot) != B_OK) { - TRACE_ERROR("unable to set address\n"); + status = SetAddress(device->input_ctx_addr, false, slot); + if (status != B_OK) { + TRACE_ERROR("unable to set address: %s\n", strerror(status)); CleanupDevice(device); return NULL; } @@ -1549,7 +1551,7 @@ XHCI::AllocateDevice(Hub *parent, int8 hubAddress, uint8 hubPort, usb_device_descriptor deviceDescriptor; TRACE("getting the device descriptor\n"); - status_t status = pipe.SendRequest( + status = pipe.SendRequest( USB_REQTYPE_DEVICE_IN | USB_REQTYPE_STANDARD, // type USB_REQUEST_GET_DESCRIPTOR, // request USB_DESCRIPTOR_DEVICE << 8, // value