+ json_object_object_add(result, "device", json_object_new_string(current_device));
+ json_object_object_add(result, "user", json_object_new_string(current_user));
+ AFB_INFO("[logout] device: %s", device);
+ afb_event_broadcast(evt_logout, NULL);
+
+ free_string(¤t_device);
+ free_string(¤t_user);
+ }
+ else
+ {
+ json_object_object_add(result, "message", json_object_new_string(current_device));
+ json_object_object_add(result, "user", json_object_new_string("The unplugged device wasn't the user key!"));
+ AFB_INFO("The unplugged device wasn't the user key!");
+ afb_event_broadcast(evt_failed, result);
+ }
+ json_object_put(result);
+}
+
+/**
+ * @brief UDev's monitoring thread.
+ */
+void* udev_monitoring_thread(void* arg)
+{
+ struct udev_device* dev;
+ struct pollfd pfd;
+ int action;
+
+ pfd.fd = udev_monitor_get_fd(udev_mon);
+ pfd.events = POLLIN;
+
+ while(1)
+ {
+ if (poll(&pfd, 1, UDEV_MONITOR_POLLING_TIMEOUT))