daemon: Don't prepare a poll for a hidden device

We don't need to poll a device that's not registered to be visible on
the bus, so check the visibility before setting that poll.
This commit is contained in:
Bastien Nocera 2023-01-27 15:53:27 +01:00
parent babe81a871
commit f7142fe567

View file

@ -966,9 +966,6 @@ up_daemon_device_added_cb (UpBackend *backend, UpDevice *device, UpDaemon *daemo
g_signal_connect (device, "notify",
G_CALLBACK (up_daemon_device_changed_cb), daemon);
/* Ensure we poll the new device if needed */
g_source_set_ready_time (daemon->priv->poll_source, 0);
/* emit */
object_path = up_device_get_object_path (device);
if (object_path == NULL) {
@ -977,6 +974,9 @@ up_daemon_device_added_cb (UpBackend *backend, UpDevice *device, UpDaemon *daemo
return;
}
/* Ensure we poll the new device if needed */
g_source_set_ready_time (daemon->priv->poll_source, 0);
g_debug ("emitting added: %s", object_path);
up_daemon_update_warning_level (daemon);
up_exported_daemon_emit_device_added (UP_EXPORTED_DAEMON (daemon), object_path);