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
This commit is contained in:
Hans de Goede 2019-08-02 22:41:00 +02:00 committed by Jonas Ådahl
parent 17c217848d
commit 6792903c4f

View File

@ -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);
}