VirtualBox

Changeset 59117 in vbox for trunk/src/VBox/Devices/USB


Ignore:
Timestamp:
Dec 14, 2015 2:04:37 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
104688
Message:

USB,Main: Rework USBProxyService. Split it into a USBProxyService and USBProxyBackend class, USBProxyService can use multiple USBProxyBackend instances as sources for USB devices to attach to a VM which will be used for USB/IP support. Change the PDM USB API to contain a backend parameter instead of a remote flag to indicate the USB backend to use for the given device.

Location:
trunk/src/VBox/Devices/USB
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/USBProxyDevice.cpp

    r59089 r59117  
    4040static char g_szDummyName[] = "proxy xxxx:yyyy";
    4141
    42 
     42/**
     43 * Array of supported proxy backends.
     44 */
     45static PCUSBPROXYBACK g_aUsbProxies[] =
     46{
     47    &g_USBProxyDeviceHost,
     48    &g_USBProxyDeviceVRDP,
     49    &g_USBProxyDeviceUsbIp
     50};
    4351
    4452/* Synchronously obtain a standard USB descriptor for a device, used in order
     
    847855    AssertRCReturn(rc, rc);
    848856
    849     bool fRemote;
    850     rc = CFGMR3QueryBool(pCfg, "Remote", &fRemote);
     857    char szBackend[64];
     858    rc = CFGMR3QueryString(pCfg, "Backend", szBackend, sizeof(szBackend));
    851859    AssertRCReturn(rc, rc);
    852860
     
    858866     * Select backend and open the device.
    859867     */
    860     if (!fRemote)
    861         pThis->pOps = &g_USBProxyDeviceHost;
    862     else
    863         pThis->pOps = &g_USBProxyDeviceVRDP;
     868    rc = VERR_NOT_FOUND;
     869    for (unsigned i = 0; i < RT_ELEMENTS(g_aUsbProxies); i++)
     870    {
     871        if (!RTStrICmp(szBackend, g_aUsbProxies[i]->pszName))
     872        {
     873            pThis->pOps = g_aUsbProxies[i];
     874            rc = VINF_SUCCESS;
     875            break;
     876        }
     877    }
     878    if (RT_FAILURE(rc))
     879        return PDMUSB_SET_ERROR(pUsbIns, rc, N_("USBProxy: Failed to find backend"));
    864880
    865881    pThis->pvInstanceDataR3 = RTMemAllocZ(pThis->pOps->cbBackend);
  • trunk/src/VBox/Devices/USB/USBProxyDevice.h

    r58158 r59117  
    175175/** The remote desktop backend. */
    176176extern const USBPROXYBACK g_USBProxyDeviceVRDP;
     177/** The USB/IP backend. */
     178extern const USBPROXYBACK g_USBProxyDeviceUsbIp;
    177179
    178180#ifdef RDESKTOP
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