genode_c_api/usb: correct interface setting

Remove regression in Session_component::set_interface by always iterating
over all interfaces to potentially change each alternate setting (from
passive to active and vice versa).

Ref genodelabs/genode#5349
Fix genodelabs/genode#5467
This commit is contained in:
Stefan Kalkowski 2025-02-26 11:38:26 +01:00 committed by Christian Helmuth
parent 472112fe0d
commit 62b44f2fbf

View File

@ -1185,10 +1185,11 @@ void Session_component::set_interface(genode_usb_device::Label label,
[&] (genode_usb_configuration & c) {
return c.active; },
[&] (genode_usb_configuration & c) {
c.interfaces.apply(
[&] (genode_usb_interface & i) {
return i.desc.number == num; },
c.interfaces.for_each(
[&] (genode_usb_interface & i) {
if (i.desc.number != num)
return;
if (i.active != (i.desc.alt_settings == alt)) {
i.active = (i.desc.alt_settings == alt);
changed = true;