aboutsummaryrefslogtreecommitdiff
path: root/backend/udev.c
diff options
context:
space:
mode:
authorScott Anderson <ascent12@hotmail.com>2017-06-03 15:47:33 +1200
committerScott Anderson <ascent12@hotmail.com>2017-06-03 15:47:33 +1200
commitde44994dfcd433afbbf6d867a8dc6f4d0979b2f6 (patch)
tree85d0e81f7b1f04ef45e8e3eb640ac5a64dd53b9e /backend/udev.c
parent40b85d992a0a8dcdbff5305e232fbcd26d873148 (diff)
Udev event device matching
Diffstat (limited to 'backend/udev.c')
-rw-r--r--backend/udev.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/backend/udev.c b/backend/udev.c
index 30c24e49..f9577c12 100644
--- a/backend/udev.c
+++ b/backend/udev.c
@@ -73,7 +73,6 @@ int wlr_udev_find_gpu(struct wlr_udev *udev, struct wlr_session *session) {
struct udev_list_entry *entry;
int fd = -1;
- char *drm_path = NULL;
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(en)) {
bool is_boot_vga = false;
@@ -117,9 +116,6 @@ int wlr_udev_find_gpu(struct wlr_udev *udev, struct wlr_session *session) {
continue;
}
- free(drm_path);
- drm_path = strdup(path);
-
udev_device_unref(dev);
// We've found the primary GPU
@@ -130,7 +126,6 @@ int wlr_udev_find_gpu(struct wlr_udev *udev, struct wlr_session *session) {
udev_enumerate_unref(en);
- udev->drm_path = drm_path;
return fd;
}
@@ -143,21 +138,16 @@ static int udev_event(int fd, uint32_t mask, void *data) {
}
const char *action = udev_device_get_action(dev);
- const char *path = udev_device_get_devnode(dev);
wlr_log(L_DEBUG, "udev event for %s (%s)",
udev_device_get_sysname(dev), action);
- if (!path || strcmp(path, udev->drm_path) != 0) {
- goto out;
- }
-
if (!action || strcmp(action, "change") != 0) {
goto out;
}
- // TODO: Specify the GPU that's being invalidated
- wl_signal_emit(&udev->invalidate_drm, udev);
+ dev_t devnum = udev_device_get_devnum(dev);
+ wl_signal_emit(&udev->invalidate_drm, &devnum);
out:
udev_device_unref(dev);
@@ -216,5 +206,4 @@ void wlr_udev_destroy(struct wlr_udev *udev) {
udev_monitor_unref(udev->mon);
udev_unref(udev->udev);
- free(udev->drm_path);
}