Changeset 94963 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- May 9, 2022 2:53:19 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/EmulatedUSBImpl.cpp
r94368 r94963 112 112 { 113 113 /* Convert some well known settings for backward compatibility. */ 114 int rc;114 int vrc; 115 115 if ( RTStrCmp(it->first.c_str(), "MaxPayloadTransferSize") == 0 116 116 || RTStrCmp(it->first.c_str(), "MaxFramerate") == 0) 117 117 { 118 118 uint32_t u32 = 0; 119 rc = RTStrToUInt32Full(it->second.c_str(), 10, &u32);120 if ( rc == VINF_SUCCESS)121 rc = pVMM->pfnCFGMR3InsertInteger(pConfig, it->first.c_str(), u32);122 else if (RT_SUCCESS( rc)) /* VWRN_* */123 rc = VERR_INVALID_PARAMETER;119 vrc = RTStrToUInt32Full(it->second.c_str(), 10, &u32); 120 if (vrc == VINF_SUCCESS) 121 vrc = pVMM->pfnCFGMR3InsertInteger(pConfig, it->first.c_str(), u32); 122 else if (RT_SUCCESS(vrc)) /* VWRN_* */ 123 vrc = VERR_INVALID_PARAMETER; 124 124 } 125 125 else 126 rc = pVMM->pfnCFGMR3InsertString(pConfig, it->first.c_str(), it->second.c_str());127 if (RT_FAILURE( rc))128 return rc;126 vrc = pVMM->pfnCFGMR3InsertString(pConfig, it->first.c_str(), it->second.c_str()); 127 if (RT_FAILURE(vrc)) 128 return vrc; 129 129 } 130 130 … … 137 137 PCFGMNODE pInstance = pVMM->pfnCFGMR3CreateTree(pUVM); 138 138 PCFGMNODE pConfig; 139 int rc = pVMM->pfnCFGMR3InsertNode(pInstance, "Config", &pConfig);140 AssertRCReturn( rc,rc);141 rc = emulatedWebcamInsertSettings(pConfig, pVMM, &pThis->mDevSettings);142 AssertRCReturn( rc,rc);139 int vrc = pVMM->pfnCFGMR3InsertNode(pInstance, "Config", &pConfig); 140 AssertRCReturn(vrc, vrc); 141 vrc = emulatedWebcamInsertSettings(pConfig, pVMM, &pThis->mDevSettings); 142 AssertRCReturn(vrc, vrc); 143 143 144 144 PCFGMNODE pEUSB; 145 rc = pVMM->pfnCFGMR3InsertNode(pConfig, "EmulatedUSB", &pEUSB);146 AssertRCReturn( rc,rc);147 rc = pVMM->pfnCFGMR3InsertString(pEUSB, "Id", pThis->mszUuid);148 AssertRCReturn( rc,rc);145 vrc = pVMM->pfnCFGMR3InsertNode(pConfig, "EmulatedUSB", &pEUSB); 146 AssertRCReturn(vrc, vrc); 147 vrc = pVMM->pfnCFGMR3InsertString(pEUSB, "Id", pThis->mszUuid); 148 AssertRCReturn(vrc, vrc); 149 149 150 150 PCFGMNODE pLunL0; 151 rc = pVMM->pfnCFGMR3InsertNode(pInstance, "LUN#0", &pLunL0);152 AssertRCReturn( rc,rc);153 rc = pVMM->pfnCFGMR3InsertString(pLunL0, "Driver", pszDriver);154 AssertRCReturn( rc,rc);155 rc = pVMM->pfnCFGMR3InsertNode(pLunL0, "Config", &pConfig);156 AssertRCReturn( rc,rc);157 rc = pVMM->pfnCFGMR3InsertString(pConfig, "DevicePath", pThis->mPath.c_str());158 AssertRCReturn( rc,rc);159 rc = pVMM->pfnCFGMR3InsertString(pConfig, "Id", pThis->mszUuid);160 AssertRCReturn( rc,rc);161 rc = emulatedWebcamInsertSettings(pConfig, pVMM, &pThis->mDrvSettings);162 AssertRCReturn( rc,rc);151 vrc = pVMM->pfnCFGMR3InsertNode(pInstance, "LUN#0", &pLunL0); 152 AssertRCReturn(vrc, vrc); 153 vrc = pVMM->pfnCFGMR3InsertString(pLunL0, "Driver", pszDriver); 154 AssertRCReturn(vrc, vrc); 155 vrc = pVMM->pfnCFGMR3InsertNode(pLunL0, "Config", &pConfig); 156 AssertRCReturn(vrc, vrc); 157 vrc = pVMM->pfnCFGMR3InsertString(pConfig, "DevicePath", pThis->mPath.c_str()); 158 AssertRCReturn(vrc, vrc); 159 vrc = pVMM->pfnCFGMR3InsertString(pConfig, "Id", pThis->mszUuid); 160 AssertRCReturn(vrc, vrc); 161 vrc = emulatedWebcamInsertSettings(pConfig, pVMM, &pThis->mDrvSettings); 162 AssertRCReturn(vrc, vrc); 163 163 164 164 /* pInstance will be used by PDM and deallocated on error. */ 165 rc = pVMM->pfnPDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid, NULL);166 LogRelFlowFunc(("PDMR3UsbCreateEmulatedDevice %Rrc\n", rc));167 return rc;165 vrc = pVMM->pfnPDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid, NULL); 166 LogRelFlowFunc(("PDMR3UsbCreateEmulatedDevice %Rrc\n", vrc)); 167 return vrc; 168 168 } 169 169 … … 535 535 NOREF(cbData); 536 536 537 int rc = VINF_SUCCESS;537 int vrc = VINF_SUCCESS; 538 538 if (iEvent == 0) 539 539 { 540 540 com::Utf8Str path; 541 HRESULT hr = pThis->webcamPathFromId(&path, pszId);542 if (SUCCEEDED(hr ))543 { 544 hr = pThis->webcamDetach(path);545 if (FAILED(hr ))546 { 547 rc = VERR_INVALID_STATE;541 HRESULT hrc = pThis->webcamPathFromId(&path, pszId); 542 if (SUCCEEDED(hrc)) 543 { 544 hrc = pThis->webcamDetach(path); 545 if (FAILED(hrc)) 546 { 547 vrc = VERR_INVALID_STATE; 548 548 } 549 549 } 550 550 else 551 551 { 552 rc = VERR_NOT_FOUND;552 vrc = VERR_NOT_FOUND; 553 553 } 554 554 } 555 555 else 556 556 { 557 rc = VERR_INVALID_PARAMETER;557 vrc = VERR_INVALID_PARAMETER; 558 558 } 559 559 … … 561 561 RTMemFree(pvData); 562 562 563 LogRelFlowFunc(("rc %Rrc\n", rc));564 return rc;563 LogRelFlowFunc(("rc %Rrc\n", vrc)); 564 return vrc; 565 565 } 566 566 … … 569 569 { 570 570 /* Make a copy of parameters, forward to EMT and leave the callback to not hold any lock in the device. */ 571 int rc = VINF_SUCCESS;571 int vrc = VINF_SUCCESS; 572 572 void *pvDataCopy = NULL; 573 573 if (cbData > 0) … … 575 575 pvDataCopy = RTMemDup(pvData, cbData); 576 576 if (!pvDataCopy) 577 rc = VERR_NO_MEMORY;578 } 579 if (RT_SUCCESS( rc))577 vrc = VERR_NO_MEMORY; 578 } 579 if (RT_SUCCESS(vrc)) 580 580 { 581 581 void *pvIdCopy = RTMemDup(pszId, strlen(pszId) + 1); 582 582 if (pvIdCopy) 583 583 { 584 if (RT_SUCCESS( rc))584 if (RT_SUCCESS(vrc)) 585 585 { 586 586 EmulatedUSB *pThis = (EmulatedUSB *)pv; … … 589 589 { 590 590 /* No wait. */ 591 rc = ptrVM.vtable()->pfnVMR3ReqCallNoWaitU(ptrVM.rawUVM(), 0 /* idDstCpu */,592 (PFNRT)EmulatedUSB::eusbCallbackEMT, 5,593 pThis, pvIdCopy, iEvent, pvDataCopy, cbData);594 if (RT_SUCCESS( rc))595 return rc;591 vrc = ptrVM.vtable()->pfnVMR3ReqCallNoWaitU(ptrVM.rawUVM(), 0 /* idDstCpu */, 592 (PFNRT)EmulatedUSB::eusbCallbackEMT, 5, 593 pThis, pvIdCopy, iEvent, pvDataCopy, cbData); 594 if (RT_SUCCESS(vrc)) 595 return vrc; 596 596 } 597 597 else 598 rc = VERR_INVALID_STATE;598 vrc = VERR_INVALID_STATE; 599 599 } 600 600 RTMemFree(pvIdCopy); 601 601 } 602 602 else 603 rc = VERR_NO_MEMORY;603 vrc = VERR_NO_MEMORY; 604 604 RTMemFree(pvDataCopy); 605 605 } 606 return rc;606 return vrc; 607 607 } 608 608 … … 635 635 HRESULT EmulatedUSB::webcamPathFromId(com::Utf8Str *pPath, const char *pszId) 636 636 { 637 HRESULT hr = S_OK;637 HRESULT hrc = S_OK; 638 638 639 639 Console::SafeVMPtr ptrVM(m.pConsole); … … 654 654 if (it == m.webcams.end()) 655 655 { 656 hr = E_FAIL;656 hrc = E_FAIL; 657 657 } 658 658 alock.release(); … … 660 660 else 661 661 { 662 hr = VBOX_E_INVALID_VM_STATE;663 } 664 665 return hr ;662 hrc = VBOX_E_INVALID_VM_STATE; 663 } 664 665 return hrc; 666 666 } 667 667
Note:
See TracChangeset
for help on using the changeset viewer.