VirtualBox

Changeset 36418 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 24, 2011 10:53:13 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70778
Message:

Main/USB/Linux: extend environment variables for selecting USB probing method and add skeleton testcase

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/USBProxyService.h

    r34341 r36418  
    212212
    213213protected:
     214#ifdef TESTCASE
     215    virtual
     216#endif
    214217    int initUsbfs(void);
     218#ifdef TESTCASE
     219    virtual
     220#endif
    215221    int initSysfs(void);
    216222    void doUsbfsCleanupAsNeeded(void);
  • trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp

    r35351 r36418  
    9393    bool fUseSysfs = false;
    9494#endif
    95     const char *pszUsbFromEnv = RTEnvGet("VBOX_USB");
    96     if (pszUsbFromEnv)
    97     {
    98         if (!RTStrICmp(pszUsbFromEnv, "USBFS"))
     95    const char *pcszUsbFromEnv = RTEnvGet("VBOX_USB");
     96    const char *pcszUsbRoot = NULL;
     97    if (pcszUsbFromEnv)
     98    {
     99        bool fValidVBoxUSB = true;
     100
     101        pcszUsbRoot = RTEnvGet("VBOX_USB_ROOT");
     102        if (!RTStrICmp(pcszUsbFromEnv, "USBFS"))
    99103        {
    100104            LogRel(("Default USB access method set to \"usbfs\" from environment\n"));
    101105            fUseSysfs = false;
    102106        }
    103         else if (!RTStrICmp(pszUsbFromEnv, "SYSFS"))
     107        else if (!RTStrICmp(pcszUsbFromEnv, "SYSFS"))
    104108        {
    105109            LogRel(("Default USB method set to \"sysfs\" from environment\n"));
     
    107111        }
    108112        else
     113        {
    109114            LogRel(("Invalid VBOX_USB environment variable setting \"%s\"\n",
    110                     pszUsbFromEnv));
    111     }
    112     PCUSBDEVTREELOCATION pcLocation = USBProxyLinuxGetDeviceRoot(fUseSysfs);
    113     if (pcLocation)
    114     {
    115         mUsingUsbfsDevices = !pcLocation->fUseSysfs;
    116         mDevicesRoot = pcLocation->szDevicesRoot;
     115                    pcszUsbFromEnv));
     116            fValidVBoxUSB = false;
     117        }
     118        if (!fValidVBoxUSB && pcszUsbRoot)
     119            pcszUsbRoot = NULL;
     120    }
     121    if (!pcszUsbRoot)
     122    {
     123        PCUSBDEVTREELOCATION pcLocation;
     124        pcLocation = USBProxyLinuxGetDeviceRoot(fUseSysfs);
     125        pcszUsbRoot = pcLocation->szDevicesRoot;
     126        fUseSysfs = pcLocation->fUseSysfs;
     127    }
     128    if (pcszUsbRoot)
     129    {
     130        mUsingUsbfsDevices = !fUseSysfs;
     131        mDevicesRoot = pcszUsbRoot;
    117132        int rc = mUsingUsbfsDevices ? initUsbfs() : initSysfs();
    118133        /* For the day when we have VBoxSVC release logging... */
    119134        LogRel((RT_SUCCESS(rc) ? "Successfully initialised host USB using %s\n"
    120135                               : "Failed to initialise host USB using %s\n",
    121                 mUsingUsbfsDevices ? "USBFS" : "sysfs/hal"));
     136                mUsingUsbfsDevices ? "USBFS" : "sysfs"));
    122137        mLastError = rc;
    123138    }
  • trunk/src/VBox/Main/testcase/Makefile.kmk

    r35368 r36418  
    3030        $(if $(VBOX_WITH_RESOURCE_USAGE_API),tstCollector,)
    3131  PROGRAMS.linux += \
    32         $(if $(VBOX_WITH_USB),tstHostHardwareLinux,)
     32        $(if $(VBOX_WITH_USB),tstHostHardwareLinux,) \
     33        $(if $(VBOX_WITH_USB),tstUSBProxyLinux,)
    3334 endif # !VBOX_WITH_TESTCASES
    3435endif # !VBOX_ONLY_SDK
     
    165166
    166167
     168#
     169# tstUSBProxyLinux
     170#
     171tstUSBProxyLinux_TEMPLATE  = VBOXR3TSTNPEXE
     172tstUSBProxyLinux_SOURCES   = \
     173        tstUSBProxyLinux.cpp \
     174        ../src-server/linux/USBProxyServiceLinux.cpp
     175tstUSBProxyLinux_INCS      = \
     176        . \
     177        ../include \
     178        $(VBOX_PATH_SDK)/bindings/xpcom/include \
     179        $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
     180        $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom
     181tstUSBProxyLinux_DEFS      = \
     182        TESTCASE \
     183        VBOX_USB_WITH_SYSFS \
     184        VBOX_WITH_SYSFS_BY_DEFAULT \
     185        VBOX_WITH_XPCOM
     186
     187
    167188# generate rules.
    168189include $(KBUILD_PATH)/subfooter.kmk
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