VirtualBox

Changeset 57994 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Oct 1, 2015 7:56:39 PM (9 years ago)
Author:
vboxsync
Message:

HostUSBDeviceImpl: Fixed wrong state transition in i_failTransition when the device reappers but is not actually captured as we expect.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp

    r57990 r57994  
    455455    {
    456456        alock.acquire();
    457         i_failTransition();
     457        i_failTransition(kHostUSBDeviceState_Invalid);
    458458        mMachine.setNull();
    459459        if (rc == VERR_SHARING_VIOLATION)
     
    714714    {
    715715        alock.acquire();
    716         i_failTransition();
     716        i_failTransition(kHostUSBDeviceState_Invalid);
    717717        return E_FAIL;
    718718    }
     
    767767    {
    768768        alock.acquire();
    769         i_failTransition();
     769        i_failTransition(kHostUSBDeviceState_Invalid);
    770770        return E_FAIL;
    771771    }
     
    814814                    {
    815815                        LogRel(("USB: Async operation timed out for device %s (state: %s)\n", mName, i_getStateName()));
    816                         i_failTransition();
     816                        i_failTransition(kHostUSBDeviceState_PhysDetached);
    817817                    }
    818818#endif
     
    11961196                    /* Can only mean that we've failed capturing it. */
    11971197                    case kHostUSBDeviceState_Capturing:
    1198                         LogThisFunc(("{%s} capture failed!\n", mName));
     1198                        LogThisFunc(("{%s} capture failed! (#1)\n", mName));
    11991199                        mUSBProxyService->captureDeviceCompleted(this, false /* aSuccess */);
    1200                         *aRunFilters = i_failTransition();
     1200                        *aRunFilters = i_failTransition(kHostUSBDeviceState_UsedByHost);
    12011201                        mMachine.setNull();
    12021202                        break;
     
    12641264                    /* Can only mean that we've failed capturing it. */
    12651265                    case kHostUSBDeviceState_Capturing:
    1266                         LogThisFunc(("{%s} capture failed!\n", mName));
     1266                        LogThisFunc(("{%s} capture failed! (#2)\n", mName));
    12671267                        mUSBProxyService->captureDeviceCompleted(this, false /* aSuccess */);
    1268                         *aRunFilters = i_failTransition();
     1268                        *aRunFilters = i_failTransition(kHostUSBDeviceState_Capturable);
    12691269                        mMachine.setNull();
    12701270                        break;
     
    13321332#endif
    13331333                        {
    1334                             LogThisFunc(("{%s} capture failed!\n", mName));
     1334                            LogThisFunc(("{%s} capture failed! (#3)\n", mName));
    13351335                            mUSBProxyService->captureDeviceCompleted(this, false /* aSuccess */);
    1336                             *aRunFilters = i_failTransition();
     1336                            *aRunFilters = i_failTransition(kHostUSBDeviceState_Unused);
    13371337                            mMachine.setNull();
    13381338                        }
     
    14691469             && i_hasAsyncOperationTimedOut())
    14701470    {
    1471         LogRel(("USB: timeout in %s for {%RTuuid} / {%s}\n",
    1472                 i_getStateName(), mId.raw(), mName));
    1473         *aRunFilters = i_failTransition();
     1471        LogRel(("USB: timeout in %s for {%RTuuid} / {%s}\n", i_getStateName(), mId.raw(), mName));
     1472        *aRunFilters = i_failTransition(kHostUSBDeviceState_Invalid);
    14741473        fIsImportant = true;
    14751474    }
     
    20192018                case kHostUSBDeviceState_Capturable:
    20202019                case kHostUSBDeviceState_Unused:
    2021                     Assert(aNewState == mPrevUniState);
     2020                    Assert(aNewState == mPrevUniState); /** @todo This is kind of wrong, see i_failTransition. */
    20222021                    Assert(aNewPendingState == kHostUSBDeviceState_Invalid);
    20232022                    Assert(aNewSubState == kHostUSBDeviceSubState_Default);
     
    24122411 *
    24132412 * @return true if filters should be applied to the device, false if not.
     2413 * @param   a_enmStateHint  USB device state hint. kHostUSBDeviceState_Invalid
     2414 *                          if the caller doesn't have a clue to give.
    24142415 *
    24152416 * @note    The caller must own the write lock for this object.
    24162417 */
    2417 bool HostUSBDevice::i_failTransition()
     2418bool HostUSBDevice::i_failTransition(HostUSBDeviceState a_enmStateHint)
    24182419{
    24192420    AssertReturn(isWriteLockOnCurrentThread(), false);
     
    24412442                case kHostUSBDeviceSubState_AwaitingReAttach:
    24422443                    enmSub = kHostUSBDeviceSubState_Default;
    2443                     enmState = kHostUSBDeviceState_PhysDetached;
     2444                    if (a_enmStateHint != kHostUSBDeviceState_Invalid)
     2445                        enmState = mPrevUniState; /** @todo enmState = a_enmStateHint is more correct, but i_setState doesn't like it. It will usually correct itself shortly. */
     2446                    else
     2447                        enmState = kHostUSBDeviceState_PhysDetached;
    24442448                    break;
    24452449                default:
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