mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
Depend on udev 136 and clean up some code.
This commit is contained in:
parent
b14852d7a2
commit
f13eb14711
2 changed files with 18 additions and 37 deletions
|
|
@ -5,7 +5,7 @@ PKG_PROG_PKG_CONFIG()
|
||||||
PKG_CHECK_MODULES(FFI, [libffi])
|
PKG_CHECK_MODULES(FFI, [libffi])
|
||||||
|
|
||||||
PKG_CHECK_MODULES(EGL_COMPOSITOR,
|
PKG_CHECK_MODULES(EGL_COMPOSITOR,
|
||||||
[eagle libpng cairo gdk-pixbuf-2.0 libudev libdrm])
|
[eagle libpng cairo gdk-pixbuf-2.0 libudev >= 136 libdrm])
|
||||||
PKG_CHECK_MODULES(CLIENT, [eagle cairo glib-2.0 libudev])
|
PKG_CHECK_MODULES(CLIENT, [eagle cairo glib-2.0 libudev])
|
||||||
|
|
||||||
if test $CC = gcc; then
|
if test $CC = gcc; then
|
||||||
|
|
|
||||||
|
|
@ -781,18 +781,6 @@ post_output_geometry(struct wl_client *client, struct wl_object *global)
|
||||||
output->width, output->height);
|
output->width, output->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_udev_property(struct udev_device *device, const char *name)
|
|
||||||
{
|
|
||||||
struct udev_list_entry *entry;
|
|
||||||
|
|
||||||
udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(device))
|
|
||||||
if (strcmp(udev_list_entry_get_name(entry), name) == 0)
|
|
||||||
return udev_list_entry_get_value(entry);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
init_egl(struct egl_compositor *ec, struct udev_device *device)
|
init_egl(struct egl_compositor *ec, struct udev_device *device)
|
||||||
{
|
{
|
||||||
|
|
@ -1084,19 +1072,9 @@ init_libudev(struct egl_compositor *ec)
|
||||||
struct udev_enumerate *e;
|
struct udev_enumerate *e;
|
||||||
struct udev_list_entry *entry;
|
struct udev_list_entry *entry;
|
||||||
struct udev_device *device;
|
struct udev_device *device;
|
||||||
const char *path, *seat;
|
const char *path;
|
||||||
struct wlsc_input_device *input_device;
|
struct wlsc_input_device *input_device;
|
||||||
|
|
||||||
/* FIXME: Newer (version 135+) udev has two new features that
|
|
||||||
* make all this much easier: 1) we can enumerate by a
|
|
||||||
* specific property. This lets us directly iterate through
|
|
||||||
* the devices we care about. 2) We can attach properties to
|
|
||||||
* sysfs nodes without a device file, which lets us configure
|
|
||||||
* which connectors belong to a seat instead of tagging the
|
|
||||||
* overall drm node. I don't want to update my system udev,
|
|
||||||
* so I'm going to stick with this until the new version is in
|
|
||||||
* rawhide. */
|
|
||||||
|
|
||||||
ec->udev = udev_new();
|
ec->udev = udev_new();
|
||||||
if (ec->udev == NULL) {
|
if (ec->udev == NULL) {
|
||||||
fprintf(stderr, "failed to initialize udev context\n");
|
fprintf(stderr, "failed to initialize udev context\n");
|
||||||
|
|
@ -1106,24 +1084,27 @@ init_libudev(struct egl_compositor *ec)
|
||||||
input_device = create_input_device(ec);
|
input_device = create_input_device(ec);
|
||||||
|
|
||||||
e = udev_enumerate_new(ec->udev);
|
e = udev_enumerate_new(ec->udev);
|
||||||
|
udev_enumerate_add_match_subsystem(e, "input");
|
||||||
|
udev_enumerate_add_match_property(e, "WAYLAND_SEAT", "1");
|
||||||
udev_enumerate_scan_devices(e);
|
udev_enumerate_scan_devices(e);
|
||||||
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
|
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
|
||||||
path = udev_list_entry_get_name(entry);
|
path = udev_list_entry_get_name(entry);
|
||||||
device = udev_device_new_from_syspath(ec->udev, path);
|
device = udev_device_new_from_syspath(ec->udev, path);
|
||||||
|
evdev_input_device_create(input_device, ec->wl_display,
|
||||||
|
udev_device_get_devnode(device));
|
||||||
|
}
|
||||||
|
udev_enumerate_unref(e);
|
||||||
|
|
||||||
/* FIXME: Should the property namespace be CK for console kit? */
|
e = udev_enumerate_new(ec->udev);
|
||||||
seat = get_udev_property(device, "WAYLAND_SEAT");
|
udev_enumerate_add_match_subsystem(e, "drm");
|
||||||
if (!seat || strcmp(seat, "1") != 0)
|
udev_enumerate_add_match_property(e, "WAYLAND_SEAT", "1");
|
||||||
continue;
|
udev_enumerate_scan_devices(e);
|
||||||
|
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
|
||||||
if (strcmp(udev_device_get_subsystem(device), "input") == 0) {
|
path = udev_list_entry_get_name(entry);
|
||||||
evdev_input_device_create(input_device, ec->wl_display,
|
device = udev_device_new_from_syspath(ec->udev, path);
|
||||||
udev_device_get_devnode(device));
|
if (create_output(ec, device) < 0) {
|
||||||
} else if (strcmp(udev_device_get_subsystem(device), "drm") == 0) {
|
fprintf(stderr, "failed to create output for %s\n", path);
|
||||||
if (create_output(ec, device) < 0) {
|
return -1;
|
||||||
fprintf(stderr, "failed to create output for %s\n", path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
udev_enumerate_unref(e);
|
udev_enumerate_unref(e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue