VirtualBox

Changeset 36994 in vbox


Ignore:
Timestamp:
May 6, 2011 10:20:05 PM (14 years ago)
Author:
vboxsync
Message:

Main/linux/usb: make unit tests pass and fix one test

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/linux/USBGetDevices.cpp

    r36993 r36994  
    14991499        PUSBDEVICE pDevices;
    15001500
     1501        fOK = true;
    15011502        pDevices = getDevicesFromUsbfs(pcszRoot, true);
    15021503        if (pDevices)
    15031504        {
    15041505            PUSBDEVICE pDevice;
    1505            
    1506             fOK = true;
     1506
    15071507            for (pDevice = pDevices; pDevice && fOK; pDevice = pDevice->pNext)
    15081508                if (access(pDevice->pszAddress, R_OK | W_OK))
  • trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp

    r36993 r36994  
    115115     * In the event of both failing, an appropriate error will be returned.
    116116     */
    117     bool fUseSysfs;
     117    bool fUsbfsChosen = false, fSysfsChosen = false;
    118118    const char *pcszUsbFromEnv = RTEnvGet("VBOX_USB");
    119119    const char *pcszUsbRoot = NULL;
     
    126126        {
    127127            LogRel(("Default USB access method set to \"usbfs\" from environment\n"));
    128             fUseSysfs = false;
     128            fUsbfsChosen = true;
    129129        }
    130130        else if (!RTStrICmp(pcszUsbFromEnv, "SYSFS"))
    131131        {
    132132            LogRel(("Default USB method set to \"sysfs\" from environment\n"));
    133             fUseSysfs = true;
     133            fSysfsChosen = true;
    134134        }
    135135        else
     
    144144    if (!pcszUsbRoot)
    145145    {
    146         if (USBProxyLinuxCheckDeviceRoot("/dev/vboxusb", true))
    147         {
    148             fUseSysfs = true;
     146        if (   !fUsbfsChosen
     147            && USBProxyLinuxCheckDeviceRoot("/dev/vboxusb", true))
     148        {
     149            fSysfsChosen = true;
    149150            pcszUsbRoot = "/dev/vboxusb";
    150151        }
    151         else if (USBProxyLinuxCheckDeviceRoot("/proc/bus/usb", false))
    152         {
    153             fUseSysfs = false;
     152        else if (   !fSysfsChosen
     153                 && USBProxyLinuxCheckDeviceRoot("/proc/bus/usb", false))
     154        {
     155            fUsbfsChosen = true;
    154156            pcszUsbRoot = "/proc/bus/usb";
    155157        }
     
    157159    if (pcszUsbRoot)
    158160    {
    159         mUsingUsbfsDevices = !fUseSysfs;
     161        mUsingUsbfsDevices = fUsbfsChosen;
    160162        mDevicesRoot = pcszUsbRoot;
    161163#ifndef UNIT_TEST /* Hack for now */
  • trunk/src/VBox/Main/testcase/tstUSBProxyLinux.cpp

    r36993 r36994  
    9191    { "sysfs", "/dev/bus/usb", "/dev/usbvbox", false, "/proc/usb/bus", false, VINF_SUCCESS, VINF_SUCCESS, "/dev/bus/usb", false },
    9292    { "sysfs", "/dev/bus/usb", "/dev/usbvbox", false, "/proc/usb/bus", false, VERR_NO_MEMORY, VERR_NO_MEMORY, "/dev/bus/usb", false },
    93     { "sysfs", NULL, "/dev/usbvbox", true, NULL, false, VINF_SUCCESS, VINF_SUCCESS, "/dev/vboxusb", false },
     93    { "sysfs", NULL, "/dev/vboxusb", true, NULL, false, VINF_SUCCESS, VINF_SUCCESS, "/dev/vboxusb", false },
    9494    { "usbfs", "/dev/bus/usb", NULL, false, NULL, false, VINF_SUCCESS, VINF_SUCCESS, "/dev/bus/usb", true },
    9595    { "usbfs", "/dev/bus/usb", NULL, false, NULL, false, VERR_NO_MEMORY, VERR_NO_MEMORY, "/dev/bus/usb", true },
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