USBControllerImpl.cpp revision b2d4f6bf23145251a0ed30b6599e2d5c6a148469
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Implementation of IUSBController.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (C) 2006-2010 Oracle Corporation
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/////////////////////////////////////////////////////////////////////////////
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef std::list< ComObjPtr<USBDeviceFilter> > DeviceFilterList;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync // peer machine's USB controller
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync // the following fields need special backup/rollback/commit handling,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync // so they cannot be a part of BackupableData
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// constructor / destructor
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/////////////////////////////////////////////////////////////////////////////
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// public initializer/uninitializer for internal purposes only
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/////////////////////////////////////////////////////////////////////////////
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Initializes the USB controller object.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @returns COM result indicator.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param aParent Pointer to our parent object.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Enclose the state transition NotReady->InInit->Ready */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* mPeer is left null */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Confirm a successful initialization */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Initializes the USB controller object given another USB controller object
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * (a kind of copy constructor). This object shares data with
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * the object passed as an argument.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @returns COM result indicator.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param aParent Pointer to our parent object.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param aPeer The object to share.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @note This object must be destroyed before the original object
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * it shares data with is destroyed.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncHRESULT USBController::init(Machine *aParent, USBController *aPeer)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync LogFlowThisFunc(("aParent=%p, aPeer=%p\n", aParent, aPeer));
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Enclose the state transition NotReady->InInit->Ready */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync AutoWriteLock thatlock(aPeer COMMA_LOCKVAL_SRC_POS);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* create copies of all filters */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync DeviceFilterList::const_iterator it = aPeer->m->llDeviceFilters->begin();
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#endif /* VBOX_WITH_USB */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Confirm a successful initialization */
#ifdef VBOX_WITH_USB
++ it;
return S_OK;
#ifdef VBOX_WITH_USB
++it)
m = NULL;
return S_OK;
return S_OK;
return S_OK;
return S_OK;
#ifdef VBOX_WITH_USB
*aEnabled = true;
*aEnabled = false;
return S_OK;
return S_OK;
#ifndef VBOX_WITH_USB
public VirtualBoxBase,
STDMETHODIMP USBController::COMGETTER(DeviceFilters) (ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters))
#ifdef VBOX_WITH_USB
return S_OK;
# ifndef RT_OS_WINDOWS
#ifdef VBOX_WITH_USB
return S_OK;
#ifdef VBOX_WITH_USB
return S_OK;
#ifdef VBOX_WITH_USB
return S_OK;
#ifdef VBOX_WITH_USB
++it)
return S_OK;
#ifdef VBOX_WITH_USB
++it)
return S_OK;
#ifdef VBOX_WITH_USB
++ it;
++ it;
++it;
if (m->pPeer)
#ifdef VBOX_WITH_USB
bool commitFilters = false;
if (m->pPeer)
if (!peer)
++ it;
++ it;
commitFilters = true;
commitFilters = true;
if (commitFilters)
++ it;
#ifdef VBOX_WITH_USB
++ it)
#ifdef VBOX_WITH_USB
return S_OK;
if (aActiveChanged)
return S_OK;
++ it)
USBFilterSetStringExact (&dev, USBFILTERIDX_SERIAL_NUMBER_STR, Utf8Str(serialNumber).c_str(), true);
bool match = false;
++ it)
match = true;
return match;
if (aInsertFilters)
++ it;
return S_OK;
return m->pParent;