And since V3.0 RestartSrDev can cycle the USB device's USB port to avoid
restarting the hub with other devices attached. This works under XP with
USB ports running with the Windows standard driver and again since
Windows 8 but here it needs admin privileges.
//----------------------------------------------------------------------------------------
typedef struct _USB_CYCLE_PORT_PARAMS {
ULONG ConnectionIndex;
ULONG StatusReturned;
} USB_CYCLE_PORT_PARAMS, *PUSB_CYCLE_PORT_PARAMS;
bool CycleUsbPort(HANDLE hHub, ULONG PortNumber)
{
USB_CYCLE_PORT_PARAMS CyclePortParams = { PortNumber, 0 };
DWORD dwBytes;
int res = DeviceIoControl(hHub, IOCTL_USB_HUB_CYCLE_PORT,
&CyclePortParams, sizeof(CyclePortParams),
&CyclePortParams, sizeof(CyclePortParams),
&dwBytes, NULL);
return (res!=0 && CyclePortParams.StatusReturned==0 );
}
//----------------------------------------------------------------------------------------
See USBview how to determine hub and port number.
Uwe