system.cpp (c39d3dfca789d7ad5de9b7bd0856fc5b79c589df) system.cpp (f2d8bb48366d812180a8684e3ff58f26425854fa)
1/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0

--- 20 unchanged lines hidden (view full) ---

29 "xyz.openbmc_project.Software.Version";
30static constexpr const char* biosVersionProp = "Version";
31
32namespace phosphor
33{
34namespace smbios
35{
36
1/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0

--- 20 unchanged lines hidden (view full) ---

29 "xyz.openbmc_project.Software.Version";
30static constexpr const char* biosVersionProp = "Version";
31
32namespace phosphor
33{
34namespace smbios
35{
36
37std::string System::uuid(std::string value)
37std::string System::uuid(std::string /* value */)
38{
39 uint8_t* dataIn = storage;
40 dataIn = getSMBIOSTypePtr(dataIn, systemType);
41 if (dataIn != nullptr)
42 {
43 auto systemInfo = reinterpret_cast<struct SystemInfo*>(dataIn);
44 std::stringstream stream;
45 stream << std::setfill('0') << std::hex;

--- 69 unchanged lines hidden (view full) ---

115 auto method = bus.new_method_call(service.c_str(), objectPath.c_str(),
116 "org.freedesktop.DBus.Properties", "Set");
117 method.append(interface.c_str(), propertyName.c_str(),
118 std::variant<std::string>{value});
119
120 bus.call_noreply(method);
121}
122
38{
39 uint8_t* dataIn = storage;
40 dataIn = getSMBIOSTypePtr(dataIn, systemType);
41 if (dataIn != nullptr)
42 {
43 auto systemInfo = reinterpret_cast<struct SystemInfo*>(dataIn);
44 std::stringstream stream;
45 stream << std::setfill('0') << std::hex;

--- 69 unchanged lines hidden (view full) ---

115 auto method = bus.new_method_call(service.c_str(), objectPath.c_str(),
116 "org.freedesktop.DBus.Properties", "Set");
117 method.append(interface.c_str(), propertyName.c_str(),
118 std::variant<std::string>{value});
119
120 bus.call_noreply(method);
121}
122
123std::string System::version(std::string value)
123std::string System::version(std::string /* value */)
124{
125 std::string result = "No BIOS Version";
126 uint8_t* dataIn = storage;
127 dataIn = getSMBIOSTypePtr(dataIn, biosType);
128 if (dataIn != nullptr)
129 {
130 auto biosInfo = reinterpret_cast<struct BIOSInfo*>(dataIn);
124{
125 std::string result = "No BIOS Version";
126 uint8_t* dataIn = storage;
127 dataIn = getSMBIOSTypePtr(dataIn, biosType);
128 if (dataIn != nullptr)
129 {
130 auto biosInfo = reinterpret_cast<struct BIOSInfo*>(dataIn);
131 uint8_t biosVerByte = biosInfo->biosVersion;
132 std::string tempS = positionToString(biosInfo->biosVersion,
133 biosInfo->length, dataIn);
134 if (std::find_if(tempS.begin(), tempS.end(),
135 [](char ch) { return !isprint(ch); }) != tempS.end())
136 {
137 std::ofstream smbiosFile(mdrType2File, std::ios_base::trunc);
138 if (!smbiosFile.good())
139 {

--- 24 unchanged lines hidden ---
131 std::string tempS = positionToString(biosInfo->biosVersion,
132 biosInfo->length, dataIn);
133 if (std::find_if(tempS.begin(), tempS.end(),
134 [](char ch) { return !isprint(ch); }) != tempS.end())
135 {
136 std::ofstream smbiosFile(mdrType2File, std::ios_base::trunc);
137 if (!smbiosFile.good())
138 {

--- 24 unchanged lines hidden ---