Skip to content

Commit 6655c2a

Browse files
committed
Use hardware IDs instead of instance IDs
1 parent 89207c0 commit 6655c2a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

libnw/devtree.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ WCHAR* NWL_GetDevStrProp(DEVINST devInst, const DEVPROPKEY* pKey)
3939
}
4040

4141
static void
42-
GetDeviceInfoDefault(PNODE node, void* data, DEVINST devInst, LPCWSTR instanceId)
42+
GetDeviceInfoDefault(PNODE node, void* data, DEVINST devInst, LPCWSTR hwIds)
4343
{
4444
(void)data;
45-
NWL_NodeAttrSet(node, "HWID", NWL_Ucs2ToUtf8(instanceId), 0);
45+
NWL_NodeAttrSet(node, "HWID", NWL_Ucs2ToUtf8(hwIds), 0);
4646

4747
WCHAR* name = NWL_GetDevStrProp(devInst, &DEVPKEY_NAME);
4848
if (name)
@@ -67,16 +67,16 @@ NWL_EnumerateDevices(PNODE parent, DEVTREE_ENUM_CTX* ctx, DEVINST devInst)
6767
{
6868
PNODE node = parent;
6969
DEVINST childInst;
70-
WCHAR* instanceId = NWL_GetDevStrProp(devInst, &DEVPKEY_Device_InstanceId);
70+
WCHAR* hwIds = NWL_GetDevStrProp(devInst, &DEVPKEY_Device_HardwareIds);
7171

72-
if (instanceId)
72+
if (hwIds)
7373
{
74-
if (ctx->filter[0] == L'\0' || _wcsnicmp(instanceId, ctx->filter, ctx->filterLen) == 0)
74+
if (ctx->filter[0] == L'\0' || _wcsnicmp(hwIds, ctx->filter, ctx->filterLen) == 0)
7575
{
7676
node = NWL_NodeAppendNew(AppendDevices(parent, ctx->hub), "Device", NFLG_TABLE_ROW);
77-
ctx->GetDeviceInfo(node, ctx->data, devInst, instanceId);
77+
ctx->GetDeviceInfo(node, ctx->data, devInst, hwIds);
7878
}
79-
free(instanceId);
79+
free(hwIds);
8080
}
8181

8282
if (CM_Get_Child(&childInst, devInst, 0) == CR_SUCCESS)

libnw/devtree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ typedef struct _DEVTREE_ENUM_CTX
1414
size_t filterLen;
1515
const char* hub;
1616
void* data;
17-
void (*GetDeviceInfo)(PNODE node, void* data, DEVINST devInst, LPCWSTR instanceId);
17+
void (*GetDeviceInfo)(PNODE node, void* data, DEVINST devInst, LPCWSTR hwIds);
1818
} DEVTREE_ENUM_CTX;
1919

2020
WCHAR* NWL_GetDevStrProp(DEVINST devInst, const DEVPROPKEY* pKey);

libnw/usb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ ParseHwClass(PNODE nd, CHAR* ids, DWORD idsSize, LPCWSTR compId)
8484
}
8585

8686
static void
87-
GetDeviceInfoUsb(PNODE node, void* data, DEVINST devInst, LPCWSTR instanceId)
87+
GetDeviceInfoUsb(PNODE node, void* data, DEVINST devInst, LPCWSTR hwIds)
8888
{
8989
DEVTREE_CTX* ctx = (DEVTREE_CTX*)data;
90-
NWL_NodeAttrSet(node, "HWID", NWL_Ucs2ToUtf8(instanceId), 0);
90+
NWL_NodeAttrSet(node, "HWID", NWL_Ucs2ToUtf8(hwIds), 0);
9191

92-
NWL_ParseHwid(node, ctx->ids, ctx->idsSize, instanceId, 1);
92+
NWL_ParseHwid(node, ctx->ids, ctx->idsSize, hwIds, 1);
9393

9494
// Parse hardware class if available
9595
WCHAR* compatibleIds = NWL_GetDevStrProp(devInst, &DEVPKEY_Device_CompatibleIds);

0 commit comments

Comments
 (0)