Changeset 3664 in vbox for trunk/src/VBox
- Timestamp:
- Jul 17, 2007 4:21:29 AM (18 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostUSBDeviceImpl.cpp
r3566 r3664 612 612 /* couldn't capture the device, will report an error */ 613 613 wasCapture = true; 614 614 615 615 Assert (!mMachine.isNull()); 616 616 617 617 /// @todo more detailed error message depending on the state? 618 618 // probably need some error code/string from the USB proxy itself 619 619 620 620 requestRC = E_FAIL; 621 621 errorText = Utf8StrFmt ( … … 630 630 { 631 631 Assert (mMachine.isNull()); 632 632 633 633 if (mState == USBDeviceState_USBDeviceHeld) 634 634 { … … 674 674 675 675 /* 676 * The device has reappeared while the detach operation is still in 676 * The device has reappeared while the detach operation is still in 677 677 * progress, just clear the pending operation and leave the machine as is. 678 678 */ … … 787 787 case kDetachingPendingAttach: 788 788 case kDetachingPendingAttachFilters: 789 LogFlowThisFunc (("cancelling reattach in state %d\n", mPendingStateEx)); 789 790 mMachine.setNull(); 790 791 mPendingStateEx = kNothingPending; … … 943 944 bool aIsStrict /* = true */) 944 945 { 945 /* The non-strict checks tries as best as it can to distiguish between 946 /* The non-strict checks tries as best as it can to distiguish between 946 947 different physical devices of the same product. Unfortunately this 947 948 isn't always possible and we might end up a bit confused in rare cases... */ … … 1107 1108 case USBDeviceState_USBDeviceAvailable: 1108 1109 return false; 1109 #ifdef __LINUX__ /* Hack for /proc/bus/usb/devices not necessarily putting up a driver. */ 1110 #if defined(RT_OS_LINUX) /* Hack for /proc/bus/usb/devices not necessarily putting up a driver. */ \ 1111 || defined(RT_OS_DARWIN) /* We're a bit clueless as to the exact device state, just like linux. */ 1110 1112 case USBDeviceState_USBDeviceCaptured: 1111 if (!mIsStatePending) 1113 if ( !mIsStatePending 1114 || mPendingStateEx != kNothingPending) 1112 1115 return false; 1113 1116 isImportant = true; … … 1134 1137 case USBDeviceState_USBDeviceHeld: 1135 1138 return false; 1136 #ifdef __WIN__1137 1139 case USBDeviceState_USBDeviceCaptured: 1138 1140 if (!mIsStatePending) 1139 1141 return false; 1140 1142 /* no break */ 1141 #endif1142 1143 default: 1143 1144 LogFlowThisFunc (("%d -> %d\n", … … 1177 1178 /** 1178 1179 * Checks for timeout of any pending async operation. 1179 * 1180 * The caller must write lock the object prior to calling 1180 * 1181 * The caller must write lock the object prior to calling 1181 1182 * this method. 1182 1183 */ … … 1200 1201 } 1201 1202 1202 /** 1203 * This method is called by the USB proxy and Host to work the 1203 /** 1204 * This method is called by the USB proxy and Host to work the 1204 1205 * logical reconnection operation. 1205 * 1206 * 1206 1207 * @param aStage kDeatchingPendingDetach, kDeatchingPendingDetachFilters, 1207 1208 * kDetachingPendingAttach or kDetachingPendingAttachFilters. 1208 * 1209 * 1209 1210 * @returns Success indicator. 1210 1211 */ … … 1220 1221 mIsStatePending = true; 1221 1222 mPendingSince = RTTimeNanoTS(); 1223 LogFlowThisFunc (("pending detach\n")); 1222 1224 break; 1223 1225 … … 1225 1227 AssertReturn (mIsStatePending, false); 1226 1228 AssertReturn (mPendingStateEx == kDetachingPendingDetach, false); 1229 LogFlowThisFunc (("pending detach+filters\n")); 1227 1230 break; 1228 1231 … … 1230 1233 AssertReturn (mIsStatePending, false); 1231 1234 AssertReturn (mPendingStateEx == kDetachingPendingDetach, false); 1235 LogFlowThisFunc (("pending attach\n")); 1232 1236 break; 1233 1237 1234 1238 case kDetachingPendingAttachFilters: 1235 1239 AssertReturn (mIsStatePending, false); 1236 AssertReturn ( mPendingStateEx == kDetachingPendingAttach 1240 AssertReturn ( mPendingStateEx == kDetachingPendingAttach 1237 1241 || mPendingStateEx == kDetachingPendingDetachFilters, false); 1242 LogFlowThisFunc (("pending attach+filters\n")); 1238 1243 break; 1239 1244 -
trunk/src/VBox/Main/USBProxyService.cpp
r3571 r3664 196 196 pDevices = sortDevices (pDevices); 197 197 198 /* 198 /* 199 199 * We need to lock the host object for writing because 200 200 * a) the subsequent code may call Host methods that require a write … … 202 202 * b) we will lock HostUSBDevice objects below and want to make sure 203 203 * the lock order is always the same (Host, HostUSBDevice, as 204 * expected by Host) to avoid cross-deadlocks 204 * expected by Host) to avoid cross-deadlocks 205 205 */ 206 206 AutoLock hostLock (mHost); … … 219 219 DevPtr = *It; 220 220 221 /* 221 /* 222 222 * Assert that the object is still alive (we still reference it in 223 * the collection and we're the only one who calls uninit() on it 223 * the collection and we're the only one who calls uninit() on it 224 224 */ 225 225 HostUSBDevice::AutoCaller devCaller (DevPtr.isNull() ? NULL : DevPtr); 226 226 AssertComRC (devCaller.rc()); 227 227 228 /* 228 /* 229 229 * Lock the device object since we will read/write it's 230 * properties. All Host callbacks also imply the object is locked. 230 * properties. All Host callbacks also imply the object is locked. 231 231 */ 232 232 AutoLock devLock (DevPtr.isNull() ? NULL : DevPtr); … … 248 248 { 249 249 /* 250 * The device still there, update the state and move on. The PUSBDEVICE 250 * The device still there, update the state and move on. The PUSBDEVICE 251 251 * structure is eaten by updateDeviceState / HostUSBDevice::updateState(). 252 252 */ … … 579 579 AssertReturn (aDevice->isLockedOnCurrentThread(), false); 580 580 581 return aDevice->updateState (aUSBDevice); 581 bool fRc = aDevice->updateState (aUSBDevice); 582 /* A little hack to work around state quirks wrt detach/reattach. */ 583 if ( !fRc 584 && aDevice->isStatePending() 585 && ( aDevice->pendingStateEx() == HostUSBDevice::kDetachingPendingAttach 586 || aDevice->pendingStateEx() == HostUSBDevice::kDetachingPendingAttachFilters)) 587 fRc = true; 588 return fRc; 582 589 } 583 590
Note:
See TracChangeset
for help on using the changeset viewer.