Changeset 77000 in vbox for trunk/src/VBox/Devices/USB
- Timestamp:
- Jan 26, 2019 10:30:14 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128422
- Location:
- trunk/src/VBox/Devices/USB
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
r76553 r77000 234 234 { 235 235 LogFlow(("vusbHubAttach: pHub=%p[%s] pDev=%p[%s]\n", pHub, pHub->pszName, pDev, pDev->pUsbIns->pszName)); 236 AssertMsg(pDev->enmState == VUSB_DEVICE_STATE_DETACHED, ("enmState=%d\n", pDev->enmState)); 237 238 pDev->pHub = pHub; 239 pDev->enmState = VUSB_DEVICE_STATE_ATTACHED; 240 241 /* noone else ever messes with the default pipe while we are attached */ 242 vusbDevMapEndpoint(pDev, &g_Endpoint0); 243 vusbDevDoSelectConfig(pDev, &g_Config0); 244 245 int rc = pHub->pOps->pfnAttach(pHub, pDev); 246 if (RT_FAILURE(rc)) 247 { 248 pDev->pHub = NULL; 249 pDev->enmState = VUSB_DEVICE_STATE_DETACHED; 250 } 251 return rc; 236 return vusbDevAttach(pDev, pHub); 252 237 } 253 238 -
trunk/src/VBox/Devices/USB/VUSBDevice.cpp
r76684 r77000 1214 1214 1215 1215 /** 1216 * Attaches a device to the given hub. 1217 * 1218 * @returns VBox status code. 1219 * @param pDev The device to attach. 1220 * @param pHub THe hub to attach to. 1221 */ 1222 int vusbDevAttach(PVUSBDEV pDev, PVUSBHUB pHub) 1223 { 1224 AssertMsg(pDev->enmState == VUSB_DEVICE_STATE_DETACHED, ("enmState=%d\n", pDev->enmState)); 1225 1226 pDev->pHub = pHub; 1227 pDev->enmState = VUSB_DEVICE_STATE_ATTACHED; 1228 1229 /* noone else ever messes with the default pipe while we are attached */ 1230 vusbDevMapEndpoint(pDev, &g_Endpoint0); 1231 vusbDevDoSelectConfig(pDev, &g_Config0); 1232 1233 /* Create I/O thread and attach to the hub. */ 1234 int rc = vusbDevUrbIoThreadCreate(pDev); 1235 if (RT_SUCCESS(rc)) 1236 rc = pHub->pOps->pfnAttach(pHub, pDev); 1237 1238 if (RT_FAILURE(rc)) 1239 { 1240 pDev->pHub = NULL; 1241 pDev->enmState = VUSB_DEVICE_STATE_DETACHED; 1242 } 1243 1244 return rc; 1245 } 1246 1247 1248 /** 1216 1249 * Detaches a device from the hub it's attached to. 1217 1250 * … … 1245 1278 vusbDevUrbIoThreadDestroy(pDev); 1246 1279 1247 int rc = RTReqQueueDestroy(pDev->hReqQueueSync);1248 AssertRC(rc);1249 pDev->hReqQueueSync = NIL_RTREQQUEUE;1250 1251 1280 vusbDevSetState(pDev, VUSB_DEVICE_STATE_DETACHED); 1252 1281 pDev->pHub = NULL; … … 1283 1312 1284 1313 vusbUrbPoolDestroy(&pDev->UrbPool); 1314 1315 int rc = RTReqQueueDestroy(pDev->hReqQueueSync); 1316 AssertRC(rc); 1317 pDev->hReqQueueSync = NIL_RTREQQUEUE; 1285 1318 1286 1319 RTCritSectDelete(&pDev->CritSectAsyncUrbs); … … 1715 1748 } 1716 1749 1717 1718 static DECLCALLBACK(int) vusbDevGetDescriptorCacheWorker(PPDMUSBINS pUsbIns, PCPDMUSBDESCCACHE *ppDescCache)1719 {1720 *ppDescCache = pUsbIns->pReg->pfnUsbGetDescriptorCache(pUsbIns);1721 return VINF_SUCCESS;1722 }1723 1750 1724 1751 /** … … 1782 1809 AssertRCReturn(rc, rc); 1783 1810 1784 /* Create I/O thread. */1785 rc = vusbDevUrbIoThreadCreate(pDev);1786 AssertRCReturn(rc, rc);1787 1788 1811 /* 1789 1812 * Create the reset timer. … … 1802 1825 * Get the descriptor cache from the device. (shall cannot fail) 1803 1826 */ 1804 rc = vusbDevIoThreadExecSync(pDev, (PFNRT)vusbDevGetDescriptorCacheWorker, 2, pUsbIns, &pDev->pDescCache); 1805 AssertRC(rc); 1827 pDev->pDescCache = pUsbIns->pReg->pfnUsbGetDescriptorCache(pUsbIns); 1806 1828 AssertPtr(pDev->pDescCache); 1807 1829 #ifdef VBOX_STRICT -
trunk/src/VBox/Devices/USB/VUSBInternal.h
r76565 r77000 298 298 void vusbDevMapEndpoint(PVUSBDEV dev, PCVUSBDESCENDPOINTEX ep); 299 299 int vusbDevDetach(PVUSBDEV pDev); 300 int vusbDevAttach(PVUSBDEV pDev, PVUSBHUB pHub); 300 301 DECLINLINE(PVUSBROOTHUB) vusbDevGetRh(PVUSBDEV pDev); 301 302 size_t vusbDevMaxInterfaces(PVUSBDEV dev); … … 738 739 /** Strings for the CTLSTAGE enum values. */ 739 740 extern const char * const g_apszCtlStates[4]; 740 /** Default message pipe. */741 extern const VUSBDESCENDPOINTEX g_Endpoint0;742 /** Default configuration. */743 extern const VUSBDESCCONFIGEX g_Config0;744 741 745 742 RT_C_DECLS_END
Note:
See TracChangeset
for help on using the changeset viewer.