VirtualBox

Changeset 66807 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
May 5, 2017 10:48:45 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115226
Message:

VUSB: Edit async audio endpoints to make them look synchronous.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/USBProxyDevice.cpp

    r62992 r66807  
    10561056    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    10571057        fForce11PacketSize = false;
     1058    else
     1059        AssertRCReturn(rc, rc);
     1060
     1061    bool fEditAudioSyncEp;
     1062    rc = CFGMR3QueryBool(pCfg, "EditAudioSyncEp", &fEditAudioSyncEp);
     1063    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     1064        rc = CFGMR3QueryBool(pCfgGlobalDev, "EditAudioSyncEp", &fEditAudioSyncEp);
     1065    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     1066        fEditAudioSyncEp = true;    /* NB: On by default! */
    10581067    else
    10591068        AssertRCReturn(rc, rc);
     
    11121121    }
    11131122
     1123
     1124    /*
     1125     * Turn asynchronous audio endpoints into synchronous ones, see @bugref{8769}
     1126     */
     1127    if (fEditAudioSyncEp)
     1128    {
     1129        PVUSBDESCCONFIGEX paCfgs = pThis->paCfgDescs;
     1130        for (unsigned iCfg = 0; iCfg < pThis->DevDesc.bNumConfigurations; iCfg++)
     1131        {
     1132            PVUSBINTERFACE paIfs = (PVUSBINTERFACE)paCfgs[iCfg].paIfs;
     1133            for (unsigned iIf = 0; iIf < paCfgs[iCfg].Core.bNumInterfaces; iIf++)
     1134                for (uint32_t iAlt = 0; iAlt < paIfs[iIf].cSettings; iAlt++)
     1135                {
     1136                    /* If not an audio class interface, skip. */
     1137                    if (paIfs[iIf].paSettings[iAlt].Core.bInterfaceClass != 1)
     1138                        continue;
     1139
     1140                    /* If not a streaming interface, skip. */
     1141                    if (paIfs[iIf].paSettings[iAlt].Core.bInterfaceSubClass != 2)
     1142                        continue;
     1143
     1144                    PVUSBDESCENDPOINTEX paEps = (PVUSBDESCENDPOINTEX)paIfs[iIf].paSettings[iAlt].paEndpoints;
     1145                    for (unsigned iEp = 0; iEp < paIfs[iIf].paSettings[iAlt].Core.bNumEndpoints; iEp++)
     1146                    {
     1147                        /* isoch/asynch/data*/
     1148                        if ((paEps[iEp].Core.bmAttributes == 5) && (paEps[iEp].Core.bLength == 9))
     1149                        {
     1150                            uint8_t *pbExtra = (uint8_t *)paEps[iEp].pvMore;    /* unconst*/
     1151                            Log(("usb-proxy: pProxyDev=%s async audio with bmAttr=%02X [%02X, %02X] on EP %02X\n",
     1152                                 pUsbIns->pszName, paEps[iEp].Core.bmAttributes, pbExtra[0], pbExtra[1], paEps[iEp].Core.bEndpointAddress));
     1153                            paEps[iEp].Core.bmAttributes = 0xD; /* isoch/synch/data*/
     1154                            pbExtra[1] = 0; /* Clear bSynchAddress. */
     1155                            fEdited = true;
     1156                            LogRel(("VUSB: Modified '%s' async audio endpoint 0x%02x\n", pUsbIns->pszName, paEps[iEp].Core.bEndpointAddress));
     1157                        }
     1158                    }
     1159                }
     1160        }
     1161    }
    11141162
    11151163    /*
Note: See TracChangeset for help on using the changeset viewer.

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