VirtualBox

Ignore:
Timestamp:
Apr 14, 2016 10:33:11 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106590
Message:

ValidationKit/usb: Fixes

Location:
trunk/src/VBox/ValidationKit/utils/usb
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/usb/UsbTestService.cpp

    r60417 r60488  
    462462
    463463    return utsReplyFailure(pClient, pPktHdr, "FAILED  ", rcOperation, "%s failed with rc=%Rrc (opcode '%.8s')",
    464                            rcOperation, szOperation, rcOperation, pPktHdr->achOpcode);
     464                           szOperation, rcOperation, pPktHdr->achOpcode);
    465465}
    466466
     
    600600
    601601    /* Extract string. */
    602     pClient->pszHostname = RTStrDup(pClient->pszHostname);
     602    pClient->pszHostname = RTStrDup(&pReq->achHostname[0]);
    603603    if (!pClient->pszHostname)
    604         return utsReplyRC(pClient, pPktHdr, VERR_NO_MEMORY, "Failed to alllocate memory for the hostname string");
     604        return utsReplyRC(pClient, pPktHdr, VERR_NO_MEMORY, "Failed to allocate memory for the hostname string");
    605605
    606606    if (pReq->fUsbConn & UTSPKT_HOWDY_CONN_F_PHYSICAL)
     
    897897
    898898                    uint8_t bRead;
    899                     rc = RTPipeRead(g_hPipeR, &bRead, 1, NULL);
     899                    size_t cbRead = 0;
     900                    rc = RTPipeRead(g_hPipeR, &bRead, 1, &cbRead);
    900901                    AssertRC(rc);
    901902
     
    950951                    /* Client sends a request, pick the right client and process it. */
    951952                    PUTSCLIENT pClient = papClients[uId - 1];
     953                    AssertPtr(pClient);
    952954                    if (fEvts & RTPOLL_EVT_READ)
    953955                        rc = utsClientReqProcess(pClient);
     
    957959                    {
    958960                        /* Close connection and remove client from array. */
     961                        rc = g_pTransport->pfnPollSetRemove(hPollSet, pClient->pTransportClient, uId);
     962                        AssertRC(rc);
     963
    959964                        g_pTransport->pfnNotifyBye(pClient->pTransportClient);
    960965                        papClients[uId - 1] = NULL;
     
    9951000         * the request handling thread.
    9961001         */
    997         PUTSCLIENT pClient = (PUTSCLIENT)RTMemAllocZ(sizeof(PUTSCLIENT));
     1002        PUTSCLIENT pClient = (PUTSCLIENT)RTMemAllocZ(sizeof(UTSCLIENT));
    9981003        if (RT_LIKELY(pClient))
    9991004        {
     
    10031008            pClient->hGadgetHost      = NIL_UTSGADGETHOST;
    10041009            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");
    10051020        }
    10061021        else
  • trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceGadgetHostUsbIp.cpp

    r60375 r60488  
    101101    {
    102102        /* Make sure the kernel drivers are loaded. */
    103         rc = utsGadgetHostUsbIpLoadModule("usbip-core.ko");
     103        rc = utsGadgetHostUsbIpLoadModule("usbip-core");
    104104        if (RT_SUCCESS(rc))
    105105        {
    106             rc = utsGadgetHostUsbIpLoadModule("usbip-host.ko");
     106            rc = utsGadgetHostUsbIpLoadModule("usbip-host");
    107107            if (RT_SUCCESS(rc))
    108108            {
    109109                char aszPort[10];
    110110                char aszPidFile[64];
    111                 const char *apszArgv[5];
     111                const char *apszArgv[6];
    112112
    113113                RTStrPrintf(aszPort, RT_ELEMENTS(aszPort), "%u", uPort);
     
    117117                apszArgv[1] = "--tcp-port";
    118118                apszArgv[2] = aszPort;
    119                 apszArgv[3] = "--pid-file";
     119                apszArgv[3] = "--pid";
    120120                apszArgv[4] = aszPidFile;
     121                apszArgv[5] = NULL;
    121122                rc = RTProcCreate("usbipd", apszArgv, RTENV_DEFAULT, RTPROC_FLAGS_SEARCH_PATH, &pIf->hProcUsbIp);
    122123                if (RT_SUCCESS(rc))
  • trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceInternal.h

    r60279 r60488  
    122122
    123123    /**
     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    /**
    124134     * Receives an incoming packet.
    125135     *
  • trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceProtocol.h

    r60417 r60488  
    100100    uint32_t        cchHostname;
    101101    /** The client host name as terminated ASCII string. */
    102     uint8_t         achHostname[68];
     102    char            achHostname[68];
    103103} UTSPKTREQHOWDY;
    104104AssertCompileSizeAlignment(UTSPKTREQHOWDY, UTSPKT_ALIGNMENT);
  • trunk/src/VBox/ValidationKit/utils/usb/UsbTestServiceTcp.cpp

    r60281 r60488  
    9393
    9494/**
    95  * Disconnects the current client and frees its data structure.
     95 * Disconnects the current client and frees all stashed data.
    9696 */
    9797static void utsTcpDisconnectClient(PUTSTRANSPORTCLIENT pClient)
    9898{
    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
    101106    if (pClient->pbTcpStashed)
     107    {
    102108        RTMemFree(pClient->pbTcpStashed);
    103     RTMemFree(pClient);
     109        pClient->pbTcpStashed = NULL;
     110    }
    104111}
    105112
     
    158165    Log(("utsTcpNotifyBye: utsTcpDisconnectClient %RTsock\n", pClient->hTcpClient));
    159166    utsTcpDisconnectClient(pClient);
     167    RTMemFree(pClient);
    160168}
    161169
     
    347355
    348356/**
     357 * @interface_method_impl{UTSTRANSPORT,pfnPollSetRemove}
     358 */
     359static DECLCALLBACK(int) utsTcpPollSetRemove(RTPOLLSET hPollSet, PUTSTRANSPORTCLIENT pClient, uint32_t idStart)
     360{
     361    return RTPollSetRemove(hPollSet, idStart);
     362}
     363
     364/**
    349365 * @interface_method_impl{UTSTRANSPORT,pfnPollIn}
    350366 */
     
    471487    /* .pfnPollIn         = */ utsTcpPollIn,
    472488    /* .pfnPollSetAdd     = */ utsTcpPollSetAdd,
     489    /* .pfnPollSetRemove  = */ utsTcpPollSetRemove,
    473490    /* .pfnRecvPkt        = */ utsTcpRecvPkt,
    474491    /* .pfnSendPkt        = */ utsTcpSendPkt,
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette