[mutter] udev: Add device-removed signal
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] udev: Add device-removed signal
- Date: Thu, 15 Aug 2019 20:48:27 +0000 (UTC)
commit 6792903c4f492c31cfcd8b9f0dd6ca0d7c8bef1d
Author: Hans de Goede <hdegoede redhat com>
Date: Fri Aug 2 22:41:00 2019 +0200
udev: Add device-removed signal
Add a device-removed signal which gets emitted when a GPU is removed.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
src/backends/native/meta-udev.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/src/backends/native/meta-udev.c b/src/backends/native/meta-udev.c
index 719466131..7c8080a56 100644
--- a/src/backends/native/meta-udev.c
+++ b/src/backends/native/meta-udev.c
@@ -31,6 +31,7 @@ enum
{
HOTPLUG,
DEVICE_ADDED,
+ DEVICE_REMOVED,
N_SIGNALS
};
@@ -163,6 +164,8 @@ on_uevent (GUdevClient *client,
if (g_str_equal (action, "add"))
g_signal_emit (udev, signals[DEVICE_ADDED], 0, device);
+ else if (g_str_equal (action, "remove"))
+ g_signal_emit (udev, signals[DEVICE_REMOVED], 0, device);
if (g_udev_device_get_property_as_boolean (device, "HOTPLUG"))
g_signal_emit (udev, signals[HOTPLUG], 0);
@@ -221,4 +224,11 @@ meta_udev_class_init (MetaUdevClass *klass)
0, NULL, NULL, NULL,
G_TYPE_NONE, 1,
G_UDEV_TYPE_DEVICE);
+ signals[DEVICE_REMOVED] =
+ g_signal_new ("device-removed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ G_UDEV_TYPE_DEVICE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]