Changeset 53062 in vbox
- Timestamp:
- Oct 15, 2014 12:34:18 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 96564
- Location:
- trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmdrv.h
r46788 r53062 508 508 * 509 509 * @returns VBox status code. 510 * @param pDrvIns The hub instance. 511 * @param pUsbIns The device to attach. 512 * @param piPort Where to store the port number the device was attached to. 510 * @param pDrvIns The hub instance. 511 * @param pUsbIns The device to attach. 512 * @param pszCaptureFilename Path to the file for USB traffic capturing, optional. 513 * @param piPort Where to store the port number the device was attached to. 513 514 * @thread EMT. 514 515 */ 515 DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t *piPort));516 DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, const char *pszCaptureFilename, uint32_t *piPort)); 516 517 517 518 /** … … 537 538 538 539 /** Current PDMUSBHUBREG version number. */ 539 #define PDM_USBHUBREG_VERSION PDM_VERSION_MAKE(0xf0fd, 1, 0)540 #define PDM_USBHUBREG_VERSION PDM_VERSION_MAKE(0xf0fd, 2, 0) 540 541 541 542 -
trunk/include/VBox/vmm/pdmusb.h
r51290 r53062 1058 1058 typedef DECLCALLBACK(int) FNPDMVBOXUSBREGISTER(PCPDMUSBREGCB pCallbacks, uint32_t u32Version); 1059 1059 1060 VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pDeviceNode, PCRTUUID pUuid); 1060 VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pDeviceNode, PCRTUUID pUuid, 1061 const char *pszCaptureFilename); 1061 1062 VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend, 1062 uint32_t iUsbVersion, uint32_t fMaskedIfs );1063 uint32_t iUsbVersion, uint32_t fMaskedIfs, const char *pszCaptureFilename); 1063 1064 VMMR3DECL(int) PDMR3UsbDetachDevice(PUVM pUVM, PCRTUUID pUuid); 1064 1065 VMMR3DECL(bool) PDMR3UsbHasHub(PUVM pUVM); -
trunk/src/VBox/Devices/Makefile.kmk
r52797 r53062 354 354 USB/VUSBDevice.cpp \ 355 355 USB/VUSBReadAhead.cpp \ 356 USB/VUSBUrb.cpp 356 USB/VUSBUrb.cpp \ 357 USB/VUSBSniffer.cpp 357 358 endif 358 359 -
trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
r52878 r53062 255 255 256 256 /** @copydoc PDMUSBHUBREG::pfnAttachDevice */ 257 static DECLCALLBACK(int) vusbPDMHubAttachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t *piPort)257 static DECLCALLBACK(int) vusbPDMHubAttachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, const char *pszCaptureFilename, uint32_t *piPort) 258 258 { 259 259 PVUSBROOTHUB pThis = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB); … … 264 264 PVUSBDEV pDev = (PVUSBDEV)RTMemAllocZ(sizeof(*pDev)); 265 265 AssertReturn(pDev, VERR_NO_MEMORY); 266 int rc = vusbDevInit(pDev, pUsbIns );266 int rc = vusbDevInit(pDev, pUsbIns, pszCaptureFilename); 267 267 if (RT_SUCCESS(rc)) 268 268 { -
trunk/src/VBox/Devices/USB/VUSBDevice.cpp
r52881 r53062 34 34 #include "VUSBInternal.h" 35 35 36 #include "VUSBSniffer.h" 36 37 37 38 /******************************************************************************* … … 1283 1284 AssertRC(rc); 1284 1285 1286 if (pDev->hSniffer != VUSBSNIFFER_NIL) 1287 VUSBSnifferDestroy(pDev->hSniffer); 1288 1285 1289 RTCritSectDelete(&pDev->CritSectAsyncUrbs); 1286 1290 /* Not using vusbDevSetState() deliberately here because it would assert on the state. */ … … 1697 1701 * @param pUsbIns Pointer to the PDM USB Device instance. 1698 1702 */ 1699 int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns )1703 int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns, const char *pszCaptureFilename) 1700 1704 { 1701 1705 /* … … 1733 1737 } 1734 1738 pDev->pResetTimer = NULL; 1739 pDev->hSniffer = VUSBSNIFFER_NIL; 1735 1740 1736 1741 int rc = RTCritSectInit(&pDev->CritSectAsyncUrbs); … … 1751 1756 "USB Device Reset Timer", &pDev->pResetTimer); 1752 1757 AssertRCReturn(rc, rc); 1758 1759 if (pszCaptureFilename) 1760 { 1761 rc = VUSBSnifferCreate(&pDev->hSniffer, 0, pszCaptureFilename, NULL); 1762 AssertRCReturn(rc, rc); 1763 } 1753 1764 1754 1765 /* -
trunk/src/VBox/Devices/USB/VUSBInternal.h
r52881 r53062 31 31 #include <iprt/queueatomic.h> 32 32 #include <iprt/req.h> 33 34 #include "VUSBSniffer.h" 33 35 34 36 RT_C_DECLS_BEGIN … … 216 218 * synchronous and without any other thread accessing the USB device. */ 217 219 RTREQQUEUE hReqQueueSync; 220 /** Sniffer instance for this device if configured. */ 221 VUSBSNIFFER hSniffer; 218 222 /** Flag whether the URB I/O thread should terminate. */ 219 223 bool volatile fTerminate; … … 222 226 #if HC_ARCH_BITS == 32 223 227 /** Align the size to a 8 byte boundary. */ 224 bool afAlignment0[ 2];228 bool afAlignment0[6]; 225 229 #endif 226 230 } VUSBDEV; … … 248 252 249 253 250 int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns );254 int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns, const char *pszCaptureFilename); 251 255 int vusbDevCreateOld(const char *pszDeviceName, void *pvDriverInit, PCRTUUID pUuid, PVUSBDEV *ppDev); 252 256 void vusbDevDestroy(PVUSBDEV pDev); -
trunk/src/VBox/Devices/USB/VUSBUrb.cpp
r52881 r53062 1012 1012 || pUrb->enmState == VUSBURBSTATE_CANCELLED, ("%d\n", pUrb->enmState)); 1013 1013 1014 if (pUrb->VUsb.pDev->hSniffer) 1015 { 1016 int rc = VUSBSnifferRecordEvent(pUrb->VUsb.pDev->hSniffer, pUrb, 1017 pUrb->enmStatus == VUSBSTATUS_OK 1018 ? VUSBSNIFFEREVENT_COMPLETE 1019 : VUSBSNIFFEREVENT_ERROR_COMPLETE); 1020 if (RT_FAILURE(rc)) 1021 LogRel(("VUSB: Capturing URB completion event failed with %Rrc\n", rc)); 1022 } 1014 1023 1015 1024 #ifdef VBOX_WITH_STATISTICS … … 1896 1905 int rc; 1897 1906 1907 if (pDev->hSniffer) 1908 { 1909 rc = VUSBSnifferRecordEvent(pDev->hSniffer, pUrb, VUSBSNIFFEREVENT_SUBMIT); 1910 if (RT_FAILURE(rc)) 1911 LogRel(("VUSB: Capturing URB submit event failed with %Rrc\n", rc)); 1912 } 1913 1898 1914 #ifdef VBOX_WITH_USB 1899 1915 if (pPipe && pPipe->hReadAhead) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r52978 r53062 933 933 break; 934 934 } 935 else if (a->argc == 4 || a->argc > 5) 936 { 937 errorSyntax(USAGE_CONTROLVM, "Wrong number of arguments"); 938 rc = E_FAIL; 939 break; 940 } 935 941 936 942 bool attach = !strcmp(a->argv[1], "usbattach"); 937 943 938 944 Bstr usbId = a->argv[2]; 945 Bstr captureFilename; 946 947 if (a->argc == 5) 948 { 949 if (!strcmp(a->argv[3], "--capturefile")) 950 captureFilename = a->argv[4]; 951 else 952 { 953 errorArgument("Invalid parameter '%s'", a->argv[3]); 954 rc = E_FAIL; 955 break; 956 } 957 } 939 958 940 959 Guid guid(usbId); … … 971 990 972 991 if (attach) 973 CHECK_ERROR_BREAK(console, AttachUSBDevice(usbId.raw() ));992 CHECK_ERROR_BREAK(console, AttachUSBDevice(usbId.raw(), captureFilename.raw())); 974 993 else 975 994 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r52312 r53062 372 372 " [--autostart-enabled on|off]\n" 373 373 " [--autostart-delay <seconds>]\n" 374 #if 0 /* Disabled until the feature is implemented. */374 #if 0 375 375 " [--autostop-type disabled|savestate|poweroff|\n" 376 376 " acpishutdown]\n" … … 468 468 " natpf<1-N> delete <rulename> |\n" 469 469 " guestmemoryballoon <balloonsize in MB> |\n" 470 " usbattach <uuid>|<address> |\n" 470 " usbattach <uuid>|<address>\n" 471 " [--capturefile <filename>] |\n" 471 472 " usbdetach <uuid>|<address> |\n" 472 473 " clipboard disabled|hosttoguest|guesttohost|\n" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r53046 r53062 1640 1640 { 1641 1641 /* Try to attach corresponding device: */ 1642 console().AttachUSBDevice(target.id );1642 console().AttachUSBDevice(target.id, QString("")); 1643 1643 /* Check if console is OK: */ 1644 1644 if (!console().isOk()) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r52978 r53062 3495 3495 <interface 3496 3496 name="IInternalMachineControl" extends="$unknown" 3497 uuid=" 2d9ce4b7-0ab2-4931-ac4a-e45aa66465ef"3497 uuid="1470ff16-d7fa-448e-9c38-0352a36053bf" 3498 3498 internal="yes" 3499 3499 wsmap="suppress" … … 3605 3605 </desc> 3606 3606 <param name="id" type="uuid" mod="string" dir="in"/> 3607 <param name="captureFilename" type="wstring" dir="in"/> 3607 3608 </method> 3608 3609 … … 7492 7493 <interface 7493 7494 name="IConsole" extends="$unknown" 7494 uuid=" d129b03e-037a-40b1-b288-a08ae73de535"7495 uuid="e51702d7-4f8f-4ebe-ac47-4b77defffd18" 7495 7496 wsmap="managed" 7496 7497 > … … 7940 7941 <param name="id" type="uuid" mod="string" dir="in"> 7941 7942 <desc>UUID of the host USB device to attach.</desc> 7943 </param> 7944 <param name="captureFilename" type="wstring" dir="in"> 7945 <desc>Filename to capture the USB traffic to.</desc> 7942 7946 </param> 7943 7947 </method> … … 17880 17884 <interface 17881 17885 name="IInternalSessionControl" extends="$unknown" 17882 uuid=" b7c71040-2761-42c4-a44a-4e2c2d7e2820"17886 uuid="fdb5fa71-eddb-4e06-9844-277d22270fe0" 17883 17887 internal="yes" 17884 17888 wsmap="suppress" … … 18221 18225 <param name="error" type="IVirtualBoxErrorInfo" dir="in"/> 18222 18226 <param name="maskedInterfaces" type="unsigned long" dir="in"/> 18227 <param name="captureFilename" type="wstring" dir="in"/> 18223 18228 </method> 18224 18229 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r52934 r53062 168 168 HRESULT i_onUSBControllerChange(); 169 169 HRESULT i_onSharedFolderChange(BOOL aGlobal); 170 HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs); 170 HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs, 171 const Utf8Str &aCaptureFilename); 171 172 HRESULT i_onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError); 172 173 HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup); … … 318 319 HRESULT getDeviceActivity(const std::vector<DeviceType_T> &aType, 319 320 std::vector<DeviceActivity_T> &aActivity); 320 HRESULT attachUSBDevice(const com::Guid &aId );321 HRESULT attachUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename); 321 322 HRESULT detachUSBDevice(const com::Guid &aId, 322 323 ComPtr<IUSBDevice> &aDevice); … … 743 744 744 745 #ifdef VBOX_WITH_USB 745 HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs );746 HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, const Utf8Str &aCaptureFilename); 746 747 HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice); 747 748 748 749 static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, 749 750 bool aRemote, const char *aAddress, void *pvRemoteBackend, 750 USHORT aPortVersion, ULONG aMaskedIfs );751 USHORT aPortVersion, ULONG aMaskedIfs, const char *pszCaptureFilename); 751 752 static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid); 752 753 #endif -
trunk/src/VBox/Main/include/HostUSBDeviceImpl.h
r49960 r53062 209 209 com::Utf8Str i_getName(); 210 210 211 HRESULT i_requestCaptureForVM(SessionMachine *aMachine, bool aSetError, ULONG aMaskedIfs = 0); 211 HRESULT i_requestCaptureForVM(SessionMachine *aMachine, bool aSetError, 212 const com::Utf8Str &aCaptureFilename, ULONG aMaskedIfs = 0); 212 213 HRESULT i_onDetachFromVM(SessionMachine *aMachine, bool aDone, bool *aRunFilters, bool aAbnormal = false); 213 214 HRESULT i_requestReleaseToHost(); … … 229 230 protected: 230 231 231 HRESULT i_attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs = 0);232 HRESULT i_attachToVM(SessionMachine *aMachine, const com::Utf8Str &aCaptureFilename, ULONG aMaskedIfs = 0); 232 233 void i_detachFromVM(HostUSBDeviceState aFinalState); 233 234 void i_onPhysicalDetachedInternal(); … … 300 301 * This points to the string in mNameObj. */ 301 302 const char *mName; 303 /** The filename to capture the USB traffic to. */ 304 com::Utf8Str mCaptureFilename; 302 305 303 306 friend class USBProxyService; -
trunk/src/VBox/Main/include/MachineImpl.h
r52958 r53062 1144 1144 BOOL *aMatched, 1145 1145 ULONG *aMaskedInterfaces); 1146 HRESULT captureUSBDevice(const com::Guid &aId );1146 HRESULT captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename); 1147 1147 HRESULT detachUSBDevice(const com::Guid &aId, 1148 1148 BOOL aDone); … … 1285 1285 HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, 1286 1286 IVirtualBoxErrorInfo *aError, 1287 ULONG aMaskedIfs); 1287 ULONG aMaskedIfs, 1288 const com::Utf8Str &aCaptureFilename); 1288 1289 HRESULT i_onUSBDeviceDetach(IN_BSTR aId, 1289 1290 IVirtualBoxErrorInfo *aError); … … 1315 1316 BOOL *aMatched, 1316 1317 ULONG *aMaskedInterfaces); 1317 HRESULT captureUSBDevice(const com::Guid &aId );1318 HRESULT captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename); 1318 1319 HRESULT detachUSBDevice(const com::Guid &aId, 1319 1320 BOOL aDone); -
trunk/src/VBox/Main/include/SessionImpl.h
r52251 r53062 97 97 HRESULT onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice, 98 98 const ComPtr<IVirtualBoxErrorInfo> &aError, 99 ULONG aMaskedInterfaces); 99 ULONG aMaskedInterfaces, 100 const com::Utf8Str &aCaptureFilename); 100 101 HRESULT onUSBDeviceDetach(const com::Guid &aId, 101 102 const ComPtr<IVirtualBoxErrorInfo> &aError); -
trunk/src/VBox/Main/include/USBProxyService.h
r52934 r53062 63 63 /** @name SessionMachine Interfaces 64 64 * @{ */ 65 HRESULT captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId );65 HRESULT captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId, const com::Utf8Str &aCaptureFilename); 66 66 HRESULT detachDeviceFromVM(SessionMachine *aMachine, IN_GUID aId, bool aDone); 67 67 HRESULT autoCaptureDevicesForVM(SessionMachine *aMachine); -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r53031 r53062 2827 2827 } 2828 2828 2829 HRESULT Console::attachUSBDevice(const com::Guid &aId )2829 HRESULT Console::attachUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename) 2830 2830 { 2831 2831 #ifdef VBOX_WITH_USB … … 2853 2853 2854 2854 /* Request the device capture */ 2855 return mControl->CaptureUSBDevice(Bstr(aId.toString()).raw() );2855 return mControl->CaptureUSBDevice(Bstr(aId.toString()).raw(), Bstr(aCaptureFilename).raw()); 2856 2856 2857 2857 #else /* !VBOX_WITH_USB */ … … 5271 5271 * @note Locks this object for writing. 5272 5272 */ 5273 HRESULT Console::i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs) 5273 HRESULT Console::i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs, 5274 const Utf8Str &aCaptureFilename) 5274 5275 { 5275 5276 #ifdef VBOX_WITH_USB … … 5309 5310 5310 5311 alock.release(); 5311 HRESULT rc = i_attachUSBDevice(aDevice, aMaskedIfs );5312 HRESULT rc = i_attachUSBDevice(aDevice, aMaskedIfs, aCaptureFilename); 5312 5313 if (FAILED(rc)) 5313 5314 { … … 8316 8317 * @note Synchronously calls EMT. 8317 8318 */ 8318 HRESULT Console::i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs) 8319 HRESULT Console::i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, 8320 const Utf8Str &aCaptureFilename) 8319 8321 { 8320 8322 AssertReturn(aHostDevice, E_FAIL); … … 8365 8367 8366 8368 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */, 8367 (PFNRT)i_usbAttachCallback, 9,8369 (PFNRT)i_usbAttachCallback, 10, 8368 8370 this, ptrVM.rawUVM(), aHostDevice, uuid.raw(), fRemote, 8369 Address.c_str(), pvRemoteBackend, portVersion, aMaskedIfs); 8371 Address.c_str(), pvRemoteBackend, portVersion, aMaskedIfs, 8372 aCaptureFilename.isEmpty() ? NULL : aCaptureFilename.c_str()); 8370 8373 if (RT_SUCCESS(vrc)) 8371 8374 { … … 8418 8421 DECLCALLBACK(int) 8419 8422 Console::i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, 8420 const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs) 8423 const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs, 8424 const char *pszCaptureFilename) 8421 8425 { 8422 8426 LogFlowFuncEnter(); … … 8429 8433 aPortVersion == 3 ? VUSB_STDVER_30 : 8430 8434 aPortVersion == 2 ? VUSB_STDVER_11 : VUSB_STDVER_20, 8431 aMaskedIfs );8435 aMaskedIfs, pszCaptureFilename); 8432 8436 LogFlowFunc(("vrc=%Rrc\n", vrc)); 8433 8437 LogFlowFuncLeave(); … … 9053 9057 { 9054 9058 alock.release(); 9055 hrc = i_onUSBDeviceAttach(pUSBDevice, NULL, fMaskedIfs );9059 hrc = i_onUSBDeviceAttach(pUSBDevice, NULL, fMaskedIfs, Utf8Str()); 9056 9060 alock.acquire(); 9057 9061 -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r53012 r53062 3955 3955 RTUuidCreate(&UsbMsd.mUuid); 3956 3956 UsbMsd.iPort = uInstance; 3957 rc = PDMR3UsbCreateEmulatedDevice(pUVM, pcszDevice, pCtlInst, &UsbMsd.mUuid );3957 rc = PDMR3UsbCreateEmulatedDevice(pUVM, pcszDevice, pCtlInst, &UsbMsd.mUuid, NULL); 3958 3958 if (RT_SUCCESS(rc)) 3959 3959 mUSBStorageDevices.push_back(UsbMsd); -
trunk/src/VBox/Main/src-client/EmulatedUSBImpl.cpp
r50580 r53062 171 171 172 172 /* pInstance will be used by PDM and deallocated on error. */ 173 rc = PDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid );173 rc = PDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid, NULL); 174 174 LogRelFlowFunc(("PDMR3UsbCreateEmulatedDevice %Rrc\n", rc)); 175 175 return rc; -
trunk/src/VBox/Main/src-client/SessionImpl.cpp
r52481 r53062 730 730 HRESULT Session::onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice, 731 731 const ComPtr<IVirtualBoxErrorInfo> &aError, 732 ULONG aMaskedInterfaces) 733 { 734 LogFlowThisFunc(("\n")); 735 736 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 737 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 738 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 739 #ifndef VBOX_COM_INPROC_API_CLIENT 740 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 741 742 return mConsole->i_onUSBDeviceAttach(aDevice, aError, aMaskedInterfaces); 732 ULONG aMaskedInterfaces, 733 const com::Utf8Str &aCaptureFilename) 734 { 735 LogFlowThisFunc(("\n")); 736 737 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 738 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 739 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 740 #ifndef VBOX_COM_INPROC_API_CLIENT 741 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 742 743 return mConsole->i_onUSBDeviceAttach(aDevice, aError, aMaskedInterfaces, aCaptureFilename); 743 744 #else 744 745 return S_OK; -
trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
r52743 r53062 312 312 * process, which means it will temporarily release all locks. (Is this a good idea?) 313 313 * 314 * @param aMachine Machine this device should be attach to. 315 * @param aSetError Whether to set full error message or not to bother. 316 * @param aMaskedIfs The interfaces to hide from the guest. 314 * @param aMachine Machine this device should be attach to. 315 * @param aSetError Whether to set full error message or not to bother. 316 * @param aCaptureFilename The filename to capture the USB traffic to. 317 * @param aMaskedIfs The interfaces to hide from the guest. 317 318 * 318 319 * @returns Status indicating whether it was successfully captured and/or attached. … … 321 322 * @retval E_* as appropriate. 322 323 */ 323 HRESULT HostUSBDevice::i_requestCaptureForVM(SessionMachine *aMachine, bool aSetError, ULONG aMaskedIfs /* = 0*/) 324 HRESULT HostUSBDevice::i_requestCaptureForVM(SessionMachine *aMachine, bool aSetError, 325 const com::Utf8Str &aCaptureFilename, ULONG aMaskedIfs /* = 0*/) 324 326 { 325 327 /* … … 377 379 { 378 380 alock.release(); 379 HRESULT hrc = i_attachToVM(aMachine, a MaskedIfs);381 HRESULT hrc = i_attachToVM(aMachine, aCaptureFilename, aMaskedIfs); 380 382 return SUCCEEDED(hrc); 381 383 } … … 396 398 mMachine = aMachine; 397 399 mMaskedIfs = aMaskedIfs; 400 mCaptureFilename = aCaptureFilename; 398 401 alock.release(); 399 402 int rc = mUSBProxyService->captureDevice(this); … … 430 433 * @param aMaskedIfs The interfaces to hide from the guest. 431 434 */ 432 HRESULT HostUSBDevice::i_attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs /* = 0*/) 435 HRESULT HostUSBDevice::i_attachToVM(SessionMachine *aMachine, const com::Utf8Str &aCaptureFilename, 436 ULONG aMaskedIfs /* = 0*/) 433 437 { 434 438 AssertReturn(!isWriteLockOnCurrentThread(), E_FAIL); … … 457 461 LogFlowThisFunc(("{%s} Calling machine->onUSBDeviceAttach()...\n", mName)); 458 462 alock.release(); 459 HRESULT hrc = aMachine->i_onUSBDeviceAttach(d, NULL, aMaskedIfs );463 HRESULT hrc = aMachine->i_onUSBDeviceAttach(d, NULL, aMaskedIfs, aCaptureFilename); 460 464 LogFlowThisFunc(("{%s} Done machine->onUSBDeviceAttach()=%08X\n", mName, hrc)); 461 465 … … 1337 1341 { 1338 1342 alock.release(); 1339 i_attachToVM(mMachine, m MaskedIfs);1343 i_attachToVM(mMachine, mCaptureFilename, mMaskedIfs); 1340 1344 alock.acquire(); 1341 1345 } … … 1475 1479 { 1476 1480 alock.release(); 1477 i_attachToVM(mMachine, m MaskedIfs);1481 i_attachToVM(mMachine, mCaptureFilename, mMaskedIfs); 1478 1482 } 1479 1483 return true; -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r53012 r53062 12784 12784 * @note Locks the same as Host::captureUSBDevice() does. 12785 12785 */ 12786 HRESULT SessionMachine::captureUSBDevice(const com::Guid &aId )12786 HRESULT SessionMachine::captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename) 12787 12787 { 12788 12788 LogFlowThisFunc(("\n")); … … 12796 12796 USBProxyService *service = mParent->i_host()->i_usbProxyService(); 12797 12797 AssertReturn(service, E_FAIL); 12798 return service->captureDeviceForVM(this, aId.ref() );12798 return service->captureDeviceForVM(this, aId.ref(), aCaptureFilename); 12799 12799 #else 12800 12800 NOREF(aId); … … 13814 13814 HRESULT SessionMachine::i_onUSBDeviceAttach(IUSBDevice *aDevice, 13815 13815 IVirtualBoxErrorInfo *aError, 13816 ULONG aMaskedIfs) 13816 ULONG aMaskedIfs, 13817 const com::Utf8Str &aCaptureFilename) 13817 13818 { 13818 13819 LogFlowThisFunc(("\n")); … … 13839 13840 AssertMsg(RTLockValidatorReadLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount(RTThreadSelf()))); 13840 13841 13841 return directControl->OnUSBDeviceAttach(aDevice, aError, aMaskedIfs );13842 return directControl->OnUSBDeviceAttach(aDevice, aError, aMaskedIfs, Bstr(aCaptureFilename).raw()); 13842 13843 } 13843 13844 … … 14393 14394 } 14394 14395 14395 HRESULT Machine::captureUSBDevice(const com::Guid &aId )14396 HRESULT Machine::captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename) 14396 14397 { 14397 14398 NOREF(aId); -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r52934 r53062 166 166 * former case it will temporarily abandon locks because of IPC. 167 167 */ 168 HRESULT USBProxyService::captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId )168 HRESULT USBProxyService::captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId, const com::Utf8Str &aCaptureFilename) 169 169 { 170 170 ComAssertRet(aMachine, E_INVALIDARG); … … 183 183 */ 184 184 alock.release(); 185 return pHostDevice->i_requestCaptureForVM(aMachine, true /* aSetError */ );185 return pHostDevice->i_requestCaptureForVM(aMachine, true /* aSetError */, aCaptureFilename); 186 186 } 187 187 … … 528 528 { 529 529 /* try to capture the device */ 530 HRESULT hrc = aDevice->i_requestCaptureForVM(aMachine, false /* aSetError */, ulMaskedIfs);530 HRESULT hrc = aDevice->i_requestCaptureForVM(aMachine, false /* aSetError */, Utf8Str(), ulMaskedIfs); 531 531 return SUCCEEDED(hrc) 532 532 || hrc == E_UNEXPECTED /* bad device state, give up */; -
trunk/src/VBox/VMM/VMMR3/PDMUsb.cpp
r53031 r53062 458 458 * 459 459 * @returns VBox status code. 460 * @param pVM Pointer to the VM. 461 * @param pUsbDev The USB device emulation. 462 * @param iInstance -1 if not called by pdmR3UsbInstantiateDevices(). 463 * @param pUuid The UUID for this device. 464 * @param ppInstanceNode Pointer to the device instance pointer. This is set to NULL if inserted 465 * into the tree or cleaned up. 466 * 467 * In the pdmR3UsbInstantiateDevices() case (iInstance != -1) this is 468 * the actual instance node and will not be cleaned up. 469 * 470 * @parma iUsbVersion The USB version preferred by the device. 460 * @param pVM Pointer to the VM. 461 * @param pUsbDev The USB device emulation. 462 * @param iInstance -1 if not called by pdmR3UsbInstantiateDevices(). 463 * @param pUuid The UUID for this device. 464 * @param ppInstanceNode Pointer to the device instance pointer. This is set to NULL if inserted 465 * into the tree or cleaned up. 466 * 467 * In the pdmR3UsbInstantiateDevices() case (iInstance != -1) this is 468 * the actual instance node and will not be cleaned up. 469 * 470 * @param iUsbVersion The USB version preferred by the device. 471 * @param pszCaptureFilename Path to the file for USB traffic capturing, optional. 471 472 */ 472 473 static int pdmR3UsbCreateDevice(PVM pVM, PPDMUSBHUB pHub, PPDMUSB pUsbDev, int iInstance, PCRTUUID pUuid, 473 PCFGMNODE *ppInstanceNode, uint32_t iUsbVersion )474 PCFGMNODE *ppInstanceNode, uint32_t iUsbVersion, const char *pszCaptureFilename) 474 475 { 475 476 const bool fAtRuntime = iInstance == -1; … … 629 630 */ 630 631 Log(("PDM: Attaching it...\n")); 631 rc = pHub->Reg.pfnAttachDevice(pHub->pDrvIns, pUsbIns, &pUsbIns->Internal.s.iPort);632 rc = pHub->Reg.pfnAttachDevice(pHub->pDrvIns, pUsbIns, pszCaptureFilename, &pUsbIns->Internal.s.iPort); 632 633 if (RT_SUCCESS(rc)) 633 634 { … … 856 857 */ 857 858 rc = pdmR3UsbCreateDevice(pVM, pHub, paUsbDevs[i].pUsbDev, paUsbDevs[i].iInstance, &paUsbDevs[i].Uuid, 858 &paUsbDevs[i].pNode, iUsbVersion );859 &paUsbDevs[i].pNode, iUsbVersion, NULL); 859 860 if (RT_FAILURE(rc)) 860 861 return rc; … … 872 873 * 873 874 * @returns VBox status code. 874 * @param pUVM The user mode VM handle. 875 * @param pszDeviceName The name of the PDM device to instantiate. 876 * @param pInstanceNode The instance CFGM node. 877 * @param pUuid The UUID to be associated with the device. 875 * @param pUVM The user mode VM handle. 876 * @param pszDeviceName The name of the PDM device to instantiate. 877 * @param pInstanceNode The instance CFGM node. 878 * @param pUuid The UUID to be associated with the device. 879 * @param pszCaptureFilename Path to the file for USB traffic capturing, optional. 878 880 * 879 881 * @thread EMT 880 882 */ 881 VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pInstanceNode, PCRTUUID pUuid) 883 VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pInstanceNode, PCRTUUID pUuid, 884 const char *pszCaptureFilename) 882 885 { 883 886 /* … … 929 932 * Create and attach the device. 930 933 */ 931 rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstanceNode, iUsbVersion );934 rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstanceNode, iUsbVersion, pszCaptureFilename); 932 935 AssertRCReturn(rc, rc); 933 936 … … 943 946 * 944 947 * @returns VBox status code. 945 * @param pUVM The user mode VM handle. 946 * @param pUuid The UUID to be associated with the device. 947 * @param fRemote Whether it's a remove or local device. 948 * @param pszAddress The address string. 949 * @param pvBackend Pointer to the backend. 950 * @param iUsbVersion The preferred USB version. 951 * @param fMaskedIfs The interfaces to hide from the guest. 948 * @param pUVM The user mode VM handle. 949 * @param pUuid The UUID to be associated with the device. 950 * @param fRemote Whether it's a remove or local device. 951 * @param pszAddress The address string. 952 * @param pvBackend Pointer to the backend. 953 * @param iUsbVersion The preferred USB version. 954 * @param fMaskedIfs The interfaces to hide from the guest. 955 * @param pszCaptureFilename Path to the file for USB traffic capturing, optional. 952 956 */ 953 957 VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend, 954 uint32_t iUsbVersion, uint32_t fMaskedIfs )958 uint32_t iUsbVersion, uint32_t fMaskedIfs, const char *pszCaptureFilename) 955 959 { 956 960 /* … … 1017 1021 * Finally, try to create it. 1018 1022 */ 1019 rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstance, iUsbVersion );1023 rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstance, iUsbVersion, pszCaptureFilename); 1020 1024 if (RT_FAILURE(rc) && pInstance) 1021 1025 CFGMR3RemoveNode(pInstance);
Note:
See TracChangeset
for help on using the changeset viewer.