Drivers: Ensure serial numbers are uppercase

This prevents mismatches if the device sends a lowercase
serial number, which may happen due to an oversight in
production.
This commit is contained in:
Paul Hollinsky
2022-05-28 14:41:41 -04:00
parent 00024990e9
commit 407ccccedd
4 changed files with 13 additions and 1 deletions
+3
View File
@@ -9,6 +9,7 @@
#include <cwctype>
#include <algorithm>
#include <codecvt>
#include <cctype>
#include <limits>
#include <stdio.h>
@@ -152,6 +153,8 @@ void VCP::Find(std::vector<FoundDevice>& found, std::vector<std::wstring> driver
if(serial.find_first_of('\\') != std::string::npos)
continue;
}
for(char& c : serial)
c = static_cast<char>(toupper(c));
strcpy_s(device.serial, sizeof(device.serial), serial.c_str());
// Serial number is saved, we want the COM port number now