Skip to content

Commit 03cb80c

Browse files
committed
#1976 fix: panic in Rust system bridge code when unwrapping /dev/input path for uinput device
1 parent 2eab0fc commit 03cb80c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
## Fixed
1212

13-
- #1986 trigger screen is usable on slightly rectangular screens with a low DPI
14-
- #1972 Expert Mode works on Android 10
13+
- #1986 trigger screen is usable on slightly rectangular screens with a low DPI.
14+
- #1972 Expert Mode works on Android 10.
15+
- #1976 Panic in Rust system bridge code on some devices.
1516
- Bugs with expert mode auto starting time.
1617

1718
## [4.0.0 Beta 6](https://github.com/sds100/KeyMapper/releases/tag/v4.0.0-beta.06)

evdev/src/main/rust/evdev_manager/core/src/evdev_grab_controller.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl EvdevGrabController {
274274
) -> Result<Vec<PathBuf>, EvdevError> {
275275
let uinput_paths: Vec<PathBuf> = grabbed_devices
276276
.iter()
277-
.map(|(_, device)| device.uinput.devnode().unwrap().into())
277+
.filter_map(|(_, device)| device.uinput.devnode().map(|node| PathBuf::from(node)))
278278
.collect();
279279

280280
let mut paths: Vec<PathBuf> = Vec::new();
@@ -340,9 +340,13 @@ impl EvdevGrabController {
340340
impl InotifyCallback for EvdevGrabController {
341341
fn on_inotify_dev_input(&self, paths: &[PathBuf]) {
342342
let mut grabbed_devices = self.grabbed_devices.write().unwrap();
343-
let is_uinput_device = grabbed_devices
344-
.iter()
345-
.any(|(_, device)| paths.contains(&device.uinput.devnode().unwrap().into()));
343+
let is_uinput_device =
344+
grabbed_devices
345+
.iter()
346+
.any(|(_, device)| match &device.uinput.devnode() {
347+
None => false,
348+
Some(dev_node) => paths.contains(&dev_node.into()),
349+
});
346350

347351
if is_uinput_device {
348352
return;

0 commit comments

Comments
 (0)