Skip to content

Commit

Permalink
fix(config): Use interface number for seen devices. Don't force all i…
Browse files Browse the repository at this point in the history
…nterfaces to be present.
  • Loading branch information
pastaq authored and ShadowApex committed Mar 3, 2024
1 parent f0bbafd commit 576ac33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ impl CompositeDeviceConfig {
let Some(hidraw_devices) = self.get_matching_hidraw()? else {
return Ok(true);
};
let hidraw_configs = self.get_hidraw_configs();

Ok(hidraw_devices.len() >= hidraw_configs.len())
Ok(hidraw_devices.len() >= 1)
}

/// Returns true if all the evdev source devices in the config exist on the system
Expand Down Expand Up @@ -206,7 +205,12 @@ impl CompositeDeviceConfig {

// Construct a device ID from the vendor and product to see
// if this device has already been matched.
let device_id = format!("{:04x}:{:04x}", device.vendor_id(), device.product_id());
let device_id = format!(
"{:04x}:{:04x}:{}",
device.vendor_id(),
device.product_id(),
device.interface_number()
);
if seen_devices.contains(&device_id) {
log::debug!("Device already seen: {}", device_id);
continue;
Expand Down
2 changes: 2 additions & 0 deletions src/input/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ impl Manager {
if let Err(e) = result {
log::error!("Unable to send command: {:?}", e);
}
break;
}

// Perform an initial event device discovery
Expand Down Expand Up @@ -675,6 +676,7 @@ impl Manager {
if let Err(e) = result {
log::error!("Unable to send command: {:?}", e);
}
break;
}

// Start a task to dispatch filesystem watch events to the `run()` loop
Expand Down

0 comments on commit 576ac33

Please sign in to comment.