Commit bdf251e5 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther
Browse files

feedback-manager: Only act on add

We would otherwise ignore the action when no vibra device was yet found.
Make sure we release the old device when updating.
parent 5d947f51
......@@ -74,11 +74,12 @@ device_changes (FbdFeedbackManager *self, gchar *action, GUdevDevice *device,
g_debug ("Vibra device %s got removed", g_udev_device_get_sysfs_path (dev));
g_clear_object (&self->vibra);
} else if (g_strcmp0 (action, "add") == 0 || !self->vibra) {
} else if (g_strcmp0 (action, "add") == 0) {
if (!g_strcmp0 (g_udev_device_get_property (device, "FEEDBACKD_TYPE"), "vibra")) {
g_autoptr (GError) err = NULL;
g_debug ("Found hotplugged vibra device at %s", g_udev_device_get_sysfs_path (device));
g_clear_object (&self->vibra);
self->vibra = fbd_dev_vibra_new (device, &err);
if (!self->vibra)
g_warning ("Failed to init vibra device: %s", err->message);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment