USBControllerImpl.cpp revision 0e8c50543ddbb0f538ed7b2ff4f08208291509bf
///////////////////////////////////////////////////////////////////////////// * Initializes the USB controller object. * @returns COM result indicator. * @param aParent Pointer to our parent object. /* Enclose the state transition NotReady->InInit->Ready */ /* Confirm a successful initialization */ * Initializes the USB controller object given another USB controller object * (a kind of copy constructor). This object shares data with * the object passed as an argument. * @returns COM result indicator. * @param aParent Pointer to our parent object. * @param aPeer The object to share. * @note This object must be destroyed before the original object * it shares data with is destroyed. /* Enclose the state transition NotReady->InInit->Ready */ /* create copies of all filters */ #
endif /* VBOX_WITH_USB */ /* Confirm a successful initialization */ * Initializes the USB controller object given another guest object * (a kind of copy constructor). This object makes a private copy of data * of the original object passed as an argument. /* Enclose the state transition NotReady->InInit->Ready */ /* create private copies of all filters */ #
endif /* VBOX_WITH_USB */ /* Confirm a successful initialization */ * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. /* Enclose the state transition Ready->InUninit->NotReady */ /* uninit all filters (including those still referenced by clients) */ // IUSBController properties ///////////////////////////////////////////////////////////////////////////// /* the machine needs to be mutable */ /* leave the lock for safety */ /* the machine needs to be mutable */ /* leave the lock for safety */ /* not accessing data -- no need to lock */ /** @todo This is no longer correct */ * Fake class for build without USB. * We need an empty collection & enum for deviceFilters, that's all. // IUSBDeviceFilter properties #
endif /* !VBOX_WITH_USB */// IUSBController methods ///////////////////////////////////////////////////////////////////////////// /* the machine needs to be mutable */ /* the machine needs to be mutable */ tr (
"The given USB device filter is not created within " "this VirtualBox instance"));
tr (
"The given USB device filter is already in the list"));
/* backup the list before modification */ /* iterate to the position... */ /* notify the proxy (only when it makes sense) */ #
else /* VBOX_WITH_USB */#
endif /* VBOX_WITH_USB */ /* the machine needs to be mutable */ tr (
"The USB device filter list is empty"));
tr (
"Invalid position: %lu (must be in range [0, %lu])"),
/* backup the list before modification */ /* iterate to the position... */ /* ...get an element from there... */ /* cancel sharing (make an independent copy of data) */ /* notify the proxy (only when it makes sense) */ #
else /* VBOX_WITH_USB */#
endif /* VBOX_WITH_USB */// public methods only for internal purposes ///////////////////////////////////////////////////////////////////////////// * Loads settings from the given machine node. * May be called once right after this object creation. * @param aMachineNode <Machine> node. * @note Locks this object for writing. /* Note: we assume that the default values for attributes of optional * nodes are assigned in the Data::Data() constructor and don't do it * here. It implies that this method may only be called after constructing * a new BIOSSettings object while all its data fields are in the default * values. Exceptions are fields whose creation time defaults don't match * values that should be applied when these fields are not explicitly set * in the settings file (for backwards compatibility reasons). This takes * place when a setting of a newly created object must default to A while * the same setting of an object loaded from the old settings file must /* USB Controller node (required) */ /* enabledEhci (optiona, defaults to false) */ /* error info is set by init() when appropriate */ #
endif /* VBOX_WITH_USB */ * Saves settings to the given machine node. * @param aMachineNode <Machine> node. * @note Locks this object for reading. /* first, delete the entry */ #
endif /* VBOX_WITH_USB *//** @note Locks objects for reading! */ /* see whether any of filters has changed its data */ #
endif /* VBOX_WITH_USB *//** @note Locks objects for reading! */ /* see whether any of filters has changed its data */ /* Make copies to speed up comparison */ #
endif /* VBOX_WITH_USB *//** @note Locks objects for writing! */ /* we need the machine state */ /* we need to check all data to see whether anything will be changed /* uninitialize all new filters (absent in the backed up list) */ /* notify the proxy (only when it makes sense) */ /* find all removed old filters (absent in the new list) * and insert them back to the USB proxy */ /* notify the proxy (only when necessary) */ /* here we don't depend on the machine state any more */ /* rollback any changes to filters after restoring the list */ /* call this to notify the USB proxy about changes */ #
endif /* VBOX_WITH_USB */ * @note Locks this object for writing, together with the peer object (also * for writing) if there is one. /* lock both for writing since we modify both (mPeer is "master" so locked /* attach new data to the peer and reshare it */ /* apply changes to peer */ /* commit all changes to new filters (this will reshare data with * peers for those who have peers) */ /* look if this filter has a peer filter */ /* no peer means the filter is a newly created one; * create a peer owning data this filter share it with */ /* remove peer from the old list */ /* and add it to the new list */ /* uninit old peer's filters that are left */ /* attach new list of filters to our peer */ /* we have no peer (our parent is the newly created machine); * just commit changes to filters */ /* the list of filters itself is not changed, * just commit changes to filters themselves */ #
endif /* VBOX_WITH_USB */ * @note Locks this object for writing, together with the peer object * represented by @a aThat (locked for reading). /* Machine::copyFrom() may not be called when the VM is running */ /* peer is not modified, lock it for reading (aThat is "master" so locked /* this will back up current data */ /* Note that we won't inform the USB proxy about new filters since the VM is * not running when we are here and therefore no need to do so */ /* create private copies of all filters */ #
endif /* VBOX_WITH_USB */ * Called by setter methods of all USB device filters. /* we need the machine state */ /* nothing to do if the machine isn't running */ /* we don't modify our data fields -- no need to lock */ /* update the filter in the proxy */ * Returns true if the given USB device matches to at least one of * this controller's USB device filters. * A HostUSBDevice specific version. * @note Locks this object for reading. /* Disabled USB controllers cannot actually work with USB devices */ * Returns true if the given USB device matches to at least one of * this controller's USB device filters. * A generic version that accepts any IUSBDevice on input. * This method MUST correlate with HostUSBDevice::isMatch() * in the sense of the device matching logic. * @note Locks this object for reading. /* Disabled USB controllers cannot actually work with USB devices */ * Notifies the proxy service about all filters as requested by the * @a aInsertFilters argument. * @param aInsertFilters @c true to insert filters, @c false to remove. * @note Locks this object for reading. /* notify the proxy (only if the filter is active) */ /* It's possible that the given filter was not inserted the proxy * when this method gets called (as a result of an early VM * process crash for example. So, don't assert that ID != NULL. */ #
endif /* VBOX_WITH_USB *////////////////////////////////////////////////////////////////////////////// /* vi: set tabstop=4 shiftwidth=4 expandtab: */