mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-22 06:57:51 +00:00
genode_c_api: report usb config on demand
Do not only report devices, but the current configuration of the driver too, as long as the `report` node in the configuration states it. Ref genodelabs/genode#4416
This commit is contained in:
parent
938ac716a8
commit
a30c4281d2
@ -156,7 +156,8 @@ class Root : public Root_component<genode_usb_session>
|
|||||||
Attached_rom_dataspace _config { _env, "config" };
|
Attached_rom_dataspace _config { _env, "config" };
|
||||||
Signal_handler<Root> _config_handler { _env.ep(), *this,
|
Signal_handler<Root> _config_handler { _env.ep(), *this,
|
||||||
&Root::_announce_service };
|
&Root::_announce_service };
|
||||||
Constructible<Reporter> _reporter { };
|
Reporter _config_reporter { _env, "config" };
|
||||||
|
Reporter _device_reporter { _env, "devices" };
|
||||||
Constructible<Device> _devices[MAX_DEVICES];
|
Constructible<Device> _devices[MAX_DEVICES];
|
||||||
List<List_element<genode_usb_session>> _sessions {};
|
List<List_element<genode_usb_session>> _sessions {};
|
||||||
Id_allocator _id_alloc {};
|
Id_allocator _id_alloc {};
|
||||||
@ -587,11 +588,7 @@ void ::Root::_report()
|
|||||||
{
|
{
|
||||||
using Value = String<64>;
|
using Value = String<64>;
|
||||||
|
|
||||||
if (!_reporter.constructed())
|
Reporter::Xml_generator xml(_device_reporter, [&] () {
|
||||||
return;
|
|
||||||
|
|
||||||
_reporter->enabled(true);
|
|
||||||
Reporter::Xml_generator xml(*_reporter, [&] () {
|
|
||||||
_for_each_device([&] (Device & d) {
|
_for_each_device([&] (Device & d) {
|
||||||
xml.node("device", [&] {
|
xml.node("device", [&] {
|
||||||
xml.attribute("label", d.label());
|
xml.attribute("label", d.label());
|
||||||
@ -620,13 +617,19 @@ void ::Root::_announce_service()
|
|||||||
* Check for report policy, and resp. con-/destruct device reporter
|
* Check for report policy, and resp. con-/destruct device reporter
|
||||||
*/
|
*/
|
||||||
_config.xml().with_sub_node("report", [&] (Xml_node node) {
|
_config.xml().with_sub_node("report", [&] (Xml_node node) {
|
||||||
if (node.attribute_value("devices", false)) {
|
_device_reporter.enabled(node.attribute_value("devices", false));
|
||||||
if (!_reporter.constructed())
|
_config_reporter.enabled(node.attribute_value("config", false));
|
||||||
_reporter.construct(_env, "devices");
|
});
|
||||||
} else {
|
|
||||||
if (_reporter.constructed())
|
/*
|
||||||
_reporter.destruct();
|
* Report the own configuration to show management component
|
||||||
}
|
* that we've consumed the configuration
|
||||||
|
*/
|
||||||
|
Reporter::Xml_generator xml(_config_reporter, [&] {
|
||||||
|
xml.attribute("bios_handoff",
|
||||||
|
_config.xml().attribute_value("bios_handoff", true));
|
||||||
|
_config.xml().with_raw_content([&] (char const *start, size_t len) {
|
||||||
|
xml.append(start, len); });
|
||||||
});
|
});
|
||||||
|
|
||||||
if (_announced)
|
if (_announced)
|
||||||
|
Loading…
Reference in New Issue
Block a user