diff --git a/cli/limeOEM.cpp b/cli/limeOEM.cpp index c210ad39..fef9bc3a 100644 --- a/cli/limeOEM.cpp +++ b/cli/limeOEM.cpp @@ -151,9 +151,11 @@ int main(int argc, char** argv) { uint64_t serialNumber = device->GetDescriptor().serialNumber; cerr << "Board serial number: " << serialNumber << " ("; + stringstream ss; + ss << std::hex << std::setw(2) << std::setfill('0'); for (size_t i = 0; i < sizeof(serialNumber); ++i) - cerr << hex << "0x" << std::setw(2) << std::setfill('0') << ((serialNumber >> 8 * i) & 0xFF) << " "; - cerr << ")" << endl; + ss << "0x" << ((serialNumber >> 8 * i) & 0xFF) << " "; + cerr << ss.str() << ")" << endl; PrintOEMTestReporter reporter(serialNumber, reportFilename); reporter.ReportColumn("S/N", std::to_string(serialNumber)); diff --git a/src/protocols/LMS64CProtocol.cpp b/src/protocols/LMS64CProtocol.cpp index 27517dd7..dbfa2b1b 100644 --- a/src/protocols/LMS64CProtocol.cpp +++ b/src/protocols/LMS64CProtocol.cpp @@ -876,8 +876,9 @@ OpStatus WriteSerialNumber(ISerialPort& port, const std::vector& serial bytes.resize(currentSerial.size()); std::stringstream ss; ss << "Padding serial number to:"; + ss << std::hex << std::setw(2) << std::setfill('0'); for (size_t i = 0; i < bytes.size(); ++i) - ss << std::setw(2) << std::setfill('0') << std::hex << bytes[i] << " "; + ss << "0x" << static_cast(bytes[i]) << " "; lime::debug(ss.str()); } } @@ -933,9 +934,9 @@ OpStatus WriteSerialNumber(ISerialPort& port, const std::vector& serial return OpStatus::Error; std::stringstream ss; - ss << "Serial number written:"; + ss << "Serial number written:" << std::hex << std::setw(2) << std::setfill('0'); for (uint8_t b : bytes) - ss << std::hex << b << " "; + ss << "0x" << static_cast(b) << " "; lime::info(ss.str()); // wait for things to settle, otherwise reading serial immediately will return zeroes std::this_thread::sleep_for(std::chrono::milliseconds(100));