VirtualBox

Changeset 3891

Show
Ignore:
Timestamp:
07/26/07 20:28:51 (1 year ago)
Author:
vboxsync
Message:

Some sketchy PDMUsb changes (disabled of course).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r3875 r3891  
    32833283    } 
    32843284 
     3285#if 1 
    32853286    /* Don't proceed unless we've found the usb controller. */ 
    32863287    PPDMIBASE pBase = NULL; 
     
    32973298 
    32983299    HRESULT rc = attachUSBDevice (aDevice, pRhConfig); 
     3300#else /* PDMUsb */ 
     3301    /* Don't proceed unless there's a USB hub. */ 
     3302    if (!PDMR3USBHasHub (m_VM)) 
     3303    { 
     3304        LogFlowThisFunc (("Attach request ignored (no USB controller).\n")); 
     3305        return E_FAIL; 
     3306    } 
     3307 
     3308    HRESULT rc = attachUSBDevice (aDevice); 
     3309#endif /* PDMUsb */ 
    32993310 
    33003311    if (FAILED (rc)) 
     
    42834294 *  @note Must be called from under this object's lock. 
    42844295 */ 
     4296#if 1 
    42854297HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig) 
    42864298{ 
    42874299    AssertReturn (aHostDevice && aConfig, E_FAIL); 
     4300#else /* PDMUsb */ 
     4301HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice) 
     4302{ 
     4303    AssertReturn (aHostDevice, E_FAIL); 
     4304#endif 
    42884305 
    42894306    AssertReturn (isLockedOnCurrentThread(), E_FAIL); 
     
    43244341    alock.leave(); 
    43254342 
     4343#if 1 
    43264344    PVMREQ pReq = NULL; 
    43274345    int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 
     
    43294347                           this, aHostDevice, 
    43304348                           aConfig, Uuid.ptr(), fRemote, Address.raw(), pvRemote); 
     4349#else /* PDMUsb */ 
     4350    PVMREQ pReq = NULL; 
     4351    int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 
     4352                           (PFNRT) usbAttachCallback, 5, this, aHostDevice, aConfig, Uuid.ptr(), fRemote, Address.raw()); 
     4353#endif /* PDMUsb */ 
    43314354    if (VBOX_SUCCESS (vrc)) 
    43324355        vrc = pReq->iStatus; 
     
    43724395 *  @note Locks the console object for writing. 
    43734396 */ 
    4374 //static 
     4397#if 1 
    43754398DECLCALLBACK(int) 
    43764399Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, 
     
    44244447    return vrc; 
    44254448} 
     4449#else /* PDMUsb */ 
     4450//static 
     4451DECLCALLBACK(int) 
     4452Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, const char *aAddress) 
     4453{ 
     4454    LogFlowFuncEnter(); 
     4455    LogFlowFunc (("that={%p}\n", that)); 
     4456 
     4457    AssertReturn (that && aConfig && aUuid, VERR_INVALID_PARAMETER); 
     4458 
     4459    if (aRemote) 
     4460    { 
     4461        RemoteUSBDevice *pRemoteUSBDevice = static_cast <RemoteUSBDevice *> (aHostDevice); 
     4462        Guid guid (*aUuid); 
     4463 
     4464        aRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid); 
     4465        if (!aRemoteBackend) 
     4466            return VERR_INVALID_PARAMETER;  /* The clientId is invalid then. */ 
     4467    } 
     4468 
     4469    int vrc = PDMR3USBCreateProxyDevice (mVM, aUuid, aRemote, aAddress, aRemoteBackend); 
     4470    if (VBOX_SUCCESS (vrc)) 
     4471    { 
     4472        /* Create a OUSBDevice and add it to the device list */ 
     4473        ComObjPtr <OUSBDevice> device; 
     4474        device.createObject(); 
     4475        HRESULT hrc = device->init (aHostDevice); 
     4476        AssertComRC (hrc); 
     4477 
     4478        AutoLock alock (that); 
     4479        that->mUSBDevices.push_back (device); 
     4480        LogFlowFunc (("Attached device {%Vuuid}\n", device->id().raw())); 
     4481 
     4482        /* notify callbacks */ 
     4483        that->onUSBDeviceStateChange (device, true /* aAttached */, NULL); 
     4484    } 
     4485 
     4486    LogFlowFunc (("vrc=%Vrc\n", vrc)); 
     4487    LogFlowFuncLeave(); 
     4488    return vrc; 
     4489} 
     4490#endif /* PDMUsb */ 
    44264491 
    44274492/** 
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r3720 r3891  
    383383                                          const char *pszPath, bool fPassthrough); 
    384384 
     385#if 1 
    385386    HRESULT attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig); 
    386387    HRESULT detachUSBDevice (USBDeviceList::iterator &aIt); 
     
    390391                       PVUSBIRHCONFIG aConfig, PCRTUUID aUuid, bool aRemote, 
    391392                       const char *aAddress, void *aRemoteBackend); 
     393#else /* PDMUsb coding. */ 
     394    HRESULT attachUSBDevice (IUSBDevice *aHostDevice); 
     395    HRESULT detachUSBDevice (USBDeviceList::iterator &aIt); 
     396 
     397    static DECLCALLBACK(int) 
     398    usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, 
     399                       bool aRemote, const char *aAddress, void *aRemoteBackend); 
     400#endif /* PDMUsb coding. */ 
    392401    static DECLCALLBACK(int) 
    393402    usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, 
     
    535544    } 
    536545    mCallbackData; 
    537      
     546 
    538547    friend struct VMTask; 
    539548}; 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy