Changeset 41528 in vbox for trunk/src/VBox/Main/src-server/darwin
- Timestamp:
- May 31, 2012 4:48:33 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 78291
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/darwin/USBProxyServiceDarwin.cpp
r37599 r41528 5 5 6 6 /* 7 * Copyright (C) 200 6-2010Oracle Corporation7 * Copyright (C) 2005-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 39 39 * Initialize data members. 40 40 */ 41 USBProxyServiceDarwin::USBProxyServiceDarwin 42 : USBProxyService (aHost), mServiceRunLoopRef (NULL), mNotifyOpaque (NULL), mWaitABitNextTime (false), mUSBLibInitialized(false)41 USBProxyServiceDarwin::USBProxyServiceDarwin(Host *aHost) 42 : USBProxyService(aHost), mServiceRunLoopRef(NULL), mNotifyOpaque(NULL), mWaitABitNextTime(false), mUSBLibInitialized(false) 43 43 { 44 44 LogFlowThisFunc(("aHost=%p\n", aHost)); … … 101 101 102 102 #ifdef VBOX_WITH_NEW_USB_CODE_ON_DARWIN 103 void *USBProxyServiceDarwin::insertFilter 104 { 105 return USBLibAddFilter 106 } 107 108 109 void USBProxyServiceDarwin::removeFilter 110 { 111 USBLibRemoveFilter 103 void *USBProxyServiceDarwin::insertFilter(PCUSBFILTER aFilter) 104 { 105 return USBLibAddFilter(aFilter); 106 } 107 108 109 void USBProxyServiceDarwin::removeFilter(void *aId) 110 { 111 USBLibRemoveFilter(aId); 112 112 } 113 113 #endif /* VBOX_WITH_NEW_USB_CODE_ON_DARWIN */ … … 120 120 */ 121 121 AssertReturn(aDevice, VERR_GENERAL_FAILURE); 122 AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 123 124 AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS); 122 125 LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str())); 123 AssertReturn(aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 126 124 127 Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing); 125 128 … … 129 132 */ 130 133 ASMAtomicWriteBool(&mFakeAsync, true); 134 devLock.release(); 131 135 interruptWait(); 132 136 return VINF_SUCCESS; … … 161 165 void USBProxyServiceDarwin::captureDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess) 162 166 { 167 AssertReturnVoid(aDevice->isWriteLockOnCurrentThread()); 163 168 #ifdef VBOX_WITH_NEW_USB_CODE_ON_DARWIN 164 169 /* … … 179 184 */ 180 185 AssertReturn(aDevice, VERR_GENERAL_FAILURE); 186 AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 187 188 AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS); 181 189 LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str())); 182 AssertReturn(aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 190 183 191 Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost); 184 192 … … 188 196 */ 189 197 ASMAtomicWriteBool(&mFakeAsync, true); 198 devLock.release(); 190 199 interruptWait(); 191 200 return VINF_SUCCESS; … … 222 231 void USBProxyServiceDarwin::releaseDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess) 223 232 { 233 AssertReturnVoid(aDevice->isWriteLockOnCurrentThread()); 224 234 #ifdef VBOX_WITH_NEW_USB_CODE_ON_DARWIN 225 235 /* … … 234 244 235 245 246 /** @todo unused */ 236 247 void USBProxyServiceDarwin::detachingDevice(HostUSBDevice *aDevice) 237 248 { 238 249 #ifndef VBOX_WITH_NEW_USB_CODE_ON_DARWIN 239 aDevice->setLogicalReconnect 250 aDevice->setLogicalReconnect(HostUSBDevice::kDetachingPendingDetach); 240 251 #else 241 252 NOREF(aDevice); … … 246 257 bool USBProxyServiceDarwin::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine) 247 258 { 259 AssertReturn(aDevice, false); 260 AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false); 248 261 #ifndef VBOX_WITH_NEW_USB_CODE_ON_DARWIN 249 262 /* We're faking async state stuff. */ … … 264 277 #endif 265 278 266 SInt32 rc = CFRunLoopRunInMode(CFSTR 279 SInt32 rc = CFRunLoopRunInMode(CFSTR(VBOX_IOKIT_MODE_STRING), 267 280 mWaitABitNextTime && aMillies >= 1000 268 281 ? 1.0 /* seconds */ … … 277 290 278 291 279 int USBProxyServiceDarwin::interruptWait 292 int USBProxyServiceDarwin::interruptWait(void) 280 293 { 281 294 if (mServiceRunLoopRef) 282 CFRunLoopStop 295 CFRunLoopStop(mServiceRunLoopRef); 283 296 return 0; 284 297 } 285 298 286 299 287 PUSBDEVICE USBProxyServiceDarwin::getDevices 300 PUSBDEVICE USBProxyServiceDarwin::getDevices(void) 288 301 { 289 302 /* call iokit.cpp */ … … 292 305 293 306 294 void USBProxyServiceDarwin::serviceThreadInit 307 void USBProxyServiceDarwin::serviceThreadInit(void) 295 308 { 296 309 mServiceRunLoopRef = CFRunLoopGetCurrent(); … … 299 312 300 313 301 void USBProxyServiceDarwin::serviceThreadTerm 302 { 303 DarwinUnsubscribeUSBNotifications 314 void USBProxyServiceDarwin::serviceThreadTerm(void) 315 { 316 DarwinUnsubscribeUSBNotifications(mNotifyOpaque); 304 317 mServiceRunLoopRef = NULL; 305 318 } … … 311 324 * @param pCur The USB device to free. 312 325 */ 313 void DarwinFreeUSBDeviceFromIOKit 314 { 315 USBProxyService::freeDevice 316 } 317 326 void DarwinFreeUSBDeviceFromIOKit(PUSBDEVICE pCur) 327 { 328 USBProxyService::freeDevice(pCur); 329 } 330
Note:
See TracChangeset
for help on using the changeset viewer.