VirtualBox

Changeset 3392 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 3, 2007 2:54:26 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
22590
Message:

First part of fix for udevd::chmod vs. VBoxSVC race on attach.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/USBProxyService.cpp

    r3035 r3392  
    276276                    Log (("USBProxyService::processChanges: attached %p/%p:{.idVendor=%#06x, .idProduct=%#06x, .pszProduct=\"%s\", .pszManufacturer=\"%s\"}\n",
    277277                          (HostUSBDevice *)NewObj, pNew, pNew->idVendor, pNew->idProduct, pNew->pszProduct, pNew->pszManufacturer));
    278 
    279                     /* not really necessary to lock here, but make Assert
    280                      * checks happy */
     278                    deviceAdded (NewObj, pNew);
     279
     280                    /* Not really necessary to lock here, but make Assert checks happy. */
    281281                    AutoLock newDevLock (NewObj);
    282282
     
    293293                    {
    294294                        It = mDevices.erase (It);
     295                        deviceRemoved (DevPtr);
    295296                        mHost->onUSBDeviceDetached (DevPtr);
    296297                        Log (("USBProxyService::processChanges: detached %p\n",
     
    380381
    381382
    382 /*static*/ void USBProxyService::freeDevice (PUSBDEVICE pDevice)
     383/*static*/ void USBProxyService::freeDeviceMembers (PUSBDEVICE pDevice)
    383384{
    384385    PUSBCONFIG pCfg = pDevice->paConfigurations;
     
    419420    RTStrFree ((char *)pDevice->pszAddress);
    420421    pDevice->pszAddress = NULL;
    421 
     422}
     423
     424/*static*/ void USBProxyService::freeDevice (PUSBDEVICE pDevice)
     425{
     426    freeDeviceMembers (pDevice);
    422427    RTMemFree (pDevice);
    423 
    424428}
    425429
     
    520524
    521525
    522 int USBProxyService::captureDevice (HostUSBDevice *pDevice)
     526int USBProxyService::captureDevice (HostUSBDevice */*aDevice*/)
    523527{
    524528    return VERR_NOT_IMPLEMENTED;
     
    526530
    527531
    528 int USBProxyService::holdDevice (HostUSBDevice *pDevice)
     532int USBProxyService::holdDevice (HostUSBDevice */*aDevice*/)
    529533{
    530534    return VERR_NOT_IMPLEMENTED;
     
    532536
    533537
    534 int USBProxyService::releaseDevice (HostUSBDevice *pDevice)
     538int USBProxyService::releaseDevice (HostUSBDevice */*aDevice*/)
    535539{
    536540    return VERR_NOT_IMPLEMENTED;
     
    538542
    539543
    540 int USBProxyService::resetDevice (HostUSBDevice *pDevice)
     544int USBProxyService::resetDevice (HostUSBDevice */*aDevice*/)
    541545{
    542546    return VERR_NOT_IMPLEMENTED;
     
    544548
    545549
    546 bool USBProxyService::updateDeviceState (HostUSBDevice *pDevice, PUSBDEVICE pUSBDevice)
    547 {
    548     AssertReturn (pDevice, false);
    549     AssertReturn (pDevice->isLockedOnCurrentThread(), false);
    550 
    551     return pDevice->updateState (pUSBDevice);
    552 }
    553 
     550bool USBProxyService::updateDeviceState (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice)
     551{
     552    AssertReturn (aDevice, false);
     553    AssertReturn (aDevice->isLockedOnCurrentThread(), false);
     554
     555    return aDevice->updateState (aUSBDevice);
     556}
     557
     558
     559void USBProxyService::deviceAdded (HostUSBDevice */*aDevice*/, PUSBDEVICE /*aUSBDevice*/)
     560{
     561}
     562
     563
     564void USBProxyService::deviceRemoved (HostUSBDevice */*aDevice*/)
     565{
     566}
     567
  • trunk/src/VBox/Main/include/HostUSBDeviceImpl.h

    r3034 r3392  
    140140     * Only used for host devices. */
    141141    PUSBDEVICE mUsb;
     142
     143    friend class USBProxyService;
     144#ifdef __LINUX__
     145    friend class USBProxyServiceLinux;
     146#endif
    142147};
    143148
  • trunk/src/VBox/Main/include/USBProxyService.h

    r2981 r3392  
    8888     *
    8989     * @returns true if there is a state change.
    90      * @param   pDevice     The device in question.
    91      * @param   pUSBDevice  The USB device structure for the last enumeration.
    92      */
    93     virtual bool updateDeviceState (HostUSBDevice *pDevice, PUSBDEVICE pUSBDevice);
     90     * @param   aDevice     The device in question.
     91     * @param   aUSBDevice  The USB device structure for the last enumeration.
     92     */
     93    virtual bool updateDeviceState (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice);
     94
     95    /**
     96     * Add device notification hook for the OS specific code.
     97     *
     98     * @param   aDevice     The device in question.
     99     * @param   aUSBDevice  The USB device structure.
     100     */
     101    virtual void deviceAdded (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice);
     102
     103    /**
     104     * Remove device notification hook for the OS specific code.
     105     *
     106     * @param   aDevice     The device in question.
     107     */
     108    virtual void deviceRemoved (HostUSBDevice *aDevice);
    94109
    95110    /**
     
    182197
    183198public:
     199    /**
     200     * Free all the members of a USB device returned by getDevice().
     201     *
     202     * @param   pDevice     Pointer to the device.
     203     */
     204    static void freeDeviceMembers (PUSBDEVICE pDevice);
     205
    184206    /**
    185207     * Free one USB device returned by getDevice().
     
    282304    virtual int resetDevice (HostUSBDevice *aDevice);
    283305    virtual bool updateDeviceState (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice);
     306    virtual void deviceAdded (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice);
    284307
    285308protected:
     
    287310    virtual int interruptWait (void);
    288311    virtual PUSBDEVICE getDevices (void);
     312    int addDeviceToChain (PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, int rc);
    289313
    290314private:
     
    299323    /** The root of usbfs. */
    300324    Utf8Str mUsbfsRoot;
     325    /** Number of 500ms polls left to do. See usbDeterminState for details. */
     326    unsigned mUdevPolls;
    301327};
    302328# endif /* __LINUX__ */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette