Changeset 32192 in vbox for trunk/src/VBox
- Timestamp:
- Sep 2, 2010 12:32:20 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/win/USBProxyDevice-win.cpp
r31890 r32192 404 404 * Aborts a pipe/endpoint (cancels all outstanding URBs on the endpoint). 405 405 */ 406 static boolusbProxyWinAbortEndPt(PUSBPROXYDEV pProxyDev, unsigned int ep)406 static int usbProxyWinAbortEndPt(PUSBPROXYDEV pProxyDev, unsigned int ep) 407 407 { 408 408 PPRIV_USBW32 pPriv = (PPRIV_USBW32)pProxyDev->Backend.pv; 409 409 USBSUP_CLEAR_ENDPOINT in; 410 410 DWORD cbReturned; 411 int rc; 411 412 412 413 Assert(pPriv); … … 417 418 cbReturned = 0; 418 419 if (DeviceIoControl(pPriv->hDev, SUPUSB_IOCTL_USB_ABORT_ENDPOINT, &in, sizeof(in), NULL, 0, &cbReturned, NULL)) 419 return true; 420 421 if ( GetLastError() == ERROR_INVALID_HANDLE_STATE 422 || GetLastError() == ERROR_BAD_COMMAND) 420 return VINF_SUCCESS; 421 422 rc = GetLastError(); 423 if ( rc == ERROR_INVALID_HANDLE_STATE 424 || rc == ERROR_BAD_COMMAND) 423 425 { 424 426 Log(("usbproxy: device %x unplugged!!\n", pPriv->hDev)); … … 427 429 else 428 430 AssertMsgFailed(("lasterr=%d\n", GetLastError())); 429 return false;431 return RTErrConvertFromWin32(rc); 430 432 } 431 433 … … 735 737 736 738 /** 737 * Cancel an in-flight URB. 739 * Cancels an in-flight URB. 740 * 741 * The URB requires reaping, so we don't change its state. 742 * 743 * @remark There isn't a way to cancel a specific URB on Windows. 744 * on darwin. The interface only supports the aborting of 745 * all URBs pending on an endpoint. Luckily that is usually 746 * exactly what the guest wants to do. 738 747 */ 739 748 static void usbProxyWinUrbCancel(PVUSBURB pUrb) … … 742 751 PPRIV_USBW32 pPriv = (PPRIV_USBW32)pProxyDev->Backend.pv; 743 752 PQUEUED_URB pQUrbWin = (PQUEUED_URB)pUrb->Dev.pvPrivate; 753 int rc; 754 USBSUP_CLEAR_ENDPOINT in; 755 DWORD cbReturned; 744 756 Assert(pQUrbWin); 745 757 746 /* 747 * We've no way of canceling it, so we'll have to wait till 748 * it's ripe and can be reaped. The caller will deal with this. 749 */ 750 pQUrbWin->fCancelled = TRUE; 751 Log(("Cancel urb %p\n", pUrb)); 752 753 /* Note CancelIoEx can cancel all pending IO requests for a file handle or a specific overlapped request. 754 * Unfortunately Vista+ only. 755 */ 758 in.bEndpoint = pUrb->EndPt | (pUrb->enmDir == VUSBDIRECTION_IN ? 0x80 : 0); 759 Log(("Cancel urb %p, endpoint %x\n", pUrb, in.bEndpoint)); 760 761 cbReturned = 0; 762 if (DeviceIoControl(pPriv->hDev, SUPUSB_IOCTL_USB_ABORT_ENDPOINT, &in, sizeof(in), NULL, 0, &cbReturned, NULL)) 763 return; 764 765 rc = GetLastError(); 766 if ( rc == ERROR_INVALID_HANDLE_STATE 767 || rc == ERROR_BAD_COMMAND) 768 { 769 Log(("usbproxy: device %x unplugged!!\n", pPriv->hDev)); 770 pProxyDev->fDetached = true; 771 } 772 else 773 AssertMsgFailed(("lasterr=%d\n", GetLastError())); 756 774 } 757 775
Note:
See TracChangeset
for help on using the changeset viewer.