File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -718,7 +718,7 @@ impl CompositeDevice {
718718
719719 /// Process a single output event from a target device.
720720 async fn process_output_event ( & mut self , event : OutputEvent ) -> Result < ( ) , Box < dyn Error > > {
721- // log::trace!("Received output event: {:?}", event);
721+ log:: trace!( "Received output event: {:?}" , event) ;
722722
723723 // Handle any output events that need to upload FF effect data
724724 if let OutputEvent :: Uinput ( uinput) = event. borrow ( ) {
@@ -813,8 +813,21 @@ impl CompositeDevice {
813813 return Ok ( ( ) ) ;
814814 }
815815
816- // TODO: Only write the event to devices that are capabile of handling it
816+ // Write the event to devices that are capable of handling it
817+ let event_capabilities = event. as_capability ( ) ;
817818 for ( source_id, source) in self . source_devices . iter ( ) {
819+ // Check to see if the device supports processing the output event
820+ let Some ( src_capabilities) = self . output_capabilities_by_source . get ( source_id) else {
821+ log:: trace!( "Source device {source_id} contains no output capabilities" ) ;
822+ continue ;
823+ } ;
824+ let supports_event = event_capabilities
825+ . iter ( )
826+ . any ( |cap| src_capabilities. contains ( cap) ) ;
827+ if !supports_event {
828+ continue ;
829+ }
830+
818831 // If this is a force feedback event, translate the effect id into
819832 // the source device's effect id.
820833 if let OutputEvent :: Evdev ( input_event) = event {
Original file line number Diff line number Diff line change @@ -21,8 +21,7 @@ pub enum OutputEvent {
2121
2222impl OutputEvent {
2323 /// Returns the capability of the output event
24- #[ allow( dead_code) ]
25- fn as_capability ( & self ) -> Vec < OutputCapability > {
24+ pub fn as_capability ( & self ) -> Vec < OutputCapability > {
2625 match self {
2726 OutputEvent :: Evdev ( event) => match event. destructure ( ) {
2827 evdev:: EventSummary :: Synchronization ( _, _, _) => {
You can’t perform that action at this time.
0 commit comments