blob: 03036e9b9394d8f6ee2fb09100371f3f206c87cf [file] [log] [blame]
Adriana Kobylak70f5bc02020-05-13 14:08:14 -05001#include "config.h"
2
Adriana Kobylak86013f32020-05-13 12:12:38 -05003#include "item_updater_helper.hpp"
4
Adriana Kobylak34124352020-05-22 09:40:40 -05005#include <thread>
6
Adriana Kobylak86013f32020-05-13 12:12:38 -05007namespace phosphor
8{
9namespace software
10{
11namespace updater
12{
13
14void Helper::setEntry(const std::string& /* entryId */, uint8_t /* value */)
15{
16 // Empty
17}
18
19void Helper::clearEntry(const std::string& /* entryId */)
20{
21 // Empty
22}
23
24void Helper::cleanup()
25{
26 // Empty
27}
28
29void Helper::factoryReset()
30{
31 // Empty
32}
33
Adriana Kobylak70f5bc02020-05-13 14:08:14 -050034void Helper::removeVersion(const std::string& versionId)
Adriana Kobylak86013f32020-05-13 12:12:38 -050035{
Adriana Kobylak70f5bc02020-05-13 14:08:14 -050036 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);
Adriana Kobylakc31943e2020-07-29 12:41:59 -050041
42 // Wait a few seconds for the service file to finish, otherwise the BMC may
43 // start the update while the image is still being deleted.
44 constexpr auto removeWait = std::chrono::seconds(3);
45 std::this_thread::sleep_for(removeWait);
Adriana Kobylak86013f32020-05-13 12:12:38 -050046}
47
Adriana Kobylak34124352020-05-22 09:40:40 -050048void Helper::updateUbootVersionId(const std::string& versionId)
Adriana Kobylak86013f32020-05-13 12:12:38 -050049{
Adriana Kobylak34124352020-05-22 09:40:40 -050050 auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
51 SYSTEMD_INTERFACE, "StartUnit");
52 auto serviceFile = "obmc-flash-mmc-setprimary@" + versionId + ".service";
53 method.append(serviceFile, "replace");
54 bus.call_noreply(method);
55
56 // Wait a few seconds for the service file to finish, otherwise the BMC may
57 // be rebooted while pointing to a non-existent version.
58 constexpr auto setPrimaryWait = std::chrono::seconds(3);
59 std::this_thread::sleep_for(setPrimaryWait);
Adriana Kobylak86013f32020-05-13 12:12:38 -050060}
61
62void Helper::mirrorAlt()
63{
64 // Empty
65}
66
67} // namespace updater
68} // namespace software
69} // namespace phosphor