1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

OP GCS/HID - function to filter based on VID/PID

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2965 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
zedamota 2011-03-04 20:49:18 +00:00 committed by zedamota
parent fe6b41e6f9
commit ea5d4367b4

View File

@ -70,9 +70,9 @@ QList<USBPortInfo> USBMonitor::availableDevices(int vid, int pid, int bcdDevice)
QList<USBPortInfo> thePortsWeWant;
foreach (USBPortInfo port, allPorts) {
thePortsWeWant.append(port);
if((port.vendorID==vid || vid==-1) && (port.productID==pid || vid==-1) && (port.bcdDevice==bcdDevice || bcdDevice==-1))
thePortsWeWant.append(port);
}
return thePortsWeWant;
}
@ -229,8 +229,11 @@ void USBMonitor::enumerateDevicesWin( const GUID & guid, QList<USBPortInfo>* inf
devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for(DWORD i = 0; SetupDiEnumDeviceInfo(devInfo, i, &devInfoData); i++)
{
if(infoFromHandle(guid,info,devInfo,i)!=0)
int r=infoFromHandle(guid,info,devInfo,i);
if(r==1)
infoList->append(info);
else if (r==0)
break;
}
SetupDiDestroyDeviceInfoList(devInfo);