From 18b022bf6b2d2fd8acce70a1b2b3640592187948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20B=C3=A4r?= Date: Sat, 11 Jun 2022 09:54:58 +0200 Subject: [PATCH] rtc_drv: log 'set time' message on verbose The "verbose" config attribute instructs the driver to log 'set time' messages when the RTC updated initially or from the 'set_rtc' ROM. Fixes #4526 --- repos/libports/recipes/pkg/system_rtc-pc/hash | 2 +- repos/os/recipes/src/rtc_drv/hash | 2 +- repos/os/run/rtc.run | 2 +- repos/os/src/drivers/rtc/main.cc | 17 +++++++++++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/repos/libports/recipes/pkg/system_rtc-pc/hash b/repos/libports/recipes/pkg/system_rtc-pc/hash index ff64081e26..220c6822b1 100644 --- a/repos/libports/recipes/pkg/system_rtc-pc/hash +++ b/repos/libports/recipes/pkg/system_rtc-pc/hash @@ -1 +1 @@ -2022-05-24 7314ffd53ce1d9f266a45b149455ffe4f39e26a7 +2022-06-06 198a9b3ca1625083e8e5cc6893c2dc9c3ef7b254 diff --git a/repos/os/recipes/src/rtc_drv/hash b/repos/os/recipes/src/rtc_drv/hash index 3e190d6d45..8c3f803def 100644 --- a/repos/os/recipes/src/rtc_drv/hash +++ b/repos/os/recipes/src/rtc_drv/hash @@ -1 +1 @@ -2022-05-24 efd3414279424ba9af6316da0d14eaa16c334f8a +2022-06-06 4d3547ead19b82e81c31750cdbd4a3d19dbfa1b4 diff --git a/repos/os/run/rtc.run b/repos/os/run/rtc.run index c693e4b32a..7cff2ac6f1 100644 --- a/repos/os/run/rtc.run +++ b/repos/os/run/rtc.run @@ -58,7 +58,7 @@ append config { } append_if $test_update config { - + diff --git a/repos/os/src/drivers/rtc/main.cc b/repos/os/src/drivers/rtc/main.cc index f296424a51..fdeaf71f2b 100644 --- a/repos/os/src/drivers/rtc/main.cc +++ b/repos/os/src/drivers/rtc/main.cc @@ -106,6 +106,9 @@ struct Rtc::Main bool const _set_rtc { _config_rom.xml().attribute_value("allow_setting_rtc", false) }; + bool const _verbose { + _config_rom.xml().attribute_value("verbose", false) }; + Constructible _update_rom { }; struct Invalid_timestamp_xml : Exception {}; @@ -124,7 +127,12 @@ struct Rtc::Main } try { - Rtc::set_time(env, _parse_xml(_config_rom.xml())); + Timestamp ts = _parse_xml(_config_rom.xml()); + + if (_verbose) + Genode::log("set time to ", ts); + + Rtc::set_time(env, ts); } catch (Invalid_timestamp_xml &) {} env.parent().announce(env.ep().manage(root)); @@ -189,7 +197,12 @@ void Rtc::Main::_handle_update() Genode::Xml_node node = _update_rom->xml(); try { - Rtc::set_time(env, _parse_xml(node)); + Timestamp ts = _parse_xml(node); + + if (_verbose) + Genode::log("set time to ", ts); + + Rtc::set_time(env, ts); root.notify_clients(); } catch (Invalid_timestamp_xml &) { Genode::warning("set_rtc: ignoring incomplete RTC update"); }