Changeset 60488 in vbox for trunk/src/VBox/ValidationKit/utils/usb
- Timestamp:
- Apr 14, 2016 10:33:11 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106590
- Location:
- trunk/src/VBox/ValidationKit/utils/usb
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/usb/UsbTestService.cpp
r60417 r60488 462 462 463 463 return utsReplyFailure(pClient, pPktHdr, "FAILED ", rcOperation, "%s failed with rc=%Rrc (opcode '%.8s')", 464 rcOperation,szOperation, rcOperation, pPktHdr->achOpcode);464 szOperation, rcOperation, pPktHdr->achOpcode); 465 465 } 466 466 … … 600 600 601 601 /* Extract string. */ 602 pClient->pszHostname = RTStrDup( pClient->pszHostname);602 pClient->pszHostname = RTStrDup(&pReq->achHostname[0]); 603 603 if (!pClient->pszHostname) 604 return utsReplyRC(pClient, pPktHdr, VERR_NO_MEMORY, "Failed to all locate memory for the hostname string");604 return utsReplyRC(pClient, pPktHdr, VERR_NO_MEMORY, "Failed to allocate memory for the hostname string"); 605 605 606 606 if (pReq->fUsbConn & UTSPKT_HOWDY_CONN_F_PHYSICAL) … … 897 897 898 898 uint8_t bRead; 899 rc = RTPipeRead(g_hPipeR, &bRead, 1, NULL); 899 size_t cbRead = 0; 900 rc = RTPipeRead(g_hPipeR, &bRead, 1, &cbRead); 900 901 AssertRC(rc); 901 902 … … 950 951 /* Client sends a request, pick the right client and process it. */ 951 952 PUTSCLIENT pClient = papClients[uId - 1]; 953 AssertPtr(pClient); 952 954 if (fEvts & RTPOLL_EVT_READ) 953 955 rc = utsClientReqProcess(pClient); … … 957 959 { 958 960 /* Close connection and remove client from array. */ 961 rc = g_pTransport->pfnPollSetRemove(hPollSet, pClient->pTransportClient, uId); 962 AssertRC(rc); 963 959 964 g_pTransport->pfnNotifyBye(pClient->pTransportClient); 960 965 papClients[uId - 1] = NULL; … … 995 1000 * the request handling thread. 996 1001 */ 997 PUTSCLIENT pClient = (PUTSCLIENT)RTMemAllocZ(sizeof( PUTSCLIENT));1002 PUTSCLIENT pClient = (PUTSCLIENT)RTMemAllocZ(sizeof(UTSCLIENT)); 998 1003 if (RT_LIKELY(pClient)) 999 1004 { … … 1003 1008 pClient->hGadgetHost = NIL_UTSGADGETHOST; 1004 1009 pClient->hGadget = NIL_UTSGADGET; 1010 1011 /* Add client to the new list and inform the worker thread. */ 1012 RTCritSectEnter(&g_CritSectClients); 1013 RTListAppend(&g_LstClientsNew, &pClient->NdLst); 1014 RTCritSectLeave(&g_CritSectClients); 1015 1016 size_t cbWritten = 0; 1017 rc = RTPipeWrite(g_hPipeW, "", 1, &cbWritten); 1018 if (RT_FAILURE(rc)) 1019 RTMsgError("Failed to inform worker thread of a new client"); 1005 1020 } 1006 1021 else -
trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceGadgetHostUsbIp.cpp
r60375 r60488 101 101 { 102 102 /* Make sure the kernel drivers are loaded. */ 103 rc = utsGadgetHostUsbIpLoadModule("usbip-core .ko");103 rc = utsGadgetHostUsbIpLoadModule("usbip-core"); 104 104 if (RT_SUCCESS(rc)) 105 105 { 106 rc = utsGadgetHostUsbIpLoadModule("usbip-host .ko");106 rc = utsGadgetHostUsbIpLoadModule("usbip-host"); 107 107 if (RT_SUCCESS(rc)) 108 108 { 109 109 char aszPort[10]; 110 110 char aszPidFile[64]; 111 const char *apszArgv[ 5];111 const char *apszArgv[6]; 112 112 113 113 RTStrPrintf(aszPort, RT_ELEMENTS(aszPort), "%u", uPort); … … 117 117 apszArgv[1] = "--tcp-port"; 118 118 apszArgv[2] = aszPort; 119 apszArgv[3] = "--pid -file";119 apszArgv[3] = "--pid"; 120 120 apszArgv[4] = aszPidFile; 121 apszArgv[5] = NULL; 121 122 rc = RTProcCreate("usbipd", apszArgv, RTENV_DEFAULT, RTPROC_FLAGS_SEARCH_PATH, &pIf->hProcUsbIp); 122 123 if (RT_SUCCESS(rc)) -
trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceInternal.h
r60279 r60488 122 122 123 123 /** 124 * Removes the given client frmo the given pollset. 125 * 126 * @returns IPRT status code. 127 * @param hPollSet The poll set to remove from. 128 * @paramm pClient The transport client structure. 129 * @param idStart The handle ID to remove. 130 */ 131 DECLR3CALLBACKMEMBER(int, pfnPollSetRemove, (RTPOLLSET hPollSet, PUTSTRANSPORTCLIENT pClient, uint32_t idStart)); 132 133 /** 124 134 * Receives an incoming packet. 125 135 * -
trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceProtocol.h
r60417 r60488 100 100 uint32_t cchHostname; 101 101 /** The client host name as terminated ASCII string. */ 102 uint8_tachHostname[68];102 char achHostname[68]; 103 103 } UTSPKTREQHOWDY; 104 104 AssertCompileSizeAlignment(UTSPKTREQHOWDY, UTSPKT_ALIGNMENT); -
trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceTcp.cpp
r60281 r60488 93 93 94 94 /** 95 * Disconnects the current client and frees its data structure.95 * Disconnects the current client and frees all stashed data. 96 96 */ 97 97 static void utsTcpDisconnectClient(PUTSTRANSPORTCLIENT pClient) 98 98 { 99 int rc = RTTcpServerDisconnectClient2(pClient->hTcpClient); 100 AssertRCSuccess(rc); 99 if (pClient->hTcpClient == NIL_RTSOCKET) 100 { 101 int rc = RTTcpServerDisconnectClient2(pClient->hTcpClient); 102 pClient->hTcpClient = NIL_RTSOCKET; 103 AssertRCSuccess(rc); 104 } 105 101 106 if (pClient->pbTcpStashed) 107 { 102 108 RTMemFree(pClient->pbTcpStashed); 103 RTMemFree(pClient); 109 pClient->pbTcpStashed = NULL; 110 } 104 111 } 105 112 … … 158 165 Log(("utsTcpNotifyBye: utsTcpDisconnectClient %RTsock\n", pClient->hTcpClient)); 159 166 utsTcpDisconnectClient(pClient); 167 RTMemFree(pClient); 160 168 } 161 169 … … 347 355 348 356 /** 357 * @interface_method_impl{UTSTRANSPORT,pfnPollSetRemove} 358 */ 359 static DECLCALLBACK(int) utsTcpPollSetRemove(RTPOLLSET hPollSet, PUTSTRANSPORTCLIENT pClient, uint32_t idStart) 360 { 361 return RTPollSetRemove(hPollSet, idStart); 362 } 363 364 /** 349 365 * @interface_method_impl{UTSTRANSPORT,pfnPollIn} 350 366 */ … … 471 487 /* .pfnPollIn = */ utsTcpPollIn, 472 488 /* .pfnPollSetAdd = */ utsTcpPollSetAdd, 489 /* .pfnPollSetRemove = */ utsTcpPollSetRemove, 473 490 /* .pfnRecvPkt = */ utsTcpRecvPkt, 474 491 /* .pfnSendPkt = */ utsTcpSendPkt,
Note:
See TracChangeset
for help on using the changeset viewer.