Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 8546)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 8547)
@@ -2011,5 +2011,4 @@
             Guid (aId).raw());
 
-# if defined(RT_OS_DARWIN) || defined(NEW_HOSTUSBDEVICE_STATE)
     /*
      * Inform the USB device and USB proxy about what's cooking.
@@ -2020,12 +2019,4 @@
         return rc2;
     alock.enter();
-#  ifndef NEW_HOSTUSBDEVICE_STATE
-    for (it = mUSBDevices.begin(); it != mUSBDevices.end(); ++ it)
-        if ((*it)->id() == aId)
-            break;
-    if (it == mUSBDevices.end())
-        return S_OK;
-#  endif
-# endif
 
     /* Request the PDM to detach the USB device. */
Index: /trunk/src/VBox/Main/HostImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/HostImpl.cpp	(revision 8546)
+++ /trunk/src/VBox/Main/HostImpl.cpp	(revision 8547)
@@ -1349,5 +1349,4 @@
     AutoWriteLock devLock (device);
 
-#ifdef NEW_HOSTUSBDEVICE_STATE
     /*
      * Work the state machine.
@@ -1369,53 +1368,4 @@
     }
     return hrc;
-
-#else  /* !NEW_HOSTUSBDEVICE_STATE */
-
-    LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d aDone=%RTbool\n",
-                      device->id().raw(), device->state(), device->isStatePending(),
-                      device->pendingState(), aDone));
-    HRESULT rc = S_OK;
-    if (!aDone)
-    {
-        if (device->isStatePending())
-            rc = setError (E_INVALIDARG,
-                tr ("USB device '%s' with UUID {%Vuuid} is busy (waiting for a pending "
-                    "state change). Please try later"),
-                             device->name().raw(), device->id().raw());
-        else
-            mUSBProxyService->detachingDevice (device);
-    }
-    else
-    {
-        if (device->isStatePending())
-        {
-            /* If an async detach operation is still pending (darwin), postpone
-               the setHeld() + the re-applying of filters until it is completed.
-               We indicate this by moving to the '*Filters' state variant. */
-            if (device->pendingStateEx() == HostUSBDevice::kDetachingPendingAttach)
-                device->setLogicalReconnect (HostUSBDevice::kDetachingPendingAttachFilters);
-            else if (device->pendingStateEx() == HostUSBDevice::kDetachingPendingDetach)
-                device->setLogicalReconnect (HostUSBDevice::kDetachingPendingDetachFilters);
-            else
-            {
-                Assert (device->pendingStateEx() == HostUSBDevice::kNothingPending);
-                rc = setError (E_INVALIDARG,
-                    tr ("USB device '%s' with UUID {%Vuuid} is busy (waiting for a pending "
-                        "state change). Please try later"),
-                                 device->name().raw(), device->id().raw());
-            }
-        }
-        else
-        {
-            ComAssertRet (device->machine() == aMachine, E_FAIL);
-
-            /* re-apply filters on the device before giving it back to the host */
-            device->setHeld();
-            rc = applyAllUSBFilters (device, aMachine);
-            ComAssertComRC (rc);
-        }
-    }
-    return rc;
-#endif /* !NEW_HOSTUSBDEVICE_STATE */
 }
 
@@ -1447,22 +1397,8 @@
         ComObjPtr <HostUSBDevice> device = *it;
         AutoWriteLock devLock (device);
-#ifdef NEW_HOSTUSBDEVICE_STATE
         if (   device->unistate() == kHostUSBDeviceState_HeldByProxy
             || device->unistate() == kHostUSBDeviceState_Unused
             || device->unistate() == kHostUSBDeviceState_Capturable)
             applyMachineUSBFilters(aMachine, device);
-#else /* !NEW_HOSTUSBDEVICE_STATE */
-
-        /* skip pending devices */
-        if (device->isStatePending())
-            continue;
-
-        if (device->state() == USBDeviceState_Busy ||
-            device->state() == USBDeviceState_Available ||
-            device->state() == USBDeviceState_Held)
-        {
-            applyMachineUSBFilters (aMachine, device);
-        }
-#endif /* !NEW_HOSTUSBDEVICE_STATE */
     }
 
