To avoid any unlikely incident like loss of data, Windows prompts you to Safely remove hardware like external hard drives and USB drives. Even after doing this, if the USB port continues to remain active for safely removed hardware and continues to receive USB packets and consume power corresponding to an active device state, then you need to modify a Registry value.
USB port remains active even after using Safely remove hardware
When a USB device is ‘Disabled‘ in Device Manager or Safely Removed using the system tray icon, a Remove Device request (PnP IRP IRP_MN_REMOVE_DEVICE) is issued by the system to perform a ‘Soft Removal‘ of the USB device. As a consequence of this action, the USB device is marked as ‘Removed for Plug and Play’ purposes only. The device, however, has not been physically disconnected yet.
Please note that the method requires you to make changes to the Registry Editor. Before you edit the registry, export the keys in the registry that you plan to edit or back up the whole registry. If a problem occurs, you can restore the registry to its previous state.
To apply the workaround globally for all enumerated USB devices, KB2401954 suggests the following.
Press Win+R in combination to open the ‘Run’ dialog box. Type ‘regedit.exe’ and press ‘Enter’.
After navigating to the path address given above, create a new key ‘hubg’ under ‘usbhub’.
For this, right-click the ‘usbhub’ folder, choose ‘New’ and select the ‘Key’ option. Name the key as ‘hubg’.
Now, click ‘hubg’ and switch to the right pane. There, right-click in the space and choose ‘New’.
Next, select ‘DWORD (32-bit) Value’. Name the key as ‘DisableOnSoftRemove’.
When done, double click on ‘DisableOnSoftRemove’ and choose ‘Hexadecimal’.
Change the Value Data to ‘1’ and hit the ‘OK’ button.
Exit the Registry Editor and restart your computer.
You have successfully configured your PC to disable USB Port when you have Safely Removed USB hardware in Windows.
Effects of NOT disabling USB port on Soft Remove
When a USB port is not disabled on its soft removal, it may exhibit the following behavior-
LED lights remain illuminated, indicating the USB device is still active
USB device continues to consume power as it still receives USB packets
If disconnected abruptly (physically), the Disabled or Safely Removed USB device may interfere with the process of active transfer to a different USB device.
Effects of disabling USB port on Soft Remove
The effects of disabling USB port on Soft Removal are not clearly known. It is likely that this workaround may influence the stability of USB device enumeration and power-management operations.
Effects of Soft Removing a USB device
If an attached USB device is removed softly, but not physically disconnected, the USB hub (including a Root Hub) to which the device is attached will not enter a USB Suspend state (Selective Suspend of the hub itself). The method will also prevent the USB Host Controller from entering a Global Suspend state.
In comparison to the power consumed when Hub or Global Suspend is in use, preventing the two while the Soft Removed USB device is still connected may result in a rise in power consumption. When the Soft Removed USB device is disconnected from the USB hub port, the hub will be ready to enter a USB Suspend state and the USB Host Controller in a Global Suspend state.
Actions that help in removing a USB device softly:
Disabling the USB device in Device Manager
Using the Safely Remove Hardware icon in the notification area.
Programmatically disabling the USB device via SetupDiRemoveDevice API.
A post-graduate in Biotechnology, Hemant switched gears to writing about Microsoft technologies and has been a contributor to TheWindowsClub since then. When he is not working, you can usually find him out traveling to different places or indulging himself in binge-watching.