USBProxyServiceFreeBSD.cpp revision b52c24239bed9dc9f284d829b6059073afcb1894
/* $Id$ */
/** @file
* VirtualBox USB Proxy Service, FreeBSD Specialization.
*/
/*
* Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "USBProxyService.h"
#include "Logging.h"
#include <iprt/semaphore.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/*******************************************************************************
* Global Variables *
*******************************************************************************/
/**
* 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.
*/
/*
* Create semaphore.
*/
if (RT_FAILURE(rc))
{
mLastError = rc;
return E_FAIL;
}
/*
* Start the poller thread.
*/
start();
return S_OK;
}
/**
* Stop all service threads and free the device chain.
*/
{
LogFlowThisFunc(("\n"));
/*
* Stop the service.
*/
if (isActive())
stop();
}
{
/*
* Don't think we need to do anything when the device is held... fake it.
*/
return VINF_SUCCESS;
}
{
/*
* We're not really holding it atm., just fake it.
*/
return VINF_SUCCESS;
}
bool USBProxyServiceFreeBSD::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
{
}
/**
* A device was added, we need to adjust mUdevPolls.
*
* See USBProxyService::deviceAdded for details.
*/
void USBProxyServiceFreeBSD::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice)
{
}
{
}
int USBProxyServiceFreeBSD::interruptWait(void)
{
return RTSemEventSignal(mNotifyEventSem);
}
/**
* Dumps a USBDEVICE structure to the log using LogLevel 3.
* @param pDev The structure to log.
* @todo This is really common code.
*/
{
Log3(("USB device:\n"));
Log3(("Device speed: %s\n",
: "invalid"));
Log3(("Device state: %s\n",
: "invalid"));
}
{
int FileUsb = 0;
int iBus = 0;
int iAddr = 1;
int rc = VINF_SUCCESS;
char *pszDevicePath = NULL;
for (;;)
{
if (RT_FAILURE(rc))
{
mLastError = rc;
break;
}
if (FileUsb < 0)
{
{
iAddr = 1;
iBus++;
continue;
}
{
/* Skip devices without the right permission. */
iAddr++;
continue;
}
else
break;
}
struct usb_device_info UsbDevInfo;
if (rc < 0)
{
break;
}
/* Filter out hubs */
{
if (!pDevice)
{
break;
}
switch (UsbDevInfo.udi_speed)
{
case USB_SPEED_LOW:
break;
case USB_SPEED_FULL:
break;
case USB_SPEED_HIGH:
break;
case USB_SPEED_SUPER:
case USB_SPEED_VARIABLE:
default:
}
{
}
if (pDevices)
}
iAddr++;
}
return pDevices;
}