Changeset 36941 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 3, 2011 2:56:08 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71528
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r36495 r36941 382 382 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \ 383 383 $(PATH_SDK_WINPSDK_LIB)/WbemUuid.Lib 384 ifdef VBOX_NETFLT_ONDEMAND_BIND385 VBoxSVC_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND386 endif387 384 endif 388 385 VBoxSVC_LDFLAGS.darwin = -framework IOKit -framework SystemConfiguration -
trunk/src/VBox/Main/src-server/win/USBProxyServiceWindows.cpp
r35368 r36941 143 143 int USBProxyServiceWindows::captureDevice(HostUSBDevice *aDevice) 144 144 { 145 AssertReturn(aDevice, VERR_GENERAL_FAILURE); 146 AssertReturn(aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 147 Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing); 148 149 /** @todo pass up a one-shot filter like on darwin? */ 150 USHORT vendorId, productId, revision; 151 152 HRESULT rc; 153 154 rc = aDevice->COMGETTER(VendorId)(&vendorId); 155 AssertComRCReturn(rc, VERR_INTERNAL_ERROR); 156 157 rc = aDevice->COMGETTER(ProductId)(&productId); 158 AssertComRCReturn(rc, VERR_INTERNAL_ERROR); 159 160 rc = aDevice->COMGETTER(Revision)(&revision); 161 AssertComRCReturn(rc, VERR_INTERNAL_ERROR); 162 163 return USBLibCaptureDevice(vendorId, productId, revision); 145 /* 146 * Create a one-shot ignore filter for the device 147 * and trigger a re-enumeration of it. 148 */ 149 USBFILTER Filter; 150 USBFilterInit(&Filter, USBFILTERTYPE_ONESHOT_CAPTURE); 151 initFilterFromDevice(&Filter, aDevice); 152 Log(("USBFILTERIDX_PORT=%#x\n", USBFilterGetNum(&Filter, USBFILTERIDX_PORT))); 153 Log(("USBFILTERIDX_BUS=%#x\n", USBFilterGetNum(&Filter, USBFILTERIDX_BUS))); 154 155 void *pvId = USBLibAddFilter(&Filter); 156 if (!pvId) 157 { 158 AssertMsgFailed(("Add one-shot Filter failed\n")); 159 return VERR_GENERAL_FAILURE; 160 } 161 162 int rc = USBLibRunFilters(); 163 if (!RT_SUCCESS(rc)) 164 { 165 AssertMsgFailed(("Run Filters failed\n")); 166 USBLibRemoveFilter(pvId); 167 return rc; 168 } 169 170 return VINF_SUCCESS; 164 171 } 165 172 … … 167 174 int USBProxyServiceWindows::releaseDevice(HostUSBDevice *aDevice) 168 175 { 169 AssertReturn(aDevice, VERR_GENERAL_FAILURE); 170 AssertReturn(aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE); 171 Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost); 172 173 /** @todo pass up a one-shot filter like on darwin? */ 174 USHORT vendorId, productId, revision; 175 HRESULT rc; 176 177 rc = aDevice->COMGETTER(VendorId)(&vendorId); 178 AssertComRCReturn(rc, VERR_INTERNAL_ERROR); 179 180 rc = aDevice->COMGETTER(ProductId)(&productId); 181 AssertComRCReturn(rc, VERR_INTERNAL_ERROR); 182 183 rc = aDevice->COMGETTER(Revision)(&revision); 184 AssertComRCReturn(rc, VERR_INTERNAL_ERROR); 185 186 Log(("USBProxyServiceWindows::releaseDevice\n")); 187 return USBLibReleaseDevice(vendorId, productId, revision); 176 /* 177 * Create a one-shot ignore filter for the device 178 * and trigger a re-enumeration of it. 179 */ 180 USBFILTER Filter; 181 USBFilterInit(&Filter, USBFILTERTYPE_ONESHOT_IGNORE); 182 initFilterFromDevice(&Filter, aDevice); 183 Log(("USBFILTERIDX_PORT=%#x\n", USBFilterGetNum(&Filter, USBFILTERIDX_PORT))); 184 Log(("USBFILTERIDX_BUS=%#x\n", USBFilterGetNum(&Filter, USBFILTERIDX_BUS))); 185 186 void *pvId = USBLibAddFilter(&Filter); 187 if (!pvId) 188 { 189 AssertMsgFailed(("Add one-shot Filter failed\n")); 190 return VERR_GENERAL_FAILURE; 191 } 192 193 int rc = USBLibRunFilters(); 194 if (!RT_SUCCESS(rc)) 195 { 196 AssertMsgFailed(("Run Filters failed\n")); 197 USBLibRemoveFilter(pvId); 198 return rc; 199 } 200 201 202 return VINF_SUCCESS; 188 203 } 189 204 … … 223 238 int USBProxyServiceWindows::wait(unsigned aMillies) 224 239 { 225 DWORD rc; 226 227 /* Not going to do something fancy where we block in the filter 228 * driver and are woken up when the state has changed. 229 * Would be better, but this is good enough. 230 */ 231 do 232 { 233 rc = WaitForSingleObject(mhEventInterrupt, RT_MIN(aMillies, 100)); 234 if (rc == WAIT_OBJECT_0) 235 return VINF_SUCCESS; 236 /** @todo handle WAIT_FAILED here */ 237 238 if (USBLibHasPendingDeviceChanges() == true) 239 { 240 Log(("wait thread detected usb change\n")); 241 return VINF_SUCCESS; 242 } 243 244 if (aMillies > 100) 245 aMillies -= 100; 246 } 247 while (aMillies > 100); 248 249 return VERR_TIMEOUT; 240 return USBLibWaitChange(aMillies); 250 241 } 251 242 … … 253 244 int USBProxyServiceWindows::interruptWait(void) 254 245 { 255 SetEvent(mhEventInterrupt); 256 return VINF_SUCCESS; 257 } 258 246 return USBLibInterruptWaitChange(); 247 } 259 248 260 249 /**
Note:
See TracChangeset
for help on using the changeset viewer.