Aller au contenu


Killua

Inscrit(e) (le) 07 mars 2016
Déconnecté Dernière activité mars 26 2020 18:15
*****

#991427 [TUTO] Tester fusée gelée sur Windows

Posté par eliboa - 26 mai 2018 - 14:35

Peut-être en utilisant EnumDeviceDrivers pour tester si un appareil avec le driver libusbK est connecté ?

Même si je suis aussi d'accord que la solution actuelle est déjà une bonne solution.

Finalement ce que j'avais fait ne marchait pas  :mad: du coup j'ai regardé ton lien qui m'a aidé mais de fil en aiguille j'ai trouvé une solution encore plus simple avec la fonction SetupDiGetDeviceRegistryProperty (en recherchant directement le vendor et product id du périphérique) et après y'a plus qu'a installer les drivers si TegraRcmSmash ne reconnait pas le mode RCM  :P. Merci ;)

BOOL CTegraRcmGUIDlg::LookForAPXDevice()
{
	unsigned index;
	HDEVINFO hDevInfo;
	SP_DEVINFO_DATA DeviceInfoData;
	TCHAR HardwareID[1024];
	// List all connected USB devices
	hDevInfo = SetupDiGetClassDevs(NULL, TEXT("USB"), NULL, DIGCF_PRESENT | DIGCF_ALLCLASSES);
	for (index = 0; ; index++) {
		DeviceInfoData.cbSize = sizeof(DeviceInfoData);
		if (!SetupDiEnumDeviceInfo(hDevInfo, index, &DeviceInfoData)) {
			return FALSE;     // no match
		}
		SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_HARDWAREID, NULL, (BYTE*)HardwareID, sizeof(HardwareID), NULL);
		if (_tcsstr(HardwareID, _T("VID_0955&PID_7321"))) {
			return TRUE;     // match
		}
	}
	return FALSE;
}