Changeset 2939 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 30, 2007 4:59:36 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 21620
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r2929 r2939 1228 1228 id.toString().raw()); 1229 1229 1230 AutoLock devLock (device); 1231 1230 1232 if (device->state() == USBDeviceState_USBDeviceNotSupported) 1231 1233 return setError (E_INVALIDARG, … … 1274 1276 HRESULT Host::releaseUSBDevice (SessionMachine *aMachine, INPTR GUIDPARAM aId) 1275 1277 { 1278 LogFlowThisFunc (("aMachine=%p, aId={%Vuuid}\n", aMachine, Guid (aId).raw())); 1279 1276 1280 AutoLock lock (this); 1277 1281 CHECK_READY(); … … 1287 1291 1288 1292 ComAssertRet (!!device, E_FAIL); 1293 1294 AutoLock devLock (device); 1295 1289 1296 ComAssertRet (device->machine() == aMachine, E_FAIL); 1290 1297 1291 / / reset the device and apply filters1298 /* reset the device and apply filters */ 1292 1299 int vrc = device->reset(); 1293 1300 ComAssertRCRet (vrc, E_FAIL); … … 1324 1331 { 1325 1332 ComObjPtr <HostUSBDevice> device = *it; 1333 1334 AutoLock devLock (device); 1335 1336 /// @todo remove 1337 #if 0 1326 1338 if (device->isIgnored()) 1327 1339 continue; 1340 #endif 1328 1341 1329 1342 if (device->state() == USBDeviceState_USBDeviceBusy || … … 1373 1386 { 1374 1387 ComObjPtr <HostUSBDevice> device = *it; 1388 1389 AutoLock devLock (device); 1390 1375 1391 if (device->machine() == aMachine) 1376 1392 { … … 1649 1665 SessionMachine *aMachine /* = NULL */) 1650 1666 { 1651 LogFlowMember (("Host::applyAllUSBFilters: \n")); 1667 LogFlowThisFunc (("\n")); 1668 1669 AssertReturn (isLockedOnCurrentThread(), E_FAIL); 1670 1671 AutoLock devLock (aDevice); 1652 1672 1653 1673 /* ignore unsupported devices */ … … 1687 1707 if (aDevice->state() == USBDeviceState_USBDeviceCaptured) 1688 1708 { 1689 / / inform the machine's process about the auto-capture1709 /* inform the VM process about the auto-capture */ 1690 1710 ComPtr <IUSBDevice> d; 1691 1711 aDevice.queryInterfaceTo (d.asOutParam()); 1712 1713 /* the VM process will query the object, so leave the lock */ 1714 devLock.leave(); 1715 1692 1716 HRESULT rc = machines [i]->onUSBDeviceAttach (d); 1693 1717 if (SUCCEEDED(rc)) 1694 1718 return rc; 1695 1719 1696 // the machine rejected it, continue applying filters. 1720 devLock.enter(); 1721 1722 /* the machine rejected it, continue applying filters. */ 1697 1723 aDevice->reset(); 1698 1724 } … … 1731 1757 LogFlowThisFunc (("\n")); 1732 1758 1733 AssertReturn (aMachine, (void) 0); 1734 AssertReturn (aDevice->state() != USBDeviceState_USBDeviceUnavailable, (void) 0); 1759 AssertReturnVoid (isLockedOnCurrentThread()); 1760 AssertReturnVoid (aDevice->isLockedOnCurrentThread()); 1761 1762 AssertReturnVoid (aMachine); 1763 AssertReturnVoid (aDevice->state() != USBDeviceState_USBDeviceUnavailable); 1735 1764 1736 1765 /* We're going to use aMachine which is not our child/parent, add a caller */ … … 1767 1796 void Host::onUSBDeviceAttached (HostUSBDevice *aDevice) 1768 1797 { 1769 LogFlowMember (("Host::onUSBDeviceAttached: aDevice=%p\n", aDevice)); 1798 LogFlowThisFunc (("aDevice=%p\n", aDevice)); 1799 1800 AssertReturnVoid (aDevice); 1801 1770 1802 /// @todo (dmik) check locks 1771 1803 AutoLock alock (this); 1772 1804 1773 // add to the collecion 1805 AutoLock devLock (aDevice); 1806 1807 /* add to the collecion */ 1774 1808 mUSBDevices.push_back (aDevice); 1775 1809 1776 / / apply all filters (no need to lock the device, nobody can access it yet)1777 ComObjPtr <HostUSBDevice> DevPtr(aDevice);1778 HRESULT rc = applyAllUSBFilters ( DevPtr);1810 /* apply all filters */ 1811 ComObjPtr <HostUSBDevice> device (aDevice); 1812 HRESULT rc = applyAllUSBFilters (device); 1779 1813 AssertComRC (rc); 1780 1814 } … … 1788 1822 void Host::onUSBDeviceDetached (HostUSBDevice *aDevice) 1789 1823 { 1790 LogFlowMember (("Host::onUSBDeviceDetached: aDevice=%p\n", aDevice)); 1824 LogFlowThisFunc (("aDevice=%p\n", aDevice)); 1825 1826 AssertReturnVoid (aDevice); 1827 1791 1828 /// @todo (dmik) check locks 1792 1829 AutoLock alock (this); 1830 1831 AutoLock devLock (aDevice); 1793 1832 1794 1833 Guid id = aDevice->id(); … … 1806 1845 } 1807 1846 1808 AssertReturn (!!device, (void) 0);1809 1810 / / remove from the collecion1847 AssertReturnVoid (!!device); 1848 1849 /* remove from the collecion */ 1811 1850 mUSBDevices.erase (it); 1812 1851 1813 1852 if (device->machine()) 1814 1853 { 1815 // the device is captured by a machine, instruct it to release 1816 alock.unlock(); 1854 /* the device is captured by a machine, instruct it to release */ 1855 1856 devLock.leave(); 1857 alock.leave(); 1858 1817 1859 HRESULT rc = device->machine()->onUSBDeviceDetach (device->id()); 1818 1860 AssertComRC (rc); … … 1828 1870 void Host::onUSBDeviceStateChanged (HostUSBDevice *aDevice) 1829 1871 { 1830 LogFlowMember (("Host::onUSBDeviceStateChanged: \n")); 1872 LogFlowThisFunc (("aDevice=%p\n", aDevice)); 1873 1831 1874 /// @todo (dmik) check locks 1832 1875 AutoLock alock (this); -
trunk/src/VBox/Main/HostUSBDeviceImpl.cpp
r2723 r2939 26 26 #include <VBox/err.h> 27 27 28 29 28 // constructor / destructor 30 29 ///////////////////////////////////////////////////////////////////////////// 31 30 32 HostUSBDevice::HostUSBDevice() 33 : mUSBProxyService (NULL), m_pUsb (NULL) 34 { 35 } 36 37 HostUSBDevice::~HostUSBDevice() 38 { 39 if (m_pUsb) 40 { 41 USBProxyService::freeDevice (m_pUsb); 42 m_pUsb = NULL; 43 } 31 DEFINE_EMPTY_CTOR_DTOR (HostUSBDevice) 32 33 HRESULT HostUSBDevice::FinalConstruct() 34 { 35 mUSBProxyService = NULL; 36 mUsb = NULL; 37 38 return S_OK; 39 } 40 41 void HostUSBDevice::FinalRelease() 42 { 43 uninit(); 44 44 } 45 45 … … 60 60 ComAssertRet (aUsb, E_INVALIDARG); 61 61 62 AutoLock alock (this); 62 /* Enclose the state transition NotReady->InInit->Ready */ 63 AutoInitSpan autoInitSpan (this); 64 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 63 65 64 66 /* … … 66 68 * The UUID isn't stored anywhere. 67 69 */ 68 mId.create();70 unconst (mId).create(); 69 71 70 72 /* … … 98 100 } 99 101 100 /* 101 * Other data members. 102 */ 102 mPendingState = mState; 103 104 /* Other data members */ 105 mIsStatePending = false; 106 /// @todo remove 107 #if 0 103 108 mIgnored = false; 109 #endif 104 110 mUSBProxyService = aUSBProxyService; 105 m_pUsb = aUsb; 106 107 setReady (true); 108 return S_OK; 111 mUsb = aUsb; 112 113 /* Confirm the successful initialization */ 114 autoInitSpan.setSucceeded(); 115 116 return S_OK; 117 } 118 119 /** 120 * Uninitializes the instance and sets the ready flag to FALSE. 121 * Called either from FinalRelease() or by the parent when it gets destroyed. 122 */ 123 void HostUSBDevice::uninit() 124 { 125 /* Enclose the state transition Ready->InUninit->NotReady */ 126 AutoUninitSpan autoUninitSpan (this); 127 if (autoUninitSpan.uninitDone()) 128 return; 129 130 if (mUsb != NULL) 131 { 132 USBProxyService::freeDevice (mUsb); 133 mUsb = NULL; 134 } 135 136 mUSBProxyService = NULL; 109 137 } 110 138 … … 112 140 ///////////////////////////////////////////////////////////////////////////// 113 141 114 /**115 * Returns the GUID.116 *117 * @returns COM status code118 * @param aId Address of result variable.119 */120 142 STDMETHODIMP HostUSBDevice::COMGETTER(Id)(GUIDPARAMOUT aId) 121 143 { … … 123 145 return E_INVALIDARG; 124 146 125 AutoLock alock (this); 126 CHECK_READY(); 127 147 AutoCaller autoCaller (this); 148 CheckComRCReturnRC (autoCaller.rc()); 149 150 /* mId is constant during life time, no need to lock */ 128 151 mId.cloneTo (aId); 129 return S_OK; 130 } 131 132 133 /** 134 * Returns the vendor Id. 135 * 136 * @returns COM status code 137 * @param aVendorId Where to store the vendor id. 138 */ 152 153 return S_OK; 154 } 155 139 156 STDMETHODIMP HostUSBDevice::COMGETTER(VendorId)(USHORT *aVendorId) 140 157 { … … 142 159 return E_INVALIDARG; 143 160 144 AutoLock alock (this); 145 CHECK_READY(); 146 147 *aVendorId = m_pUsb->idVendor; 148 return S_OK; 149 } 150 151 152 /** 153 * Returns the product Id. 154 * 155 * @returns COM status code 156 * @param aProductId Where to store the product id. 157 */ 161 AutoCaller autoCaller (this); 162 CheckComRCReturnRC (autoCaller.rc()); 163 164 AutoReaderLock alock (this); 165 166 *aVendorId = mUsb->idVendor; 167 168 return S_OK; 169 } 170 158 171 STDMETHODIMP HostUSBDevice::COMGETTER(ProductId)(USHORT *aProductId) 159 172 { … … 161 174 return E_INVALIDARG; 162 175 163 AutoLock alock (this); 164 CHECK_READY(); 165 166 *aProductId = m_pUsb->idProduct; 167 return S_OK; 168 } 169 170 171 /** 172 * Returns the revision BCD. 173 * 174 * @returns COM status code 175 * @param aRevision Where to store the revision BCD. 176 */ 176 AutoCaller autoCaller (this); 177 CheckComRCReturnRC (autoCaller.rc()); 178 179 AutoReaderLock alock (this); 180 181 *aProductId = mUsb->idProduct; 182 183 return S_OK; 184 } 185 177 186 STDMETHODIMP HostUSBDevice::COMGETTER(Revision)(USHORT *aRevision) 178 187 { … … 180 189 return E_INVALIDARG; 181 190 182 AutoLock alock (this); 183 CHECK_READY(); 184 185 *aRevision = m_pUsb->bcdDevice; 186 return S_OK; 187 } 188 189 /** 190 * Returns the manufacturer string. 191 * 192 * @returns COM status code 193 * @param aManufacturer Where to put the return string. 194 */ 191 AutoCaller autoCaller (this); 192 CheckComRCReturnRC (autoCaller.rc()); 193 194 AutoReaderLock alock (this); 195 196 *aRevision = mUsb->bcdDevice; 197 198 return S_OK; 199 } 200 195 201 STDMETHODIMP HostUSBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer) 196 202 { … … 198 204 return E_INVALIDARG; 199 205 200 AutoLock alock (this); 201 CHECK_READY(); 202 203 Bstr (m_pUsb->pszManufacturer).cloneTo (aManufacturer); 204 return S_OK; 205 } 206 207 208 /** 209 * Returns the product string. 210 * 211 * @returns COM status code 212 * @param aProduct Where to put the return string. 213 */ 206 AutoCaller autoCaller (this); 207 CheckComRCReturnRC (autoCaller.rc()); 208 209 AutoReaderLock alock (this); 210 211 Bstr (mUsb->pszManufacturer).cloneTo (aManufacturer); 212 213 return S_OK; 214 } 215 214 216 STDMETHODIMP HostUSBDevice::COMGETTER(Product)(BSTR *aProduct) 215 217 { … … 217 219 return E_INVALIDARG; 218 220 219 AutoLock alock (this); 220 CHECK_READY(); 221 222 Bstr (m_pUsb->pszProduct).cloneTo (aProduct); 223 return S_OK; 224 } 225 226 227 /** 228 * Returns the serial number string. 229 * 230 * @returns COM status code 231 * @param aSerialNumber Where to put the return string. 232 */ 221 AutoCaller autoCaller (this); 222 CheckComRCReturnRC (autoCaller.rc()); 223 224 AutoReaderLock alock (this); 225 226 Bstr (mUsb->pszProduct).cloneTo (aProduct); 227 228 return S_OK; 229 } 230 233 231 STDMETHODIMP HostUSBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber) 234 232 { … … 236 234 return E_INVALIDARG; 237 235 238 AutoLock alock (this); 239 CHECK_READY(); 240 241 Bstr (m_pUsb->pszSerialNumber).cloneTo (aSerialNumber); 242 return S_OK; 243 } 244 245 /** 246 * Returns the device address string. 247 * 248 * @returns COM status code 249 * @param aAddress Where to put the returned string. 250 */ 236 AutoCaller autoCaller (this); 237 CheckComRCReturnRC (autoCaller.rc()); 238 239 AutoReaderLock alock (this); 240 241 Bstr (mUsb->pszSerialNumber).cloneTo (aSerialNumber); 242 243 return S_OK; 244 } 245 251 246 STDMETHODIMP HostUSBDevice::COMGETTER(Address)(BSTR *aAddress) 252 247 { … … 254 249 return E_INVALIDARG; 255 250 256 AutoLock alock (this); 257 CHECK_READY(); 258 259 Bstr (m_pUsb->pszAddress).cloneTo (aAddress); 251 AutoCaller autoCaller (this); 252 CheckComRCReturnRC (autoCaller.rc()); 253 254 AutoReaderLock alock (this); 255 256 Bstr (mUsb->pszAddress).cloneTo (aAddress); 257 260 258 return S_OK; 261 259 } … … 266 264 return E_INVALIDARG; 267 265 268 AutoLock alock (this); 269 CHECK_READY(); 266 AutoCaller autoCaller (this); 267 CheckComRCReturnRC (autoCaller.rc()); 268 269 AutoReaderLock alock (this); 270 270 271 271 ///@todo implement 272 272 aPort = 0; 273 273 274 return S_OK; 274 275 } … … 279 280 return E_INVALIDARG; 280 281 281 AutoLock alock (this); 282 CHECK_READY(); 282 AutoCaller autoCaller (this); 283 CheckComRCReturnRC (autoCaller.rc()); 284 285 AutoReaderLock alock (this); 283 286 284 287 *aRemote = FALSE; 288 285 289 return S_OK; 286 290 } … … 294 298 return E_POINTER; 295 299 296 AutoLock lock (this); 297 CHECK_READY(); 300 AutoCaller autoCaller (this); 301 CheckComRCReturnRC (autoCaller.rc()); 302 303 AutoReaderLock alock (this); 298 304 299 305 *aState = mState; 306 300 307 return S_OK; 301 308 } … … 305 312 //////////////////////////////////////////////////////////////////////////////// 306 313 314 /** 315 * @note Locks this object for reading. 316 */ 307 317 Utf8Str HostUSBDevice::name() 308 318 { 309 319 Utf8Str name; 310 320 311 AutoLock alock (this); 312 AssertReturn (isReady(), name); 313 314 bool haveManufacturer = m_pUsb->pszManufacturer && *m_pUsb->pszManufacturer; 315 bool haveProduct = m_pUsb->pszProduct && *m_pUsb->pszProduct; 321 AutoCaller autoCaller (this); 322 AssertComRCReturn (autoCaller.rc(), name); 323 324 AutoReaderLock alock (this); 325 326 bool haveManufacturer = mUsb->pszManufacturer && *mUsb->pszManufacturer; 327 bool haveProduct = mUsb->pszProduct && *mUsb->pszProduct; 316 328 if (haveManufacturer && haveProduct) 317 name = Utf8StrFmt ("%s %s", m _pUsb->pszManufacturer,318 m _pUsb->pszProduct);329 name = Utf8StrFmt ("%s %s", mUsb->pszManufacturer, 330 mUsb->pszProduct); 319 331 else if(haveManufacturer) 320 name = Utf8StrFmt ("%s", m _pUsb->pszManufacturer);332 name = Utf8StrFmt ("%s", mUsb->pszManufacturer); 321 333 else if(haveProduct) 322 name = Utf8StrFmt ("%s", m _pUsb->pszManufacturer);334 name = Utf8StrFmt ("%s", mUsb->pszManufacturer); 323 335 else 324 336 name = "<unknown>"; … … 327 339 } 328 340 329 /** Sets the ignored flag and returns the device to the host */ 341 /// @todo remove 342 #if 0 343 /** 344 * Sets the ignored flag and returns the device to the host. 345 * 346 * @note Locks this object for writing. 347 */ 330 348 void HostUSBDevice::setIgnored() 331 349 { 350 AutoCaller autoCaller (this); 351 AssertComRCReturnVoid (autoCaller.rc()); 352 332 353 AutoLock alock (this); 333 AssertReturn (isReady(), (void) 0); 334 335 AssertReturn (!mIgnored, (void) 0); 336 337 mIgnored = false; 354 355 AssertReturnVoid (!mIgnored); 356 357 mIgnored = true; 358 338 359 setHostDriven(); 339 360 } 340 341 /** Requests the capture */ 361 #endif 362 363 /** 364 * @note Locks this object for writing. 365 */ 342 366 bool HostUSBDevice::setCaptured (SessionMachine *aMachine) 343 367 { 344 368 AssertReturn (aMachine, false); 345 369 370 AutoCaller autoCaller (this); 371 AssertComRCReturn (autoCaller.rc(), false); 372 346 373 AutoLock alock (this); 347 AssertReturn (isReady(), false);348 374 349 375 AssertReturn ( … … 353 379 false); 354 380 355 mUSBProxyService->captureDevice (this);356 357 381 mState = USBDeviceState_USBDeviceCaptured; 358 382 mMachine = aMachine; 359 383 384 mUSBProxyService->captureDevice (this); 385 360 386 return true; 361 387 } … … 365 391 * 366 392 * @returns VBox status code. 393 * 394 * @note Locks this object for writing. 367 395 */ 368 396 int HostUSBDevice::setHostDriven() 369 397 { 398 AutoCaller autoCaller (this); 399 AssertComRCReturn (autoCaller.rc(), VERR_INVALID_PARAMETER); 400 370 401 AutoLock alock (this); 371 AssertReturn (isReady(), VERR_INVALID_PARAMETER);372 402 373 403 AssertReturn (mState == USBDeviceState_USBDeviceHeld, VERR_INVALID_PARAMETER); … … 382 412 * 383 413 * @returns VBox status code. 414 * 415 * @note Locks this object for writing. 384 416 */ 385 417 int HostUSBDevice::reset() 386 418 { 419 AutoCaller autoCaller (this); 420 AssertComRCReturn (autoCaller.rc(), VERR_INVALID_PARAMETER); 421 387 422 AutoLock alock (this); 388 AssertReturn (isReady(), VERR_INVALID_PARAMETER);389 423 390 424 mState = USBDeviceState_USBDeviceHeld; 391 425 mMachine.setNull(); 426 /// @todo remove 427 #if 0 392 428 mIgnored = false; 429 #endif 393 430 394 431 /** @todo this operation might fail and cause the device to the reattached with a different address and all that. */ … … 396 433 } 397 434 435 /// @todo remove 436 #if 0 398 437 /** 399 438 * Sets the state of the device, as it was reported by the host. … … 401 440 * 402 441 * @param aState new state 442 * 443 * @note Locks this object for writing. 403 444 */ 404 445 void HostUSBDevice::setHostState (USBDeviceState_T aState) 405 446 { 447 AutoCaller autoCaller (this); 448 AssertComRCReturnVoid (autoCaller.rc()); 449 450 AutoLock alock (this); 451 406 452 AssertReturn ( 407 453 aState == USBDeviceState_USBDeviceUnavailable || … … 422 468 } 423 469 } 470 #endif 424 471 425 472 /** … … 433 480 * USBController::hasMatchingFilter (IUSBDevice *) 434 481 * in the sense of the device matching logic. 482 * 483 * @note Locks this object for reading. 435 484 */ 436 485 bool HostUSBDevice::isMatch (const USBDeviceFilter::Data &aData) 437 486 { 438 AutoLock alock (this); 439 AssertReturn (isReady(), false); 487 AutoCaller autoCaller (this); 488 AssertComRCReturn (autoCaller.rc(), false); 489 490 AutoReaderLock alock (this); 440 491 441 492 if (!aData.mActive) 442 493 return false; 443 494 444 if (!aData.mVendorId.isMatch (m _pUsb->idVendor))495 if (!aData.mVendorId.isMatch (mUsb->idVendor)) 445 496 { 446 497 LogFlowMember (("HostUSBDevice::isMatch: vendor not match %04X\n", 447 m _pUsb->idVendor));498 mUsb->idVendor)); 448 499 return false; 449 500 } 450 if (!aData.mProductId.isMatch (m _pUsb->idProduct))501 if (!aData.mProductId.isMatch (mUsb->idProduct)) 451 502 { 452 503 LogFlowMember (("HostUSBDevice::isMatch: product id not match %04X\n", 453 m _pUsb->idProduct));504 mUsb->idProduct)); 454 505 return false; 455 506 } 456 if (!aData.mRevision.isMatch (m _pUsb->bcdDevice))507 if (!aData.mRevision.isMatch (mUsb->bcdDevice)) 457 508 { 458 509 LogFlowMember (("HostUSBDevice::isMatch: rev not match %04X\n", 459 m _pUsb->bcdDevice));510 mUsb->bcdDevice)); 460 511 return false; 461 512 } … … 463 514 #if !defined (__WIN__) 464 515 // these filters are temporarily ignored on Win32 465 if (!aData.mManufacturer.isMatch (Bstr (m _pUsb->pszManufacturer)))466 return false; 467 if (!aData.mProduct.isMatch (Bstr (m _pUsb->pszProduct)))468 return false; 469 if (!aData.mSerialNumber.isMatch (Bstr (m _pUsb->pszSerialNumber)))516 if (!aData.mManufacturer.isMatch (Bstr (mUsb->pszManufacturer))) 517 return false; 518 if (!aData.mProduct.isMatch (Bstr (mUsb->pszProduct))) 519 return false; 520 if (!aData.mSerialNumber.isMatch (Bstr (mUsb->pszSerialNumber))) 470 521 return false; 471 522 /// @todo (dmik) pusPort is yet absent 472 // if (!aData.mPort.isMatch (Bstr (m _pUsb->pusPort)))523 // if (!aData.mPort.isMatch (Bstr (mUsb->pusPort))) 473 524 // return false; 474 525 #endif … … 504 555 * If all the criteria is empty, devices which are used by the host will not match. 505 556 */ 506 if ( m _pUsb->enmState == USBDEVICESTATE_USED_BY_HOST_CAPTURABLE557 if ( mUsb->enmState == USBDEVICESTATE_USED_BY_HOST_CAPTURABLE 507 558 && aData.mVendorId.string().isEmpty() 508 559 && aData.mProductId.string().isEmpty() … … 529 580 int HostUSBDevice::compare (PCUSBDEVICE pDev2) 530 581 { 531 return compare (m _pUsb, pDev2);582 return compare (mUsb, pDev2); 532 583 } 533 584 … … 564 615 * 565 616 * @param aDev The current device state as seen by the proxy backend. 617 * 618 * @note Locks this object for writing. 566 619 */ 567 620 bool HostUSBDevice::updateState (PCUSBDEVICE aDev) 568 621 { 622 AutoCaller autoCaller (this); 623 AssertComRCReturn (autoCaller.rc(), false); 624 569 625 AutoLock alock (this); 570 626 -
trunk/src/VBox/Main/include/HostUSBDeviceImpl.h
r1 r2939 25 25 #include "VirtualBoxBase.h" 26 26 #include "USBDeviceFilterImpl.h" 27 /* #include "USBProxyService.h" circular on Host/HostUSBDevice, the includer must include this. */ 27 /* #include "USBProxyService.h" circular on Host/HostUSBDevice, the includer 28 * must include this. */ 28 29 #include "Collection.h" 29 30 … … 34 35 35 36 /** 36 * Object class used for the Host USBDevices property.37 * Object class used to hold Host USB Device properties. 37 38 */ 38 39 class ATL_NO_VTABLE HostUSBDevice : 40 public VirtualBoxBaseNEXT, 39 41 public VirtualBoxSupportErrorInfoImpl <HostUSBDevice, IHostUSBDevice>, 40 42 public VirtualBoxSupportTranslation <HostUSBDevice>, 41 public VirtualBoxBase,42 43 public IHostUSBDevice 43 44 { 44 45 public: 45 46 46 HostUSBDevice(); 47 virtual ~HostUSBDevice(); 47 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HostUSBDevice) 48 48 49 49 DECLARE_NOT_AGGREGATABLE(HostUSBDevice) … … 59 59 NS_DECL_ISUPPORTS 60 60 61 DECLARE_EMPTY_CTOR_DTOR (HostUSBDevice) 62 63 HRESULT FinalConstruct(); 64 void FinalRelease(); 65 61 66 // public initializer/uninitializer for internal purposes only 62 67 HRESULT init(PUSBDEVICE aUsb, USBProxyService *aUSBProxyService); 68 void uninit(); 63 69 64 70 // IUSBDevice properties … … 79 85 // public methods only for internal purposes 80 86 81 const Guid &id() { return mId; } 82 USBDeviceState_T state() { return mState; } 87 /* @note Must be called from under the object read lock. */ 88 const Guid &id() const { return mId; } 89 90 /* @note Must be called from under the object read lock. */ 91 USBDeviceState_T state() const { return mState; } 92 93 /* @note Must be called from under the object read lock. */ 94 USBDeviceState_T pendingState() const { return mPendingState; } 95 96 /* @note Must be called from under the object read lock. */ 83 97 ComObjPtr <SessionMachine, ComWeakRef> &machine() { return mMachine; } 98 99 /// @todo remove 100 #if 0 101 /* @note Must be called from under the object read lock. */ 84 102 bool isIgnored() { return mIgnored; } 103 #endif 104 105 /* @note Must be called from under the object read lock. */ 106 bool isStatePending() const { return mIsStatePending; } 107 108 /* @note Must be called from under the object read lock. */ 109 PCUSBDEVICE usbData() const { return mUsb; } 85 110 86 111 Utf8Str name(); 87 112 113 /// @todo remove 114 #if 0 88 115 void setIgnored(); 116 #endif 117 89 118 bool setCaptured (SessionMachine *aMachine); 90 119 int setHostDriven(); 91 120 int reset(); 92 121 122 /// @todo remove 123 #if 0 93 124 void setHostState (USBDeviceState_T aState); 125 #endif 94 126 95 127 bool isMatch (const USBDeviceFilter::Data &aData); … … 105 137 private: 106 138 107 Guid mId;139 const Guid mId; 108 140 USBDeviceState_T mState; 141 USBDeviceState_T mPendingState; 109 142 ComObjPtr <SessionMachine, ComWeakRef> mMachine; 110 bool mIgnored; 143 bool mIsStatePending : 1; 144 /// @todo remove 145 #if 0 146 bool mIgnored : 1; 147 #endif 148 111 149 /** Pointer to the USB Proxy Service instance. */ 112 150 USBProxyService *mUSBProxyService; … … 114 152 /** Pointer to the USB Device structure owned by this device. 115 153 * Only used for host devices. */ 116 PUSBDEVICE m _pUsb;154 PUSBDEVICE mUsb; 117 155 }; 118 156
Note:
See TracChangeset
for help on using the changeset viewer.