@@ -22,6 +22,7 @@ static libusbp_error * device_allocate(libusbp_device ** device)
22
22
23
23
// Gets the hardware IDs of the device, in ASCII REG_MULTI_SZ format. If there
24
24
// is no error, the returned IDs must be freed with libusbp_string_free.
25
+ // This function converts the IDs to uppercase before returning them.
25
26
static libusbp_error * device_get_hardware_ids (
26
27
HDEVINFO list , PSP_DEVINFO_DATA info , char * * ids )
27
28
{
@@ -78,6 +79,19 @@ static libusbp_error * device_get_hardware_ids(
78
79
error = error_create ("Hardware IDs are empty or not terminated correctly." );
79
80
}
80
81
82
+ // Capitalize the hardware IDs because some drivers create USB IDs with the
83
+ // wrong capitalization (i.e. "Vid" instead of "VID").
84
+ if (error == NULL )
85
+ {
86
+ for (DWORD i = 0 ; i < size ; i ++ )
87
+ {
88
+ if (new_ids [i ] >= 'a' && new_ids [i ] <= 'z' )
89
+ {
90
+ new_ids [i ] -= 'a' - 'A' ;
91
+ }
92
+ }
93
+ }
94
+
81
95
// Pass the IDs to the caller.
82
96
if (error == NULL )
83
97
{
@@ -117,10 +131,6 @@ static libusbp_error * device_take_info_from_hardware_ids(
117
131
}
118
132
}
119
133
120
- // The format of this device's hardware IDs are not recognized. For
121
- // example, this can happen if VirtualBox is capturing a USB device, because
122
- // it makes a node with hardware IDs that have different capitalization,
123
- // like "USB\Vid_80EE&Pid_CAFE".
124
134
return error_create ("Device has no hardware ID with the correct format." );
125
135
}
126
136
0 commit comments