@@ -35,6 +35,7 @@ use crate::{
3535 value:: { InputValue , TranslationError } ,
3636 Event ,
3737 } ,
38+ output_capability:: OutputCapability ,
3839 output_event:: UinputOutputEvent ,
3940 source:: {
4041 evdev:: EventDevice , hidraw:: HidRawDevice , iio:: IioDevice , led:: LedDevice , SourceDevice ,
@@ -82,6 +83,8 @@ pub struct CompositeDevice {
8283 name : String ,
8384 /// Capabilities describe all input capabilities from all source devices
8485 capabilities : HashSet < Capability > ,
86+ /// Output capabilities describe all output capabilities from all source devices
87+ output_capabilities : HashSet < OutputCapability > ,
8588 /// Capability mapping for the CompositeDevice
8689 capability_map : Option < CapabilityMapConfig > ,
8790 /// Currently loaded [DeviceProfile] for the [CompositeDevice]. The [DeviceProfile]
@@ -173,6 +176,7 @@ impl CompositeDevice {
173176 config,
174177 name,
175178 capabilities : HashSet :: new ( ) ,
179+ output_capabilities : HashSet :: new ( ) ,
176180 capability_map,
177181 device_profile : None ,
178182 device_profile_path : None ,
@@ -254,7 +258,7 @@ impl CompositeDevice {
254258 }
255259
256260 /// Creates a new instance of the composite device interface on DBus.
257- pub async fn listen_on_dbus ( & self ) -> Result < JoinHandle < ( ) > , Box < dyn Error > > {
261+ pub async fn listen_on_dbus ( & mut self ) -> Result < JoinHandle < ( ) > , Box < dyn Error > > {
258262 let conn = self . conn . clone ( ) ;
259263 let client = self . client ( ) ;
260264 let path = String :: from ( self . dbus_path ( ) ) ;
@@ -323,6 +327,11 @@ impl CompositeDevice {
323327 log:: error!( "Failed to send capabilities: {:?}" , e) ;
324328 }
325329 }
330+ CompositeCommand :: GetOutputCapabilities ( sender) => {
331+ if let Err ( e) = sender. send ( self . output_capabilities . clone ( ) ) . await {
332+ log:: debug!( "Failed to send output capabilities: {:?}" , e) ;
333+ }
334+ }
326335 CompositeCommand :: GetTargetCapabilities ( sender) => {
327336 let target_caps = match self . targets . get_capabilities ( ) . await {
328337 Ok ( caps) => caps,
@@ -1619,6 +1628,11 @@ impl CompositeDevice {
16191628 }
16201629 self . capabilities . insert ( cap) ;
16211630 }
1631+
1632+ let output_capabilities = source_device. get_output_capabilities ( ) ?;
1633+ for cap in output_capabilities {
1634+ self . output_capabilities . insert ( cap) ;
1635+ }
16221636 }
16231637
16241638 // Check if this device should be blocked from sending events to target devices.
0 commit comments