VirtualBox

Ignore:
Timestamp:
Apr 15, 2016 12:20:51 PM (9 years ago)
Author:
vboxsync
Message:

ValidationKit/usb: Updates for UsbTestService

File:
1 edited

Legend:

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

    r60493 r60517  
    3737
    3838#include "UsbTestServiceGadgetInternal.h"
     39#include "UsbTestServicePlatform.h"
    3940
    4041/*********************************************************************************************************************************
     
    253254    /* Finally delete the gadget template. */
    254255    utsGadgetClassTestDirRemove(pClass->pszGadgetPath);
     256
     257    /* Release the UDC. */
     258    if (pClass->pszUdc)
     259    {
     260        rc = utsPlatformLnxReleaseUDC(pClass->pszUdc);
     261        AssertRC(rc);
     262        RTStrFree(pClass->pszUdc);
     263    }
    255264}
    256265
     
    343352
    344353                /* Finally enable the gadget by attaching it to a UDC. */
    345                 /** @todo: Figure out a free UDC dynamically. */
    346                 if (RT_SUCCESS(rc))
    347                     rc = RTLinuxSysFsWriteStrFile("dummy_udc.0", 0, NULL, "%s/UDC", pClass->pszGadgetPath);
     354                if (RT_SUCCESS(rc))
     355                {
     356                    pClass->pszUdc = NULL;
     357
     358                    rc = utsPlatformLnxAcquireUDC(&pClass->pszUdc, &pClass->uBusId);
     359                    if (RT_SUCCESS(rc))
     360                        rc = RTLinuxSysFsWriteStrFile(pClass->pszUdc, 0, NULL, "%s/UDC", pClass->pszGadgetPath);
     361                }
    348362            }
    349363
     
    378392
    379393
     394/**
     395 * @interface_method_impl{UTSGADGETCLASS,pfnGetBusId}
     396 */
     397static DECLCALLBACK(uint32_t) utsGadgetClassTestGetBusId(PUTSGADGETCLASSINT pClass)
     398{
     399    return pClass->uBusId;
     400}
     401
     402
     403/**
     404 * @interface_method_impl{UTSGADGETCLASS,pfnConnect}
     405 */
     406static DECLCALLBACK(int) utsGadgetClassTestConnect(PUTSGADGETCLASSINT pClass)
     407{
     408    return RTLinuxSysFsWriteStrFile("connect", 0, NULL, "/sys/class/udc/%s/soft_connect", pClass->pszUdc);
     409}
     410
     411
     412/**
     413 * @interface_method_impl{UTSGADGETCLASS,pfnDisconnect}
     414 */
     415static DECLCALLBACK(int) utsGadgetClassTestDisconnect(PUTSGADGETCLASSINT pClass)
     416{
     417    return RTLinuxSysFsWriteStrFile("disconnect", 0, NULL, "/sys/class/udc/%s/soft_connect", pClass->pszUdc);}
     418
     419
    380420
    381421/**
     
    393433    utsGadgetClassTestInit,
    394434    /** pfnTerm */
    395     utsGadgetClassTestTerm
     435    utsGadgetClassTestTerm,
     436    /** pfnGetBusId */
     437    utsGadgetClassTestGetBusId,
     438    /** pfnConnect */
     439    utsGadgetClassTestConnect,
     440    /** pfnDisconnect. */
     441    utsGadgetClassTestDisconnect
    396442};
    397443
Note: See TracChangeset for help on using the changeset viewer.

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