USBProxyServiceLinux.cpp revision e0f4842c86fb19b491179200b2e74fa6e9a57b85
2N/A * VirtualBox USB Proxy Service, Linux Specialization. 2N/A * Copyright (C) 2006-2011 Oracle Corporation 2N/A * This file is part of VirtualBox Open Source Edition (OSE), as 2N/A * you can redistribute it and/or modify it under the terms of the GNU 2N/A * General Public License (GPL) as published by the Free Software 2N/A * Foundation, in version 2 as it comes in the "COPYING" file of the 2N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 2N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 2N/A/******************************************************************************* 2N/A*******************************************************************************/ * Initialize data members. * Initializes the object (called right after construction). * @returns S_OK on success and non-fatal failures, some COM error otherwise. * Call the superclass method first. * We have two methods available for getting host USB device data - using * USBFS and using sysfs. The default choice depends on build-time * settings and an environment variable; if the default is not available * we fall back to the second. * In the event of both failing, the error from the second method tried * will be presented to the user. LogRel((
"Default USB access method set to \"usbfs\" from environment\n"));
LogRel((
"Default USB method set to \"sysfs\" from environment\n"));
LogRel((
"Invalid VBOX_USB environment variable setting \"%s\"\n",
/* For the day when we have VBoxSVC release logging... */ :
"Failed to initialise host USB using %s\n",
/** @todo fix this, preferably in the next fifteen minutes. */ * Initialization routine for the usbfs based operation. * @returns iprt status code. /* Set close on exec (race here!) */ * Start the poller thread. Log((
"USBProxyServiceLinux::USBProxyServiceLinux: fcntl failed, errno=%d\n",
errno));
Log((
"USBProxyServiceLinux::USBProxyServiceLinux: pipe failed, errno=%d\n",
errno));
Log((
"USBProxyServiceLinux::USBProxyServiceLinux: out of memory!\n"));
* Initialization routine for the sysfs based operation. * @returns iprt status code /* This can legitimately happen if hal or DBus are not running, but of * course we can't start in this case. */ #
else /* !VBOX_USB_WITH_SYSFS */#
endif /* !VBOX_USB_WITH_SYSFS */ * Stop all service threads and free the device chain. * If any Usbfs-related resources are currently allocated, then free them * and mark them as freed. * Don't think we need to do anything when the device is held... fake it. Log((
"USBProxyServiceLinux::releaseDevice: %p\n",
aDevice));
* We're not really holding it atm., just fake it. LogRel((
"USBProxy: Device %04x:%04x (%s) has become accessible.\n",
* A device was added, we need to adjust mUdevPolls. * See USBProxyService::deviceAdded for details. LogRel((
"USBProxy: Device %04x:%04x (%s) isn't accessible. giving udev a few seconds to fix this...\n",
/** String written to the wakeup pipe. */ /** Length of the string written. */ /* Cap the wait interval if we're polling for udevd changing device permissions. */ #
else /* !VBOX_USB_WITH_SYSFS */#
endif /* !VBOX_USB_WITH_SYSFS */#
endif /* VBOX_USB_WITH_SYSFS */