main: Fix warning for hidden device

Some Bluetooth devices can be hidden if they also export their battery
info through the kernel, so make sure to not throw a warning when they
go away.

(upowerd:133931): UPower-WARNING **: 02:49:48.012: INTERNAL STATE CORRUPT (device-removed): not sending NULL, device:0x1f5dae0

Fixes: 778b93a336 ("linux: Hide duplicate Logitech Bluetooth devices")
This commit is contained in:
Bastien Nocera 2023-02-25 15:52:25 +01:00
parent 7df5f2907c
commit 81c97eef9d

View file

@ -1001,13 +1001,14 @@ up_daemon_device_removed_cb (UpBackend *backend, UpDevice *device, UpDaemon *dae
/* emit */
object_path = up_device_get_object_path (device);
g_debug ("emitting device-removed: %s", object_path);
/* don't crash the session */
if (object_path == NULL) {
g_warning ("INTERNAL STATE CORRUPT (device-removed): not sending NULL, device:%p", device);
g_debug ("not emitting device-removed for unregistered device: %s",
up_exported_device_get_native_path (UP_EXPORTED_DEVICE (device)));
return;
}
g_debug ("emitting device-removed: %s", object_path);
up_exported_daemon_emit_device_removed (UP_EXPORTED_DAEMON (daemon), object_path);
/* In case a battery was removed */