1 #include "config.h"
2 
3 #include "item_updater_helper.hpp"
4 
5 #include <thread>
6 
7 namespace phosphor
8 {
9 namespace software
10 {
11 namespace updater
12 {
13 
14 void Helper::setEntry(const std::string& /* entryId */, uint8_t /* value */)
15 {
16     // Empty
17 }
18 
19 void Helper::clearEntry(const std::string& /* entryId */)
20 {
21     // Empty
22 }
23 
24 void Helper::cleanup()
25 {
26     // Empty
27 }
28 
29 void Helper::factoryReset()
30 {
31     // Empty
32 }
33 
34 void Helper::removeVersion(const std::string& versionId)
35 {
36     auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
37                                       SYSTEMD_INTERFACE, "StartUnit");
38     auto serviceFile = "obmc-flash-mmc-remove@" + versionId + ".service";
39     method.append(serviceFile, "replace");
40     bus.call_noreply(method);
41 }
42 
43 void Helper::updateUbootVersionId(const std::string& versionId)
44 {
45     auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
46                                       SYSTEMD_INTERFACE, "StartUnit");
47     auto serviceFile = "obmc-flash-mmc-setprimary@" + versionId + ".service";
48     method.append(serviceFile, "replace");
49     bus.call_noreply(method);
50 
51     // Wait a few seconds for the service file to finish, otherwise the BMC may
52     // be rebooted while pointing to a non-existent version.
53     constexpr auto setPrimaryWait = std::chrono::seconds(3);
54     std::this_thread::sleep_for(setPrimaryWait);
55 }
56 
57 void Helper::mirrorAlt()
58 {
59     // Empty
60 }
61 
62 } // namespace updater
63 } // namespace software
64 } // namespace phosphor
65