Skip to content

Commit

Permalink
[linuxinput] do not discover on ENTRY_MODIFY
Browse files Browse the repository at this point in the history
ENTRY_MODIFY is triggered on each keypress multiple times, so we should
not trigger on it.

The usecase for ENTRY_MODIFY triggers where detecting permission changes
of the event nodes.
Inotify does have a dedicate event ("ATTRIB") for that but Java
WatchService normalizes this to a ENTRY_MODIFY event
(See LinuxWatchService.java)

After permission changes users now have to trigger a scan manually.
  • Loading branch information
t-8ch committed May 2, 2021
1 parent e69a65d commit 4ad25b9
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ protected void startBackgroundDiscovery() {

private WatchService makeWatcher() throws IOException {
WatchService watchService = FileSystems.getDefault().newWatchService();
// FIXME also trigger on inotify "ATTRIB" events when WatchService supports this.
// Triggering on ENTRY_MODIFY will trigger multiple times on each keypress for *any* input device.
DEVICE_DIRECTORY.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
StandardWatchEventKinds.ENTRY_DELETE);
return watchService;
}

Expand Down

0 comments on commit 4ad25b9

Please sign in to comment.