@@ -1495,5 +1431,4 @@
         if (device->machine() == aMachine)
         {
-# ifdef NEW_HOSTUSBDEVICE_STATE
             /*
              * Same procedure as in detachUSBDevice().
@@ -1508,26 +1443,4 @@
                 ComAssertComRC(hrc2);
             }
-# else  /* !NEW_HOSTUSBDEVICE_STATE */
-            if (!aDone)
-            {
-                if (!device->isStatePending())
-                    mUSBProxyService->detachingDevice (device);
-            }
-            else
-            {
-                if (!device->isStatePending())
-                {
-                    Assert (device->state() == USBDeviceState_Captured);
-
-                    /* re-apply filters on the device before giving it back to the
-                     * host */
-                    device->setHeld();
-                    HRESULT rc = applyAllUSBFilters (device, aMachine);
-                    AssertComRC (rc);
-                }
-                else if (device->pendingStateEx() == HostUSBDevice::kNothingPending)
-                    device->cancelPendingState();
-            }
-# endif  /* !NEW_HOSTUSBDEVICE_STATE */
         }
         ++ it;
@@ -2048,5 +1961,4 @@
     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
     AssertReturn(aDevice->isWriteLockOnCurrentThread(), E_FAIL);
-#ifdef NEW_HOSTUSBDEVICE_STATE
     /* Quietly ignore unsupported and unavailable device. */
     if (    aDevice->unistate() == kHostUSBDeviceState_UsedByHost
@@ -2056,17 +1968,4 @@
         return S_OK;
     }
-
-#else  /* !NEW_HOSTUSBDEVICE_STATE */
-    AssertReturn(aDevice->state() != USBDeviceState_Captured, E_FAIL);
-
-    AssertReturn(aDevice->isStatePending() == false, E_FAIL);
-
-    /* ignore unsupported devices */
-    if (aDevice->state() == USBDeviceState_NotSupported)
-        return S_OK;
-    /* ignore unavailable devices as well */
-    if (aDevice->state() == USBDeviceState_Unavailable)
-        return S_OK;
-#endif /* !NEW_HOSTUSBDEVICE_STATE */
 
     VirtualBox::SessionMachineVector machines;
@@ -2157,11 +2056,5 @@
     AssertReturn(isWriteLockOnCurrentThread(), false);
     AssertReturn(aDevice->isWriteLockOnCurrentThread(), false);
-#ifdef NEW_HOSTUSBDEVICE_STATE
     /* Let HostUSBDevice::requestCaptureToVM() validate the state. */
-#else  /* !NEW_HOSTUSBDEVICE_STATE */
-    AssertReturn (aDevice->state() != USBDeviceState_NotSupported, false);
-    AssertReturn (aDevice->state() != USBDeviceState_Unavailable, false);
-    AssertReturn (aDevice->isStatePending() == false, false);
-#endif /* !NEW_HOSTUSBDEVICE_STATE */
 
     ULONG maskedIfs;
@@ -2192,13 +2085,6 @@
     AssertReturnVoid(isWriteLockOnCurrentThread());
     AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
-#ifdef NEW_HOSTUSBDEVICE_STATE
     LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
                      aDevice, aDevice->name().raw(), aDevice->stateName(), aDevice->id().raw()));
-#else
-    LogFlowThisFunc (("aDevice=%p id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
-                      aDevice, aDevice->id().raw(), aDevice->state(), aDevice->isStatePending(),
-                      aDevice->pendingState()));
-    Assert (aDevice->isStatePending() == false);
-#endif
 
     /* add to the collecion */
@@ -2225,12 +2111,6 @@
     AssertReturnVoid(isWriteLockOnCurrentThread());
     AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
-#ifdef NEW_HOSTUSBDEVICE_STATE
     LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
                      aDevice, aDevice->name().raw(), aDevice->stateName(), aDevice->id().raw()));
-#else
-    LogFlowThisFunc (("aDevice=%p id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
-                      aDevice, aDevice->id().raw(), aDevice->state(), aDevice->isStatePending(),
-                      aDevice->pendingState()));
-#endif
 
     /*
@@ -2270,9 +2150,5 @@
  * @param   aIgnoreMachine  The machine to ignore when running filters.
  */
-#ifdef NEW_HOSTUSBDEVICE_STATE
 void Host::onUSBDeviceStateChanged (HostUSBDevice *aDevice, bool aRunFilters, SessionMachine *aIgnoreMachine)
