@@ -69,6 +69,17 @@ int parse_int_value(const YAML::Node &node,
6969 }
7070}
7171
72+ bool parse_bool_value (const YAML::Node &node, const std::string &field_name) {
73+ const std::string text = require_scalar (node, field_name);
74+ if (text == " true" ) {
75+ return true ;
76+ }
77+ if (text == " false" ) {
78+ return false ;
79+ }
80+ throw std::runtime_error (field_name + " must be true or false" );
81+ }
82+
7283int parse_address_text (const std::string &text, const std::string &field_name) {
7384 const int base = (text.size () > 2 && text[0 ] == ' 0' &&
7485 (text[1 ] == ' x' || text[1 ] == ' X' ))
@@ -173,9 +184,16 @@ ProviderConfig load_config(const std::string &path) {
173184 throw std::runtime_error (" Missing required section: hardware" );
174185 }
175186 ensure_map (hardware_node, " hardware" );
176- reject_unknown_keys (hardware_node, " hardware" , {" bus_path" , " query_delay_us" , " timeout_ms" , " retry_count" });
187+ reject_unknown_keys (
188+ hardware_node,
189+ " hardware" ,
190+ {" bus_path" , " require_live_session" , " query_delay_us" , " timeout_ms" , " retry_count" });
177191
178192 config.bus_path = require_scalar (hardware_node[" bus_path" ], " hardware.bus_path" );
193+ if (hardware_node[" require_live_session" ]) {
194+ config.require_live_session =
195+ parse_bool_value (hardware_node[" require_live_session" ], " hardware.require_live_session" );
196+ }
179197 if (hardware_node[" query_delay_us" ]) {
180198 config.query_delay_us = parse_int_value (hardware_node[" query_delay_us" ], " hardware.query_delay_us" , false );
181199 }
@@ -267,6 +285,7 @@ std::string summarize_config(const ProviderConfig &config) {
267285 std::ostringstream out;
268286 out << " provider.name=" << config.provider_name
269287 << " , hardware.bus_path=" << config.bus_path
288+ << " , hardware.require_live_session=" << (config.require_live_session ? " true" : " false" )
270289 << " , hardware.query_delay_us=" << config.query_delay_us
271290 << " , hardware.timeout_ms=" << config.timeout_ms
272291 << " , hardware.retry_count=" << config.retry_count
0 commit comments