Skip to content

xrt: Add controller hot swap functionality

Nico Marniok requested to merge nico3000/monado:hotswap_controllers into main

The changes add the functionality of adding and removing controllers during runtime. Supported controllers must still be pre-created in a dormant state, i.e. creating it with XRT_DEVICE_TYPE_UNKNOWN.

We added a new optional update_devices function member to the xrt_prober struct which is passed to the u_system_devices. During runtime it will be called every frame. When a controller wakes up, the function should assign the desired device type to it and return true which notifies a change in the active controllers. Similarly, a controller can be removed from the app by setting its type back to unknown.

Note that the contents of the new function oxr_session_update_action_bindings is essentially copied from oxr_session_attach_action_sets. There is probably a better way to unify the shared code but I have not enough knowledge of what is actually needed here.

Merge request reports