Beispiel #1
0
BOOL RescanDevices()
{
    DEVINST rootnode;
    CM_WaitNoPendingInstallEvents(INFINITE);
    if(CM_Locate_DevNode(&rootnode, NULL, CM_LOCATE_DEVNODE_NORMAL) != CR_SUCCESS)
        return FALSE;
    if(CM_Reenumerate_DevNode(rootnode, CM_REENUMERATE_NORMAL) != CR_SUCCESS)
        return FALSE;
    return TRUE;
}
Beispiel #2
0
/*
 * Force the re-enumeration of a device and all of its children
 * This causes driver installation for devices where either the driver
 * is already available, or for devices where a device_id was not provided,
 * yet that are plugged in.
 * If device_id is NULL, this call re-enumerates all devices
 */
int enumerate_device(char* device_id)
{
	DEVINST dev_inst;
	CONFIGRET status;

	plog("re-enumerating driver node %s...", device_id?device_id:"<root>");
	status = CM_Locate_DevNodeA(&dev_inst, device_id, 0);
	if (status != CR_SUCCESS) {
		plog("failed to locate device_id %s: %x\n", device_id?device_id:"<root>", status);
		return -1;
	}

	status = CM_Reenumerate_DevNode(dev_inst, CM_REENUMERATE_RETRY_INSTALLATION);
	if (status != CR_SUCCESS) {
		plog("failed to re-enumerate device node: CR code %X", status);
		return -1;
	}

	plog("re-enumeration succeeded...");
	return 0;
}
static bool ScanForHardwareChanges()
{
	DEVINST     devInst;
	CONFIGRET   status;
	//
	// Get the root devnode.
	//
	status = CM_Locate_DevNode(&devInst, NULL, CM_LOCATE_DEVNODE_NORMAL);
	if (status != CR_SUCCESS) {
		runtime_error("CM_Locate_DevNode failed.");
		return false;

	}

	status = CM_Reenumerate_DevNode(devInst, 0);
	if (status != CR_SUCCESS) {
		runtime_error("CM_Reenumerate_DevNode failed.");
		return false;
	}

	return true;
}
Beispiel #4
0
bool ReenumerateDeviceNode(PSP_DEVINFO_DATA pDevInfoData)
{
  return CM_Reenumerate_DevNode(pDevInfoData->DevInst, 0) == CR_SUCCESS;
}