USBProxyDevice-linux.c revision 9307de3e1372410024fc582230f23bec4b30e918
/** @file
*
* VUSB Device - USB Device Proxy, the Linux backend.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** Define NO_PORT_RESET to skip the slow and broken linux port reset.
* Resetting will break PalmOne. */
#define NO_PORT_RESET
/** Define NO_LOGICAL_RECONNECT to skip the broken logical reconnect handling. */
#define NO_LOGICAL_RECONNECT
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_DRV_USBPROXY
#endif
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#ifdef VBOX_WITH_LINUX_COMPILER_H
# include <linux/compiler.h>
#endif
#include <linux/usbdevice_fs.h>
/*
* Backlevel 2.4 headers doesn't have these two defines.
* They were added some time between 2.4.21 and 2.4.26, probably in 2.4.23.
*/
#ifndef USBDEVFS_DISCONNECT
#endif
#ifndef USBDEVFS_URB_SHORT_NOT_OK
# define USBDEVFS_URB_SHORT_NOT_OK 0 /* rhel3 doesn't have this. darn! */
#endif
/* FedoraCore 4 does not have the bit defined by default. */
#ifndef POLLWRNORM
# define POLLWRNORM 0x0100
#endif
# include "../USBProxyDevice.h"
#else
# include "../rdesktop.h"
# include "vrdpusb.h"
#endif
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* Wrapper around the linux urb request structure.
* This is required to track in-flight and landed URBs.
*/
typedef struct USBPROXYURBLNX
{
/** The kernel URB data */
struct usbdevfs_urb KUrb;
/** The millisecond timestamp when this URB was submitted. */
/** Pointer to the next linux URB. */
struct USBPROXYURBLNX *pNext;
/** Pointer to the previous linux URB. */
struct USBPROXYURBLNX *pPrev;
/** If we've split the VUSBURB up into multiple linux URBs, this is points to the head. */
struct USBPROXYURBLNX *pSplitHead;
/** The next linux URB if split up. */
struct USBPROXYURBLNX *pSplitNext;
/** Whether it has timed out and should be shot down on the next failing reap call. */
bool fTimedOut;
/** Indicates that this URB has been canceled by timeout and should return an CRC error. */
bool fCanceledByTimedOut;
/** Don't report these back. */
bool fCanceledBySubmit;
/** This split element is reaped. */
bool fSplitElementReaped;
/**
* Data for the linux usb proxy backend.
*/
typedef struct USBPROXYDEVLNX
{
/** The open file. */
/** Critical section protecting the two lists. */
/** The list of free linux URBs. Singly linked. */
/** The list of active linux URBs. Doubly linked.
* We must maintain this so we can properly reap URBs of a detached device.
* Only the split head will appear in this list. */
/** The list of landed linux URBs. Doubly linked.
* Only the split head will appear in this list. */
/** The tail of the landed linux URBs. */
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
static int usbProxyLinuxDoIoCtl(PUSBPROXYDEV pProxyDev, int iCmd, void *pvArg, bool fHandleNoDev, uint32_t cTries);
static int usbProxyLinuxFindActiveConfig(PUSBPROXYDEV pProxyDev, const char *pszAddress, int *iFirstCfg);
/**
* Wrapper for the ioctl call.
*
* This wrapper will repeate the call if we get an EINTR or EAGAIN. It can also
* handle ENODEV (detached device) errors.
*
* @returns whatever ioctl returns.
* @param pProxyDev The proxy device.
* @param iCmd The ioctl command / function.
* @param pvArg The ioctl argument / data.
* @param fHandleNoDev Whether to handle ENODEV.
* @param cTries The number of retries. Use UINT32_MAX for (kind of) indefinite retries.
* @internal
*/
static int usbProxyLinuxDoIoCtl(PUSBPROXYDEV pProxyDev, int iCmd, void *pvArg, bool fHandleNoDev, uint32_t cTries)
{
int rc;
do
{
do
{
if (rc >= 0)
return rc;
{
break;
}
break;
} while (cTries-- > 0);
return rc;
}
/**
* The device has been unplugged.
* Cancel all in-flight URBs and put them up for reaping.
*/
{
/*
* Shoot down all flying URBs.
*/
while (pUrbLnx)
{
/* insert into the taxing list. */
if ( !pCur->pSplitHead
{
if (pUrbTaxing)
pUrbTaxing = pCur;
}
else
}
/* Append the URBs we shot down to the taxing queue. */
if (pUrbTaxing)
{
if (pUrbTaxing->pPrev)
else
}
}
/**
* Set the connect state seen by kernel drivers
* @internal
*/
{
struct usbdevfs_ioctl IoCtl;
if (!fQuiet)
LogFlow(("usbProxyLinuxSetConnected: pProxyDev=%p[%s] iIf=%#x fConnect=%d\n",
&& !fQuiet)
Log(("usbProxyLinuxSetConnected: failure, errno=%d. pProxyDev=%p[%s]\n",
}
/**
* Allocates a linux URB request structure.
* @returns Pointer to an active URB request.
* @returns NULL on failure.
* @param pProxyDev The proxy device instance.
* @param pSplitHead The split list head if allocating for a split list.
*/
{
/*
* Try remove a linux URB from the free list, if none there allocate a new one.
*/
if (pUrbLnx)
else
{
if (!pUrbLnx)
return NULL;
}
pUrbLnx->fCanceledByTimedOut = false;
pUrbLnx->fCanceledBySubmit = false;
pUrbLnx->fSplitElementReaped = false;
/*
* Link it into the active list
*/
if (!pSplitHead)
{
}
else
return pUrbLnx;
}
/**
* Frees a linux URB request structure.
*
* @param pProxyDev The proxy device instance.
* @param pUrbLnx The linux URB to free.
*/
{
/*
* Remove from the active list.
*/
if ( !pUrbLnx->pSplitHead
{
else
}
/*
* Link it into the free list.
*/
}
/**
* Frees split list of a linux URB request structure.
*
* @param pProxyDev The proxy device instance.
* @param pUrbLnx A linux URB to in the split list to be freed.
*/
{
while (pUrbLnx)
{
}
}
/**
* the config with an asterix.
*
* @returns The Cfg#.
* @returns -1 if no active config.
* @param pszAddress The path to the device. We infere the location of the
* devices file, which bus and device number we're looking for.
* @param iFirstCfg The first configuration. (optional)
* @internal
*/
static int usbProxyLinuxFindActiveConfig(PUSBPROXYDEV pProxyDev, const char *pszAddress, int *piFirstCfg)
{
/*
* Set return defaults.
*/
int iActiveCfg = -1;
if (piFirstCfg)
*piFirstCfg = 1;
/*
* Interpret the address and turn it into a path to the devices file.
*/
/* the device number */
while (*psz != '/')
psz--;
if (RT_SUCCESS(rc))
{
/* the bus number */
*psz-- = '\0';
while (*psz != '/')
psz--;
if (RT_SUCCESS(rc))
{
/*
* Open and scan the devices file.
* We're ASSUMING that each device starts off with a 'T:' line.
*/
if (RT_SUCCESS(rc))
{
char szLine[1024];
{
/* we're only interested in 'T:' lines. */
continue;
/* Skip ahead to 'Bus' and compare */
char *pszNext;
uint32_t u;
if (RT_FAILURE(rc))
continue;
if (u != uBus)
continue;
/* Skip ahead to 'Dev#' and compare */
if (!psz)
continue;
if (RT_FAILURE(rc))
continue;
if (u != uDev)
continue;
/*
* Ok, we've found the device.
* Scan until we find a selected configuration, the next device, or EOF.
*/
{
if (psz[0] == 'T')
break;
continue;
if (!fActive && !piFirstCfg)
continue;
/* Get the 'Cfg#' value. */
if (psz)
{
if (RT_SUCCESS(rc))
{
if (piFirstCfg)
{
*piFirstCfg = u;
piFirstCfg = NULL;
}
if (fActive)
iActiveCfg = u;
}
}
if (fActive)
break;
}
break;
}
}
}
}
return iActiveCfg;
}
{
if (pProxyDev)
{
if (pDevLnx)
{
}
}
return -1;
}
/**
*
* @returns VBox status code.
* @param pProxyDev The device instance.
* @param pszAddress The path to the device.
* @param pvBackend Backend specific pointer, unused for the linux backend.
*/
{
if (RT_SUCCESS(rc))
{
/*
* Allocate and initialize the linux backend data.
*/
if (pDevLnx)
{
if (RT_SUCCESS(rc))
{
/* brute force rulez */
unsigned iIf;
/*
* Determin the active configuration.
*
* If there isn't any active configuration, we will get EHOSTUNREACH (113) errors
* when trying to read the device descriptors in usbProxyDevCreate. So, we'll make
* the first one active (usually 1) then.
*/
int iFirstCfg;
{
Log(("usbProxyLinuxOpen: No active config! Tried to set %d: iActiveCfg=%d\n", iFirstCfg, pProxyDev->iActiveCfg));
}
LogFlow(("usbProxyLinuxOpen(%p, %s): returns successfully File=%d iActiveCfg=%d\n",
return VINF_SUCCESS;
}
}
else
rc = VERR_NO_MEMORY;
}
else if (rc == VERR_ACCESS_DENIED)
return rc;
}
/**
* Closes the proxy device.
*/
{
if (!pDevLnx)
return;
/*
* Try put the device in a state which linux can cope with before we release it.
* Resetting it would be a nice start, although we must remember
* that it might have been disconnected...
*/
/* ASSUMES: thread == EMT */
{
/* Connect drivers. */
unsigned iIf;
}
else
/*
* Now we can close it and free all the resources.
*/
{
if (pUrbLnx->pSplitHead)
{
while (pCur)
{
if ( !pFree->fSplitElementReaped
}
}
else
}
{
}
LogFlow(("usbProxyLinuxClose: returns\n"));
}
#if defined(NO_PORT_RESET) && !defined(NO_LOGICAL_RECONNECT)
/**
* Look for the logically reconnected device.
* After 5 seconds we'll give up.
*
* @returns VBox status code.
* @thread Reset thread or EMT.
*/
{
Log2(("usb_reset_logical_reconnect: pDev=%p:{.bBus=%#x, .bDevNum=%#x, .idVendor=%#x, .idProduct=%#x, .bcdDevice=%#x, .u64SerialHash=%#llx .bDevNumParent=%#x .bPort=%#x .bLevel=%#x}\n",
pDev, pDev->Info.bBus, pDev->Info.bDevNum, pDev->Info.idVendor, pDev->Info.idProduct, pDev->Info.bcdDevice,
/* First, let hubd get a chance to logically reconnect the device. */
if (!RTThreadYield())
RTThreadSleep(1);
/*
* Search for the new device address.
*/
pFile = get_devices_file();
if (!pFile)
return VERR_FILE_NOT_FOUND;
/*
* Loop until found or 5seconds have elapsed.
*/
for (;;) {
int rc;
char buf[512];
int got = 0;
struct usb_dev_entry id = {0};
/*
* Since this is kernel ABI we don't need to be too fussy about
* the parsing.
*/
AssertMsgFailed(("usb_reset_logical_reconnect: Line to long!!\n"));
break;
}
*psz = '\0';
switch ( buf[0] ) {
case 'T': /* topology */
/* Check if we've got enough for a device. */
if (got >= 2) {
Log2(("usb_reset_logical_reconnect: {.bBus=%#x, .bDevNum=%#x, .idVendor=%#x, .idProduct=%#x, .bcdDevice=%#x, .u64SerialHash=%#llx, .bDevNumParent=%#x, .bPort=%#x, .bLevel=%#x}\n",
id.bBus, id.bDevNum, id.idVendor, id.idProduct, id.bcdDevice, id.u64SerialHash, id.bDevNumParent, id.bPort, id.bLevel));
goto l_found;
}
}
/* restart */
got = 0;
/*T: Bus=04 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0*/
break;
while ( *psz == ' ' )
psz++;
break;
break;
break;
break;
got++;
break;
case 'P': /* product */
break;
break;
break;
break;
got++;
break;
case 'S': /* String descriptor */
/* Skip past "S:" and then the whitespace */
break;
/* If it is a serial number string, skip past
* "SerialNumber="
*/
break;
break;
}
}
/*
* Check last.
*/
if ( got >= 2
/* close the existing file descriptor. */
/* open stuff at the new address. */
return VINF_SUCCESS;
break;
}
/*
* Wait for a while and then check the file again.
*/
break; /* done */
if (rc < 0) {
}
} /* for loop */
return VERR_GENERAL_FAILURE;
}
#endif /* !NO_PORT_RESET && !NO_LOGICAL_RECONNECT */
/**
* Reset a device.
*
* @returns VBox status code.
* @param pDev The device to reset.
*/
{
#ifdef NO_PORT_RESET
LogFlow(("usbProxyLinuxReset: pProxyDev=%p[%s] - NO_PORT_RESET\n", pProxyDev, pProxyDev->Dev.pszName));
#else /* !NO_PORT_RESET */
# ifndef NO_LOGICAL_RECONNECT
# endif
{
# ifndef NO_LOGICAL_RECONNECT
{
/*
* This usually happens because of a 'logical disconnection'.
* So, we're in for a real treat from our excellent OS now...
*/
if (RT_FAILURE(rc2))
if (RT_SUCCESS(rc2))
{
LogFlow(("usbProxyLinuxReset: returns success (after recovering disconnected device!)\n"));
return VINF_SUCCESS;
}
}
# endif /* NO_LOGICAL_RECONNECT */
return RTErrConvertFromErrno(rc);
}
# ifndef NO_LOGICAL_RECONNECT
# endif
LogFlow(("usbProxyLinuxReset: returns success\n"));
#endif /* !NO_PORT_RESET */
return VINF_SUCCESS;
}
/**
* SET_CONFIGURATION.
*
* The caller makes sure that it's not called first time after open or reset
* with the active interface.
*
* @returns success indicator.
* @param pProxyDev The device instance data.
* @param iCfg The configuration to set.
*/
{
LogFlow(("usbProxyLinuxSetConfig: pProxyDev=%p[%s] cfg=%#x\n",
{
return false;
}
return true;
}
/**
* Claims an interface.
* @returns success indicator.
*/
{
LogFlow(("usbProxyLinuxClaimInterface: pProxyDev=%p[%s] ifnum=%#x\n", pProxyDev, pProxyDev->Dev.pszName, iIf));
{
Log(("usb-linux: Claim interface. errno=%d pProxyDev=%p[%s]\n", errno, pProxyDev, pProxyDev->Dev.pszName));
return false;
}
return true;
}
/**
* Releases an interface.
* @returns success indicator.
*/
{
LogFlow(("usbProxyLinuxReleaseInterface: pProxyDev=%p[%s] ifnum=%#x\n", pProxyDev, pProxyDev->Dev.pszName, iIf));
{
Log(("usb-linux: Release interface, errno=%d. pProxyDev=%p[%s]\n", errno, pProxyDev, pProxyDev->Dev.pszName));
return false;
}
return true;
}
/**
* SET_INTERFACE.
*
* @returns success indicator.
*/
{
struct usbdevfs_setinterface SetIf;
{
Log(("usb-linux: Set interface, errno=%d. pProxyDev=%p[%s]\n", errno, pProxyDev, pProxyDev->Dev.pszName));
return false;
}
return true;
}
/**
* Clears the halted endpoint 'EndPt'.
*/
{
LogFlow(("usbProxyLinuxClearHaltedEp: pProxyDev=%p[%s] EndPt=%u\n", pProxyDev, pProxyDev->Dev.pszName, EndPt));
{
/*
* Unfortunately this doesn't work on control pipes.
* Windows doing this on the default endpoint and possibly other pipes too,
* so we'll feign success for ENOENT errors.
*/
{
Log(("usb-linux: clear_halted_ep failed errno=%d. pProxyDev=%p[%s] ep=%d - IGNORED\n",
return true;
}
Log(("usb-linux: clear_halted_ep failed errno=%d. pProxyDev=%p[%s] ep=%d\n",
return false;
}
return true;
}
/**
* Setup packet byte-swapping routines.
*/
{
}
/** The split size. */
#define SPLIT_SIZE 0x2000
/**
* Try split up a VUSB URB into smaller URBs which the
* linux kernel can deal with.
*
* @returns true / false.
* @param pProxyDev The proxy device.
* @param pUrbLnx The linux URB which was rejected because of being too big.
* @param pUrb The VUSB URB.
*/
static int usbProxyLinuxUrbQueueSplit(PUSBPROXYDEV pProxyDev, PUSBPROXYURBLNX pUrbLnx, PVUSBURB pUrb)
{
unsigned cTries;
/*
* Split it up into SPLIT_SIZE sized blocks.
*/
/* the first one (already allocated) */
{
default: /* shut up gcc */
}
/* the rest. */
unsigned i;
for (i = 1; i < cKUrbs; i++)
{
if (!pCur)
{
return false;
}
}
/*
* Submit them.
*/
bool fUnplugged = false;
bool fFailed = false;
{
cTries = 0;
{
continue;
{
Log(("usbProxyLinuxUrbQueueSplit: ENODEV -> unplugged. pProxyDev=%p[%s]\n", pProxyDev, pProxyDev->Dev.pszName));
fFailed = fUnplugged = true;
break;
}
Log(("usb-linux: Queue URB %p -> %d!!! type=%d ep=%#x buffer_length=%#x cTries=%d\n",
continue;
fFailed = true;
break;
}
if (fFailed)
break;
}
if (!fFailed)
{
LogFlow(("usbProxyLinuxUrbQueueSplit: ok\n"));
return true;
}
/*
* Clean up.
*/
/* discard and reap later (walking with pUrbLnx). */
{
for (;;)
{
pUrbLnx->fCanceledBySubmit = true;
{
fUnplugged = true;
pUrbLnx->fSplitElementReaped = true;
else
LogRel(("SUB: Failed to discard %p! errno=%d (pUrb=%p)\n", pUrbLnx->KUrb.usercontext, errno, pUrb)); /* serious! */
}
{
break;
}
}
}
/* free the unsubmitted ones. */
while (pCur)
{
}
/* send unplug event if we failed with ENODEV originally. */
if (fUnplugged)
return false;
}
/**
* @copydoc USBPROXYBACK::pfbUrbQueue
*/
{
unsigned cTries;
LogFlow(("usbProxyLinuxUrbQueue: pProxyDev=%p[%s] pUrb=%p EndPt=%d cbData=%d\n",
/*
* Allocate a linux urb.
*/
if (!pUrbLnx)
return false;
{
case VUSBXFERTYPE_MSG:
{
return false;
}
LogFlow(("usbProxyLinuxUrbQueue: message\n"));
break;
case VUSBXFERTYPE_BULK:
break;
case VUSBXFERTYPE_ISOC:
break;
case VUSBXFERTYPE_INTR:
break;
default:
goto l_err;
}
{
case VUSBDIRECTION_IN:
break;
case VUSBDIRECTION_OUT:
break;
default:
goto l_err;
}
/*
* Submit it.
*/
cTries = 0;
{
continue;
{
Log(("usbProxyLinuxUrbQueue: ENODEV -> unplugged. pProxyDev=%p[%s]\n", pProxyDev, pProxyDev->Dev.pszName));
return false;
}
/*
* usbfs has or used to have a low buffer limit (16KB) in order to prevent
* processes wasting kmalloc'ed memory. It will return EINVAL if break that
* limit, and we'll have to split the VUSB URB up into multiple linux URBs.
*
* Since this is a limit which is subject to change, we cannot check for it
* before submitting the URB. We just have to try and fail.
*/
Log(("usb-linux: Queue URB %p -> %d!!! type=%d ep=%#x buffer_length=%#x cTries=%d\n",
continue;
return false;
}
LogFlow(("usbProxyLinuxUrbQueue: ok\n"));
return true;
}
/**
* Check if any or the in-flight URBs are taking too long and should be cancelled.
*
* Cancelling is done in three turns, first a URB is marked for timeout if it's
* exceeding a certain time limit. Then the next time it's encountered it is actually
* cancelled. The idea now is that it's supposed to be reaped and returned in the next
* round of calls.
*
* @param pProxyDev The proxy device.
* @param pDevLnx The linux backend data.
*
* @todo Make the HCI do proper timeout handling! Current timeout is 3 min and 20 seconds
* as not to break bloomberg which queues IN packages with 3 min timeouts.
*/
{
pCur;
{
{
if (pCur->pSplitHead)
{
/* split */
unsigned cFailures = 0;
{
if (pCur2->fSplitElementReaped)
continue;
pCur2->fCanceledByTimedOut = true;
Log(("vusbProxyLinuxUrbDoTimeouts: pUrb=%p failed errno=%d (!!split!!)\n", pCur2->KUrb.usercontext, errno));
else
goto l_leave; /* ENODEV means break and everything cancelled elsewhere. */
}
LogRel(("USB: Cancelled URB (%p) after %lldms!! (cFailures=%d)\n",
}
else
{
/* unsplit */
{
pCur->fCanceledByTimedOut = true;
LogRel(("USB: Cancelled URB (%p) after %lldms!!\n", pCur->KUrb.usercontext, u64MilliTS - pCur->u64SubmitTS));
}
else
goto l_leave; /* ENODEV means break and everything cancelled elsewhere. */
}
}
else if (u64MilliTS - pCur->u64SubmitTS >= 200*1000 /* 200 sec (180 sec has been observed with XP) */)
}
}
/**
* Get and translates the linux status to a VUSB status.
*/
{
{
case 0:
if (!pUrbLnx->fCanceledByTimedOut)
return VUSBSTATUS_OK;
/* fall thru */
case -EILSEQ:
return VUSBSTATUS_CRC;
case -EREMOTEIO: /* ehci and ohci uses this for underflow error. */
return VUSBSTATUS_UNDERFLOW;
case -ENODEV:
return VUSBSTATUS_DNR;
//case -ECOMM:
// return VUSBSTATUS_BUFFER_OVERRUN;
//case -ENOSR:
// return VUSBSTATUS_BUFFER_UNDERRUN;
//case -EPROTO:
// return VUSBSTATUS_BIT_STUFFING;
default:
return VUSBSTATUS_STALL;
}
}
/**
* Reap URBs in-flight on a device.
*
* @returns Pointer to a completed URB.
* @returns NULL if no URB was completed.
* @param pProxyDev The device.
* @param cMillies Number of milliseconds to wait. Use 0 to not wait at all.
*/
{
/*
* Any URBs pending delivery?
*/
if (pDevLnx->pTaxingHead)
{
if (pUrbLnx)
{
/* unlink from the pending delivery list */
{
}
else
/* temporarily into the active list, so free works right. */
}
}
if (!pUrbLnx)
{
/*
* Don't block if nothing is in the air.
*/
if (!pDevLnx->pInFlightHead)
return NULL;
/*
* Block for requested period.
*
* It seems to me that the path of poll() is shorter and
* involves less semaphores than ioctl() on usbfs. So, we'll
* do a poll regardless of whether cMillies == 0 or not.
*/
if (cMillies)
{
for (;;)
{
int rc;
if (rc >= 1)
break;
if (rc >= 0 /*|| errno == ETIMEOUT*/)
{
return NULL;
}
{
Log(("usb-linux: Reap URB - poll -> %d errno=%d pProxyDev=%p[%s]\n", rc, errno, pProxyDev, pProxyDev->Dev.pszName));
return NULL;
}
Log(("usbProxyLinuxUrbReap: poll again - weird!!!\n"));
}
}
/*
* Reap URBs, non-blocking.
*/
for (;;)
{
struct usbdevfs_urb *pKUrb;
{
else
Log(("usb-linux: Reap URB. errno=%d pProxyDev=%p[%s]\n", errno, pProxyDev, pProxyDev->Dev.pszName));
return NULL;
}
/* split list: Is the entire split list done yet? */
if (pUrbLnx->pSplitHead)
{
pUrbLnx->fSplitElementReaped = true;
if (!pCur->fSplitElementReaped)
{
break;
}
if (!pUrbLnx)
continue;
}
break;
}
}
/*
* Ok, we got one!
*/
if ( pUrb
&& !pUrbLnx->fCanceledBySubmit)
{
if (pUrbLnx->pSplitHead)
{
/* split - find the end byte and the first error status. */
{
}
}
else
{
/* unsplit. */
}
/* some adjustments for message transfers. */
{
}
}
else
{
}
LogFlow(("usbProxyLinuxUrbReap: dev=%p[%s] returns %p\n", pProxyDev, pProxyDev->Dev.pszName, pUrb));
return pUrb;
}
/**
* Cancels the URB.
* The URB requires reaping, so we don't change its state.
*/
{
if (pUrbLnx->pSplitHead)
{
/* split */
{
if (pCur->fSplitElementReaped)
continue;
continue;
break;
Log(("usb-linux: Discard URB %p failed, errno=%d. pProxyDev=%p[%s]!!! (split)\n",
}
}
else
{
/* unsplit */
Log(("usb-linux: Discard URB %p failed, errno=%d. pProxyDev=%p[%s]!!!\n",
}
}
/**
* The Linux USB Proxy Backend.
*/
#ifdef __cplusplus
extern
#endif
const USBPROXYBACK g_USBProxyDeviceHost =
{
"host",
0
};
/*
* Local Variables:
* mode: c
* c-file-style: "bsd"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: s
* End:
*/