-#else
-void Host::onUSBDeviceStateChanged (HostUSBDevice *aDevice)
-#endif
 {
     /*
@@ -2283,14 +2159,7 @@
     AssertReturnVoid(isWriteLockOnCurrentThread());
     AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
-#ifdef NEW_HOSTUSBDEVICE_STATE
     LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
                      aDevice, aDevice->name().raw(), aDevice->stateName(), aDevice->id().raw()));
-#else
-    LogFlowThisFunc (("aDevice=%p id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
-                      aDevice, aDevice->id().raw(), aDevice->state(), aDevice->isStatePending(),
-                      aDevice->pendingState()));
-#endif
-
-# ifdef NEW_HOSTUSBDEVICE_STATE
+
     /*
      * Run filters if requested to do so.
@@ -2302,49 +2171,4 @@
         AssertComRC(rc);
     }
-# else  /* !NEW_HOSTUSBDEVICE_STATE */
-    ComObjPtr <HostUSBDevice> device (aDevice);
-    if (device->isStatePending())
-    {
-        /* it was a state change request */
-        if (device->pendingStateEx() == HostUSBDevice::kDetachingPendingAttachFilters)
-        {
-            /* The device has completed an asynchronous detach operation, subject
-               it to the filters and such if the current state permits this.
-               (handlePendingStateChange will disassociate itself from the machine.) */
-            ComObjPtr <SessionMachine> machine (device->machine());
-            device->handlePendingStateChange();
-            if (device->state() == USBDeviceState_Captured)
-            {
-                Log (("USB: running filters on async detached device\n"));
-                device->setHeld();
-                HRESULT rc = applyAllUSBFilters (device, machine);
-                AssertComRC (rc);
-            }
-            else
-                Log (("USB: async detached devices reappeared in stated %d instead of %d!\n",
-                      device->state(), USBDeviceState_Captured));
-        }
-        else
-            device->handlePendingStateChange();
-    }
-    else if (   device->state() == USBDeviceState_Available
-             || device->state() == USBDeviceState_Busy)
-    {
-        /* The device has gone from being unavailable (not subject to filters) to being
-           available / busy. This transition can be triggered by udevd or manual
-           permission changes on Linux. On all systems may be triggered by the host
-           ceasing to use the device - like unmounting an MSD in the Finder or invoking
-           the "Safely remove XXXX" stuff on Windows (perhaps). */
-        HRESULT rc = applyAllUSBFilters (device);
-        AssertComRC (rc);
-    }
-    else
-    {
-        /* some external state change */
-
-        /// @todo re-run all USB filters probably
-        AssertFailed();
-    }
-# endif /* !NEW_HOSTUSBDEVICE_STATE */
 }
 #endif /* VBOX_WITH_USB */
Index: /trunk/src/VBox/Main/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Main/Makefile.kmk	(revision 8546)
+++ /trunk/src/VBox/Main/Makefile.kmk	(revision 8547)
@@ -47,7 +47,4 @@
  endif
  VBOX_MAIN_DEFS += VBOX_WITH_UNIXY_TAP_NETWORKING
-endif
-if1of ($(BUILD_TARGET), darwin linux win) # this is only temporary, all targets will use this soon.
- VBOX_MAIN_DEFS += NEW_HOSTUSBDEVICE_STATE
 endif
 ifneq ($(VBOX_VERSION_MAJOR)$(VBOX_VERSION_MINOR)$(VBOX_VERSION_BUILD),160)
Index: /trunk/src/VBox/Main/include/HostImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/HostImpl.h	(revision 8546)
+++ /trunk/src/VBox/Main/include/HostImpl.h	(revision 8547)
@@ -121,9 +121,5 @@
     void onUSBDeviceAttached (HostUSBDevice *aDevice);
     void onUSBDeviceDetached (HostUSBDevice *aDevice);
-#ifdef NEW_HOSTUSBDEVICE_STATE
     void onUSBDeviceStateChanged(HostUSBDevice *aDevice, bool aRunFilters, SessionMachine *aIgnoreMachine);
-#else
-    void onUSBDeviceStateChanged(HostUSBDevice *aDevice);
-#endif
 
     /* must be called from under this object's lock */
