Perform a hardware reset of a specific USB dongle ANT, HID device, with Delphi app.
I have tried to use the CM_Request_Device_Eject
function and it correctly ejects my device, but on some systems does not automatically start it again.
This is the code I've used for the device eject:
str := PChar(GetDeviceID(DeviceInfoData.DevInst));
status := CM_Locate_DevNodeA(dev, str, CM_LOCATE_DEVNODE_NORMAL);
status := CM_Request_Device_EjectA(dev, nil, '', 0, 0);
Is there a way to ensure that my device will start if it does not automatically start after eject when using this function ?
As an alternative I've tried to use the SetupDiRestartDevices
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:
rslt1 := SetupDiRestartDevices(hDevInfo, DeviceInfoData);
How can I reset only my device with this function ?
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 ?
Hard reset is not something you can do just of your own... to do a hard reset to some device, that particular device must support hard reset... ways hard reset varies from device to device. some devices have a button on it to do a hard reset. some requires a piece of code. most of the company releases a set of AT-command lists for there specific devices..
for example.. here is list of at commands released by the manufacturer for there specific device
this can help you in this case... if not keep googling.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With