VirtualBox

Changeset 80480 in vbox


Ignore:
Timestamp:
Aug 28, 2019 2:16:15 PM (5 years ago)
Author:
vboxsync
Message:

VBoxUsbLib-win: Print information identifying the hub and port where an error occurred.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp

    r79390 r80480  
    500500}
    501501
    502 static int usbLibDevCfgDrGet(HANDLE hHub, ULONG iPort, ULONG iDr, PUSB_CONFIGURATION_DESCRIPTOR *ppDr)
     502static int usbLibDevCfgDrGet(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, ULONG iDr, PUSB_CONFIGURATION_DESCRIPTOR *ppDr)
    503503{
    504504    *ppDr = NULL;
     
    519519    {
    520520        DWORD dwErr = GetLastError();
    521         LogRelFunc(("DeviceIoControl 1 fail dwErr (%d)\n", dwErr));
     521        LogRelFunc(("DeviceIoControl 1 fail dwErr (%d) on hub %s port %d\n", dwErr, lpcszHubName, iPort));
    522522#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    523523        AssertFailed();
     
    556556        {
    557557            DWORD dwErr = GetLastError();
    558             LogRelFunc(("DeviceIoControl 2 fail dwErr (%d)\n", dwErr));
     558            LogRelFunc(("DeviceIoControl 2 fail dwErr (%d) on hub %s port %d\n", dwErr, lpcszHubName, iPort));
    559559#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    560560            AssertFailed();
     
    590590}
    591591
    592 static int usbLibDevStrDrEntryGet(HANDLE hHub, ULONG iPort, ULONG iDr, USHORT idLang, PVBOXUSB_STRING_DR_ENTRY *ppList)
     592static int usbLibDevStrDrEntryGet(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, ULONG iDr, USHORT idLang, PVBOXUSB_STRING_DR_ENTRY *ppList)
    593593{
    594594    char szBuf[sizeof (USB_DESCRIPTOR_REQUEST) + MAXIMUM_USB_STRING_LENGTH];
     
    610610    {
    611611        DWORD dwErr = GetLastError();
    612         LogRel(("Getting USB descriptor (id %u) failed with error %ld\n", iDr, dwErr));
     612        LogRel(("Getting USB descriptor (id %u) failed with error %ld on hub %s port %d\n", iDr, dwErr, lpcszHubName, iPort));
    613613        return RTErrConvertFromWin32(dwErr);
    614614    }
     
    659659}
    660660
    661 static int usbLibDevStrDrEntryGetForLangs(HANDLE hHub, ULONG iPort, ULONG iDr, ULONG cIdLang, const USHORT *pIdLang, PVBOXUSB_STRING_DR_ENTRY *ppList)
     661static int usbLibDevStrDrEntryGetForLangs(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, ULONG iDr, ULONG cIdLang, const USHORT *pIdLang, PVBOXUSB_STRING_DR_ENTRY *ppList)
    662662{
    663663    for (ULONG i = 0; i < cIdLang; ++i)
    664664    {
    665         usbLibDevStrDrEntryGet(hHub, iPort, iDr, pIdLang[i], ppList);
     665        usbLibDevStrDrEntryGet(hHub, lpcszHubName, iPort, iDr, pIdLang[i], ppList);
    666666    }
    667667    return VINF_SUCCESS;
    668668}
    669669
    670 static int usbLibDevStrDrEntryGetAll(HANDLE hHub, ULONG iPort, PUSB_DEVICE_DESCRIPTOR pDevDr, PUSB_CONFIGURATION_DESCRIPTOR pCfgDr, PVBOXUSB_STRING_DR_ENTRY *ppList)
     670static int usbLibDevStrDrEntryGetAll(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, PUSB_DEVICE_DESCRIPTOR pDevDr, PUSB_CONFIGURATION_DESCRIPTOR pCfgDr, PVBOXUSB_STRING_DR_ENTRY *ppList)
    671671{
    672672    /* Read string descriptor zero to determine what languages are available. */
    673     int rc = usbLibDevStrDrEntryGet(hHub, iPort, 0, 0, ppList);
     673    int rc = usbLibDevStrDrEntryGet(hHub, lpcszHubName, iPort, 0, 0, ppList);
    674674    if (RT_FAILURE(rc))
    675675        return rc;
     
    681681    if (pDevDr->iManufacturer)
    682682    {
    683         rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pDevDr->iManufacturer, cIdLang, pIdLang, ppList);
     683        rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pDevDr->iManufacturer, cIdLang, pIdLang, ppList);
    684684        AssertRC(rc);
    685685    }
     
    687687    if (pDevDr->iProduct)
    688688    {
    689         rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pDevDr->iProduct, cIdLang, pIdLang, ppList);
     689        rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pDevDr->iProduct, cIdLang, pIdLang, ppList);
    690690        AssertRC(rc);
    691691    }
     
    693693    if (pDevDr->iSerialNumber)
    694694    {
    695         rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pDevDr->iSerialNumber, cIdLang, pIdLang, ppList);
     695        rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pDevDr->iSerialNumber, cIdLang, pIdLang, ppList);
    696696        AssertRC(rc);
    697697    }
     
    724724                if (!pCurCfgDr->iConfiguration)
    725725                    break;
    726                 rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pCurCfgDr->iConfiguration, cIdLang, pIdLang, ppList);
     726                rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pCurCfgDr->iConfiguration, cIdLang, pIdLang, ppList);
    727727                AssertRC(rc);
    728728                break;
     
    738738                if (!pCurIfDr->iInterface)
    739739                    break;
    740                 rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pCurIfDr->iInterface, cIdLang, pIdLang, ppList);
     740                rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pCurIfDr->iInterface, cIdLang, pIdLang, ppList);
    741741                AssertRC(rc);
    742742                break;
     
    769769    {
    770770        DWORD dwErr = GetLastError(); NOREF(dwErr);
    771         LogRel(("Getting USB connection information failed with error %ld\n", dwErr));
     771        LogRel(("Getting USB connection information failed with error %ld on hub %s\n", dwErr, lpcszHubName));
    772772        AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%d)\n", dwErr));
    773773        return VERR_GENERAL_FAILURE;
     
    782782    if (pConInfo->DeviceIsHub)
    783783    {
    784         LPSTR lpszHubName = NULL;
    785         rc = usbLibDevStrHubNameGet(hHub, iPort, &lpszHubName);
     784        LPSTR lpszChildHubName = NULL;
     785        rc = usbLibDevStrHubNameGet(hHub, iPort, &lpszChildHubName);
    786786        AssertRC(rc);
    787787        if (RT_SUCCESS(rc))
    788788        {
    789             rc = usbLibDevGetHubDevices(lpszHubName, ppDevs, pcDevs);
    790             usbLibDevStrFree(lpszHubName);
     789            rc = usbLibDevGetHubDevices(lpszChildHubName, ppDevs, pcDevs);
     790            usbLibDevStrFree(lpszChildHubName);
    791791            AssertRC(rc);
    792792            return rc;
     
    803803    if (!lpszName)
    804804    {
     805        LogRelFunc(("warning: no DriverKey on hub %s port %d\n", lpcszHubName, iPort));
    805806        lpszName = &nameEmptyBuf;
    806807        fFreeNameBuf = false;
     
    809810    PUSB_CONFIGURATION_DESCRIPTOR pCfgDr = NULL;
    810811    PVBOXUSB_STRING_DR_ENTRY pList = NULL;
    811     rc = usbLibDevCfgDrGet(hHub, iPort, 0, &pCfgDr);
     812    rc = usbLibDevCfgDrGet(hHub, lpcszHubName, iPort, 0, &pCfgDr);
    812813    if (pCfgDr)
    813814    {
    814         rc = usbLibDevStrDrEntryGetAll(hHub, iPort, &pConInfo->DeviceDescriptor, pCfgDr, &pList);
     815        rc = usbLibDevStrDrEntryGetAll(hHub, lpcszHubName, iPort, &pConInfo->DeviceDescriptor, pCfgDr, &pList);
    815816#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    816817        AssertRC(rc); // this can fail if device suspended
     
    878879                            &cbReturned, NULL))
    879880        {
    880             LogRel(("Getting USB node information failed with error %ld\n", GetLastError()));
     881            LogRel(("Getting USB node information failed with error %ld on hub %s\n", GetLastError(), lpszName));
    881882            AssertFailed();
    882883            break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette