- Timestamp:
- May 31, 2007 7:37:43 PM (18 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/USBProxyService.h
r676 r2967 65 65 66 66 /** 67 * A VM is releas eing a device back to be held or assigned to another VM.67 * A VM is releasing a device back to be held or assigned to another VM. 68 68 * A port reset should be performed. 69 69 * -
trunk/src/VBox/Main/USBProxyService.cpp
r2587 r2967 224 224 * Device still there, update the state and move on. 225 225 */ 226 if ( DevPtr->updateState (pDevices))226 if (updateDeviceState (DevPtr, pDevices)) 227 227 mHost->onUSBDeviceStateChanged (DevPtr); 228 228 It++; … … 230 230 pDevices = pDevices->pNext; /* treated as singly linked */ 231 231 freeDevice (pFree); 232 /** @todo detect status changes! */233 232 } 234 233 else … … 255 254 { 256 255 /* 257 * DevPtr was detached .256 * DevPtr was detached, unless there is a pending async request. 258 257 */ 259 It = mDevices.erase (It); 260 mHost->onUSBDeviceDetached (DevPtr); 261 Log (("USBProxyService::processChanges: detached %p\n", (HostUSBDevice *)DevPtr)); /** @todo add details .*/ 258 /** @todo add a timeout here. */ 259 if (!DevPtr->isStatePendingUnlocked()) 260 { 261 It = mDevices.erase (It); 262 mHost->onUSBDeviceDetached (DevPtr); 263 Log (("USBProxyService::processChanges: detached %p\n", (HostUSBDevice *)DevPtr)); /** @todo add details .*/ 264 } 265 /* else: operation pending */ 262 266 } 263 267 } … … 372 376 373 377 378 bool USBProxyService::updateDeviceStateFake (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice) 379 { 380 if (aDevice->isStatePendingUnlocked()) 381 { 382 switch (aDevice->pendingStateUnlocked()) 383 { 384 case USBDeviceState_USBDeviceCaptured: aUSBDevice->enmState = USBDEVICESTATE_USED_BY_GUEST; break; 385 case USBDeviceState_USBDeviceHeld: aUSBDevice->enmState = USBDEVICESTATE_HELD_BY_PROXY; break; 386 case USBDeviceState_USBDeviceAvailable: aUSBDevice->enmState = USBDEVICESTATE_UNUSED; break; 387 case USBDeviceState_USBDeviceUnavailable: aUSBDevice->enmState = USBDEVICESTATE_USED_BY_HOST; break; 388 case USBDeviceState_USBDeviceBusy: aUSBDevice->enmState = USBDEVICESTATE_USED_BY_HOST_CAPTURABLE; break; 389 default: 390 AssertMsgFailed(("%d\n", aDevice->pendingStateUnlocked())); 391 break; 392 } 393 } 394 395 return USBProxyService::updateDeviceState (aDevice, aUSBDevice); 396 } 397 398 374 399 375 400 /* Stubs which the host specific classes overrides: */ … … 443 468 } 444 469 470 471 bool USBProxyService::updateDeviceState (HostUSBDevice *pDevice, PUSBDEVICE pUSBDevice) 472 { 473 return pDevice->updateState (pUSBDevice); 474 } 475 -
trunk/src/VBox/Main/include/HostUSBDeviceImpl.h
r2939 r2967 91 91 USBDeviceState_T state() const { return mState; } 92 92 93 /** Same as state() except you don't need to lock any thing. */ 94 USBDeviceState_T stateUnlocked() const 95 { 96 AutoReaderLock (this); 97 return state(); 98 } 99 93 100 /* @note Must be called from under the object read lock. */ 94 101 USBDeviceState_T pendingState() const { return mPendingState; } 95 102 103 /** Same as pendingState() except you don't need to lock any thing. */ 104 USBDeviceState_T pendingStateUnlocked() const 105 { 106 AutoReaderLock (this); 107 return pendingState(); 108 } 109 96 110 /* @note Must be called from under the object read lock. */ 97 111 ComObjPtr <SessionMachine, ComWeakRef> &machine() { return mMachine; } … … 105 119 /* @note Must be called from under the object read lock. */ 106 120 bool isStatePending() const { return mIsStatePending; } 121 122 /** Same as isStatePending() except you don't need to lock any thing. */ 123 bool isStatePendingUnlocked() const 124 { 125 AutoReaderLock (this); 126 return isStatePending(); 127 } 107 128 108 129 /* @note Must be called from under the object read lock. */ -
trunk/src/VBox/Main/include/USBProxyService.h
r2853 r2967 84 84 85 85 /** 86 * Updates the device state. 87 * This is responsible for calling HostUSBDevice::updateState() and check for async completion. 88 * 89 * @returns true if there is a state change. 90 * @param pDevice The device in question. 91 * @param pUSBDevice The USB device structure for the last enumeration. 92 */ 93 virtual bool updateDeviceState (HostUSBDevice *pDevice, PUSBDEVICE pUSBDevice); 94 95 /** 86 96 * Query if the service is active and working. 87 97 * … … 150 160 151 161 /** 152 * First call made on the service thread, use it to do 162 * First call made on the service thread, use it to do 153 163 * thread initialization. 154 164 */ … … 156 166 157 167 /** 158 * First call made on the service thread, use it to do 168 * First call made on the service thread, use it to do 159 169 * thread termination. 160 170 */ 161 171 virtual void serviceThreadTerm (void); 172 173 /** 174 * Implement fake capture, ++. 175 * 176 * @returns true if there is a state change. 177 * @param pDevice The device in question. 178 * @param pUSBDevice The USB device structure for the last enumeration. 179 */ 180 bool updateDeviceStateFake (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice); 181 162 182 163 183 public: … … 223 243 virtual int releaseDevice (HostUSBDevice *aDevice); 224 244 virtual int resetDevice (HostUSBDevice *aDevice); 245 virtual bool updateDeviceState (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice); 225 246 226 247 protected: … … 232 253 233 254 private: 234 /** Reference to the runloop of the service thread. 255 /** Reference to the runloop of the service thread. 235 256 * This is NULL if the service thread isn't running. */ 236 257 CFRunLoopRef mServiceRunLoopRef; 237 258 /** The opaque value returned by DarwinSubscribeUSBNotifications. */ 238 259 void *mNotifyOpaque; 239 /** A hack to work around the problem with the usb device enumeration 260 /** A hack to work around the problem with the usb device enumeration 240 261 * not including newly attached devices. */ 241 262 bool mWaitABitNextTime; … … 260 281 virtual int releaseDevice (HostUSBDevice *aDevice); 261 282 virtual int resetDevice (HostUSBDevice *aDevice); 283 virtual bool updateDeviceState (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice); 262 284 263 285 protected: … … 298 320 virtual int releaseDevice (HostUSBDevice *aDevice); 299 321 virtual int resetDevice (HostUSBDevice *aDevice); 322 virtual bool updateDeviceState (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice); 300 323 301 324 protected:
Note:
See TracChangeset
for help on using the changeset viewer.