diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 8149c001..cd76e4f3 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -858,6 +858,7 @@ tp_tag_device(struct evdev_device *device, static struct evdev_dispatch_interface tp_interface = { tp_process, + NULL, /* remove */ tp_destroy, tp_device_added, tp_device_removed, diff --git a/src/evdev.c b/src/evdev.c index 0873c99a..b32db684 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -737,6 +737,7 @@ evdev_calibration_get_default_matrix(struct libinput_device *libinput_device, struct evdev_dispatch_interface fallback_interface = { fallback_process, + NULL, /* remove */ fallback_destroy, NULL, /* device_added */ NULL, /* device_removed */ @@ -2041,6 +2042,9 @@ evdev_device_remove(struct evdev_device *device) evdev_device_suspend(device); + if (device->dispatch->interface->remove) + device->dispatch->interface->remove(device->dispatch); + /* A device may be removed while suspended, mark it to * skip re-opening a different device with the same node */ device->was_removed = true; diff --git a/src/evdev.h b/src/evdev.h index 033d4558..820fdccd 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -166,6 +166,9 @@ struct evdev_dispatch_interface { struct input_event *event, uint64_t time); + /* Device is being removed (may be NULL) */ + void (*remove)(struct evdev_dispatch *dispatch); + /* Destroy an event dispatch handler and free all its resources. */ void (*destroy)(struct evdev_dispatch *dispatch);