diff --git a/tools/libinput-debug-events.man b/tools/libinput-debug-events.man index 473e064c..abccfa66 100644 --- a/tools/libinput-debug-events.man +++ b/tools/libinput-debug-events.man @@ -44,6 +44,9 @@ The default behavior is equivalent to \-\-udev "seat0". Use verbose output .SS libinput configuration options .TP 8 +.B \-\-disable-sendevents="pattern" +Set the send-events option to disabled for the devices matching patterns. +.TP 8 .B \-\-enable\-tap|\-\-disable\-tap Enable or disable tap-to-click .TP 8 diff --git a/tools/shared.c b/tools/shared.c index 8039de9b..ae3287ba 100644 --- a/tools/shared.c +++ b/tools/shared.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -208,6 +209,15 @@ tools_parse_option(int option, else return 1; break; + case OPT_DISABLE_SENDEVENTS: + if (!optarg) + return 1; + + snprintf(options->disable_pattern, + sizeof(options->disable_pattern), + "%s", + optarg); + break; } return 0; @@ -367,6 +377,15 @@ tools_device_apply_config(struct libinput_device *device, libinput_device_config_accel_set_profile(device, options->profile); } + + if (libinput_device_config_send_events_get_modes(device) & + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED && + fnmatch(options->disable_pattern, + libinput_device_get_name(device), + 0) != FNM_NOMATCH) { + libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + } } static char* diff --git a/tools/shared.h b/tools/shared.h index ceaa08a9..55e15409 100644 --- a/tools/shared.h +++ b/tools/shared.h @@ -49,9 +49,11 @@ enum configuration_options { OPT_SCROLL_BUTTON, OPT_SPEED, OPT_PROFILE, + OPT_DISABLE_SENDEVENTS, }; #define CONFIGURATION_OPTIONS \ + { "disable-sendevents", required_argument, 0, OPT_DISABLE_SENDEVENTS }, \ { "enable-tap", no_argument, 0, OPT_TAP_ENABLE }, \ { "disable-tap", no_argument, 0, OPT_TAP_DISABLE }, \ { "enable-drag", no_argument, 0, OPT_DRAG_ENABLE }, \ @@ -92,6 +94,7 @@ struct tools_options { double speed; int dwt; enum libinput_config_accel_profile profile; + char disable_pattern[64]; }; void tools_init_options(struct tools_options *options);