platform_drv: fix update_policy()

The method did not handle device changes properly. When a new policy
does not contain an owned device any more, we must consider this device
as changed and release it.  Moreover, the warning messages were interchanged.

genodelabs/genode#4761
This commit is contained in:
Johannes Schlatow 2023-01-24 17:05:52 +01:00 committed by Christian Helmuth
parent 475bcfc2b9
commit 3520492f09

View File

@ -84,13 +84,13 @@ void Session_component::update_policy(bool info, Policy_version version)
_devices.for_each([&] (Device const & dev) {
if (dev.name() != dc.device())
return;
state = (dev.owner() == _owner_id) ? UNCHANGED : CHANGED;
state = (dev.owner() == _owner_id && matches(dev)) ? UNCHANGED : CHANGED;
});
if (state == UNCHANGED)
return;
if (state == AWAY)
if (state == CHANGED)
warning("Device ", dc.device(),
" has changed, will close device session");
else