summaryrefslogtreecommitdiff
path: root/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp')
-rw-r--r--src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp b/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
index 3cc36bd77..eab255187 100644
--- a/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
+++ b/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -62,7 +62,7 @@ USBProxyServiceLinux::USBProxyServiceLinux(Host *aHost)
mWakeupPipeW(NIL_RTFILE), mUsingUsbfsDevices(true /* see init */),
mUdevPolls(0), mpWaiter(NULL)
{
- LogFlowThisFunc(("aHost=%p:{%s}\n", aHost));
+ LogFlowThisFunc(("aHost=%p\n", aHost));
}
@@ -92,33 +92,51 @@ HRESULT USBProxyServiceLinux::init(void)
#else
bool fUseSysfs = false;
#endif
- const char *pszUsbFromEnv = RTEnvGet("VBOX_USB");
- if (pszUsbFromEnv)
+ const char *pcszUsbFromEnv = RTEnvGet("VBOX_USB");
+ const char *pcszUsbRoot = NULL;
+ if (pcszUsbFromEnv)
{
- if (!RTStrICmp(pszUsbFromEnv, "USBFS"))
+ bool fValidVBoxUSB = true;
+
+ pcszUsbRoot = RTEnvGet("VBOX_USB_ROOT");
+ if (!RTStrICmp(pcszUsbFromEnv, "USBFS"))
{
LogRel(("Default USB access method set to \"usbfs\" from environment\n"));
fUseSysfs = false;
}
- else if (!RTStrICmp(pszUsbFromEnv, "SYSFS"))
+ else if (!RTStrICmp(pcszUsbFromEnv, "SYSFS"))
{
LogRel(("Default USB method set to \"sysfs\" from environment\n"));
fUseSysfs = true;
}
else
+ {
LogRel(("Invalid VBOX_USB environment variable setting \"%s\"\n",
- pszUsbFromEnv));
+ pcszUsbFromEnv));
+ fValidVBoxUSB = false;
+ }
+ if (!fValidVBoxUSB && pcszUsbRoot)
+ pcszUsbRoot = NULL;
+ }
+ if (!pcszUsbRoot)
+ {
+ PCUSBDEVTREELOCATION pcLocation;
+ pcLocation = USBProxyLinuxGetDeviceRoot(fUseSysfs);
+ if (pcLocation)
+ {
+ pcszUsbRoot = pcLocation->szDevicesRoot;
+ fUseSysfs = pcLocation->fUseSysfs;
+ }
}
- PCUSBDEVTREELOCATION pcLocation = USBProxyLinuxGetDeviceRoot(fUseSysfs);
- if (pcLocation)
+ if (pcszUsbRoot)
{
- mUsingUsbfsDevices = !pcLocation->fUseSysfs;
- mDevicesRoot = pcLocation->szDevicesRoot;
+ mUsingUsbfsDevices = !fUseSysfs;
+ mDevicesRoot = pcszUsbRoot;
int rc = mUsingUsbfsDevices ? initUsbfs() : initSysfs();
/* For the day when we have VBoxSVC release logging... */
LogRel((RT_SUCCESS(rc) ? "Successfully initialised host USB using %s\n"
: "Failed to initialise host USB using %s\n",
- mUsingUsbfsDevices ? "USBFS" : "sysfs/hal"));
+ mUsingUsbfsDevices ? "USBFS" : "sysfs"));
mLastError = rc;
}
else