1 #include "i2cvr_device.hpp" 2 3 #include <phosphor-logging/lg2.hpp> 4 #include <sdbusplus/async.hpp> 5 #include <sdbusplus/async/context.hpp> 6 7 namespace phosphor::software::i2c_vr::device 8 { 9 updateDevice(const uint8_t * image,size_t imageSize)10sdbusplus::async::task<bool> I2CVRDevice::updateDevice(const uint8_t* image, 11 size_t imageSize) 12 { 13 setUpdateProgress(20); 14 15 // NOLINTBEGIN(clang-analyzer-core.uninitialized.Branch) 16 if (!(co_await vrInterface->verifyImage(image, imageSize))) 17 // NOLINTEND(clang-analyzer-core.uninitialized.Branch) 18 { 19 co_return false; 20 } 21 22 setUpdateProgress(50); 23 24 // NOLINTBEGIN(clang-analyzer-core.uninitialized.Branch) 25 if (!(co_await vrInterface->updateFirmware(false))) 26 // NOLINTEND(clang-analyzer-core.uninitialized.Branch) 27 { 28 co_return false; 29 } 30 31 setUpdateProgress(100); 32 33 lg2::info("Successfully updated VR {NAME}", "NAME", config.configName); 34 35 co_return true; 36 } 37 getVersion(uint32_t * sum) const38sdbusplus::async::task<bool> I2CVRDevice::getVersion(uint32_t* sum) const 39 { 40 // NOLINTBEGIN(clang-analyzer-core.uninitialized.Branch) 41 if (!(co_await this->vrInterface->getCRC(sum))) 42 // NOLINTEND(clang-analyzer-core.uninitialized.Branch) 43 { 44 co_return false; 45 } 46 co_return true; 47 } 48 49 } // namespace phosphor::software::i2c_vr::device 50