HID Devices anzeigen in winCE



  • Hallo Leute,

    undter Windos hole ich mir alle HID Devices mit einer bestimmten Vendor unt Produkt Id wie unten im Code.

    Wie mache ich das selbe in Windows CE 6.0. Dort gibt es ja die Setupapi.lib nicht?

    TWord CreateListOfDevices()
    {
    	PSP_DEVICE_INTERFACE_DETAIL_DATA	pspdidd;
    	SP_DEVICE_INTERFACE_DATA			spdid;
    	SP_DEVINFO_DATA						spdd;
    	HDEVINFO							hDevInfo;
    	DWORD								dwIndex, dwSize;
    	GUID								guid;
    	WORD								uwResult;
    	HANDLE								h;
    	HIDD_ATTRIBUTES						HIDAttributes;
    	tDeviceListEntry					*pDeviceListEntry;
    	char								*pString;
    	BYTE								rubiSerialNumberwchar[32];
    	BYTE								rubiSerialNumber[16];
    	int									i;
    
    	uwResult=0;
    
    	ZeroMemory(&spdid, sizeof(spdid));
    	spdid.cbSize = sizeof(spdid);
    	HidD_GetHidGuid(&guid);
    
        hDevInfo = SetupDiGetClassDevs(&guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
    	if(hDevInfo != INVALID_HANDLE_VALUE)
    	{
    		for(dwIndex = 0; (SetupDiEnumDeviceInterfaces(hDevInfo, NULL, &guid, dwIndex, &spdid)); dwIndex++)
    		{
    			dwSize = 0;
    			SetupDiGetDeviceInterfaceDetail(hDevInfo, &spdid, NULL, 0, &dwSize, NULL);
    			if (dwSize)
    			{
    				if (pspdidd = (PSP_DEVICE_INTERFACE_DETAIL_DATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize))
    				{
    					pspdidd->cbSize = sizeof(*pspdidd);
    					ZeroMemory((PVOID)&spdd, sizeof(spdd));
    					spdd.cbSize = sizeof(spdd);
    					if(SetupDiGetDeviceInterfaceDetail(hDevInfo, &spdid, pspdidd, dwSize, &dwSize, &spdd))
    					{
    						//get the name of the device for CreateFile
    						h = CreateFile(pspdidd->DevicePath, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ,
    								NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
    						HIDAttributes.Size = sizeof(HIDD_ATTRIBUTES);
    						HidD_GetAttributes(h, &HIDAttributes);
    						if ((VID == HIDAttributes.VendorID) && (PID == HIDAttributes.ProductID))
    						{
    							if(HidD_GetSerialNumberString(h, rubiSerialNumberwchar,32))
    							{
    
    							}
    						}
    						CloseHandle(h);
    						HeapFree(GetProcessHeap(), 0, pspdidd);
    					}
    				}
    			}
    		}
    		SetupDiDestroyDeviceInfoList(hDevInfo);
    	}
    
    	return uwResult;
    }
    


  • im Windows CE 6.0 Platform Builder

    kann ich den mitgelieferten HID Treiber (USB Human Input Device (HID) Class Driver) aktivieren.

    Nur welche funktionen benötige ich um ihn zu benutzen?

    MfG


Anmelden zum Antworten