VirtualBox

Changeset 36961 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
May 4, 2011 4:37:48 PM (14 years ago)
Author:
vboxsync
Message:

Main/USB/linux: return correct error codes and messages if the user does not have the right access permissions

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r36615 r36961  
    27362736         * USB proxy service could not start. */
    27372737
    2738         if (m->pUSBProxyService->getLastError() == VERR_FILE_NOT_FOUND)
    2739             return setWarning(E_FAIL,
    2740                               tr("Could not load the Host USB Proxy Service (%Rrc). The service might not be installed on the host computer"),
    2741                               m->pUSBProxyService->getLastError());
    2742         if (m->pUSBProxyService->getLastError() == VINF_SUCCESS)
    2743 #ifdef RT_OS_LINUX
    2744             return setWarning (VBOX_E_HOST_ERROR,
    2745 # ifdef VBOX_WITH_DBUS
    2746                 tr ("The USB Proxy Service could not be started, because neither the USB file system (usbfs) nor the hardware information service (hal) is available")
    2747 # else
    2748                 tr ("The USB Proxy Service could not be started, because the USB file system (usbfs) is not available")
    2749 # endif
    2750                 );
    2751 #else  /* !RT_OS_LINUX */
    2752             return setWarning (E_FAIL,
    2753                 tr ("The USB Proxy Service has not yet been ported to this host"));
    2754 #endif /* !RT_OS_LINUX */
    2755         return setWarning (E_FAIL,
    2756             tr ("Could not load the Host USB Proxy service (%Rrc)"),
    2757             m->pUSBProxyService->getLastError());
     2738        switch (m->pUSBProxyService->getLastError())
     2739        {
     2740            case VERR_FILE_NOT_FOUND:  /** @todo what does this mean? */
     2741                return setWarning(E_FAIL,
     2742                                  tr("Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might not be installed on the host computer"));
     2743            case VERR_VUSB_USB_DEVICE_PERMISSION:
     2744                return setWarning(E_FAIL,
     2745                                  tr("VirtualBox is not currently allowed to access USB devices.  You can change this by adding your user to the 'vboxusers' group.  Please see the user manual for a more detailed explanation"));
     2746            case VERR_VUSB_USBFS_PERMISSION:
     2747                return setWarning(E_FAIL,
     2748                                  tr("VirtualBox is not currently allowed to access USB devices.  You can change this by allowing your user to access the 'usbfs' folder and files.  Please see the user manual for a more detailed explanation"));
     2749            case VINF_SUCCESS:
     2750                return setWarning(E_FAIL,
     2751                                  tr("The USB Proxy Service has not yet been ported to this host"));
     2752            default:
     2753                return setWarning (E_FAIL, "%s: %Rrc",
     2754                                   tr ("Could not load the Host USB Proxy service"),
     2755                                   m->pUSBProxyService->getLastError());
     2756        }
    27582757    }
    27592758
  • trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp

    r36958 r36961  
    142142    else
    143143        /** @todo fix this, preferably in the next fifteen minutes. */
    144         mLastError =   RTDirExists("/dev/vboxusb") ? VERR_PERMISSION_DENIED
     144        mLastError =   RTDirExists("/dev/vboxusb") ? VERR_VUSB_USB_DEVICE_PERMISSION
    145145                     : RTFileExists("/proc/bus/usb/devices") ? VERR_VUSB_USBFS_PERMISSION
    146146                     : VERR_NOT_FOUND;
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