title: How to perform a hardware reset of a specific HID device?
body: <h2>The aim</h2>
  
  <p>Perform a hardware reset of a specific USB dongle ANT, HID device, with Delphi app.</p>
  
  <hr>
  
  <h2>1. CM_Request_Device_Eject function attempt</h2>
  
  <p>I have tried to use the <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff539806%28v=vs.85%29.aspx" rel="noreferrer"><code>CM_Request_Device_Eject</code></a> function and it correctly ejects my device, but on some systems does not automatically start it again.</p>
  
  <p>This is the code I've used for the device eject:</p>
  
  <pre><code>str := PChar(GetDeviceID(DeviceInfoData.DevInst));
  status := CM_Locate_DevNodeA(dev, str, CM_LOCATE_DEVNODE_NORMAL);
  status := CM_Request_Device_EjectA(dev, nil, '', 0, 0);
  </code></pre>
  
  <p>Is there a way to ensure that my device will start if it does not automatically start after eject when using this function ?</p>
  
  <hr>
  
  <h2>2. SetupDiRestartDevices function attempt</h2>
  
  <p>As an alternative I've tried to use the <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff552104%28v=vs.85%29.aspx" rel="noreferrer"><code>SetupDiRestartDevices</code></a> function and this one properly resets my device, but except that resets all the HID devices (such as mouse, keyboard, etc.), and this function requires administrator rights to work:</p>
  
  <pre><code>rslt1 := SetupDiRestartDevices(hDevInfo, DeviceInfoData);
  </code></pre>
  
  <p>How can I reset only my device with this function ?</p>
  
  <hr>
  
  <h2>Question</h2>
  
  <p>Is there a generic, recommended way to perform a hardware reset of a specific USB HID device ? Or is there a way to resolve any of the above problems ?</p>