Changeset 60800 in vbox for trunk/src/VBox/Devices/USB/usbip
- Timestamp:
- May 3, 2016 8:46:12 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/usbip/USBProxyDevice-usbip.cpp
r60550 r60800 82 82 /** Pipe stalled. */ 83 83 #define USBIP_STATUS_PIPE_STALLED INT32_C(-32) 84 /** URB was unlinked by a call to usb_unlink_urb(). */ 85 #define USBIP_STATUS_URB_UNLINKED INT32_C(-104) 84 86 /** Short read. */ 85 87 #define USBIP_STATUS_SHORT_READ INT32_C(-121) … … 582 584 case USBIP_STATUS_PIPE_STALLED: 583 585 return VINF_SUCCESS; 586 case USBIP_STATUS_URB_UNLINKED: 587 return VERR_TRY_AGAIN; 584 588 default: 589 LogFlowFunc(("i32Status=%d\n", i32Status)); 585 590 return VERR_INVALID_STATE; 586 591 } 587 592 593 LogFlowFunc(("i32Status=%d\n", i32Status)); 588 594 return VERR_INVALID_STATE; 589 595 } … … 855 861 { 856 862 int rc = VINF_SUCCESS; 863 unsigned iTry = 0; 857 864 858 865 UsbIpReqSubmit ReqSubmit; … … 874 881 usbProxyUsbIpReqSubmitH2N(&ReqSubmit); 875 882 876 /* Send the command. */ 877 rc = RTTcpWrite(pProxyDevUsbIp->hSocket, &ReqSubmit, sizeof(ReqSubmit)); 878 if (RT_SUCCESS(rc)) 879 { 880 /* Wait for the response. */ 881 /** @todo: Don't wait indefinitely long. */ 882 UsbIpRetSubmit RetSubmit; 883 rc = RTTcpRead(pProxyDevUsbIp->hSocket, &RetSubmit, sizeof(RetSubmit), NULL); 883 do 884 { 885 /* Send the command. */ 886 rc = RTTcpWrite(pProxyDevUsbIp->hSocket, &ReqSubmit, sizeof(ReqSubmit)); 884 887 if (RT_SUCCESS(rc)) 885 888 { 886 usbProxyUsbIpRetSubmitN2H(&RetSubmit); 887 rc = usbProxyUsbIpStatusConvertFromStatus(RetSubmit.u32Status); 889 /* Wait for the response. */ 890 /** @todo: Don't wait indefinitely long. */ 891 UsbIpRetSubmit RetSubmit; 892 rc = RTTcpRead(pProxyDevUsbIp->hSocket, &RetSubmit, sizeof(RetSubmit), NULL); 893 if (RT_SUCCESS(rc)) 894 { 895 usbProxyUsbIpRetSubmitN2H(&RetSubmit); 896 rc = usbProxyUsbIpStatusConvertFromStatus(RetSubmit.u32Status); 897 } 888 898 } 889 } 899 } while ( rc == VERR_TRY_AGAIN 900 && iTry++ < 10); 890 901 return rc; 891 902 } … … 1032 1043 usbProxyUsbIpRetSubmitN2H(&pProxyDevUsbIp->BufRet.RetSubmit); 1033 1044 1045 /* We still have to receive the transfer buffer, even in case of an error. */ 1034 1046 pProxyDevUsbIp->pUrbUsbIp->pVUsbUrb->enmStatus = usbProxyUsbIpVUsbStatusConvertFromStatus(pProxyDevUsbIp->BufRet.RetSubmit.u32Status); 1035 if ( pProxyDevUsbIp->pUrbUsbIp->pVUsbUrb->enmDir == VUSBDIRECTION_IN 1036 && pProxyDevUsbIp->pUrbUsbIp->pVUsbUrb->enmStatus == VUSBSTATUS_OK) 1047 if (pProxyDevUsbIp->pUrbUsbIp->pVUsbUrb->enmDir == VUSBDIRECTION_IN) 1037 1048 { 1038 1049 uint8_t *pbData = NULL; … … 1050 1061 } 1051 1062 1052 usbProxyUsbIpRecvStateAdvance(pProxyDevUsbIp, USBPROXYUSBIPRECVSTATE_URB_BUFFER, 1053 pbData, pProxyDevUsbIp->BufRet.RetSubmit.u32ActualLength); 1063 if (pProxyDevUsbIp->BufRet.RetSubmit.u32ActualLength) 1064 usbProxyUsbIpRecvStateAdvance(pProxyDevUsbIp, USBPROXYUSBIPRECVSTATE_URB_BUFFER, 1065 pbData, pProxyDevUsbIp->BufRet.RetSubmit.u32ActualLength); 1066 else 1067 { 1068 pUrbUsbIp = pProxyDevUsbIp->pUrbUsbIp; 1069 usbProxyUsbIpResetRecvState(pProxyDevUsbIp); 1070 } 1054 1071 } 1055 1072 else 1056 1073 { 1057 Assert( pProxyDevUsbIp->pUrbUsbIp->pVUsbUrb->enmDir == VUSBDIRECTION_OUT 1058 || pProxyDevUsbIp->pUrbUsbIp->pVUsbUrb->enmStatus != VUSBSTATUS_OK); 1074 Assert(pProxyDevUsbIp->pUrbUsbIp->pVUsbUrb->enmDir == VUSBDIRECTION_OUT); 1059 1075 pUrbUsbIp = pProxyDevUsbIp->pUrbUsbIp; 1060 1076 usbProxyUsbIpResetRecvState(pProxyDevUsbIp);
Note:
See TracChangeset
for help on using the changeset viewer.