diff options
| author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-05-14 16:36:49 +1000 |
|---|---|---|
| committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-06-05 15:16:06 +1000 |
| commit | 93bc9a329d622fe28aae101710163fae6f03850c (patch) | |
| tree | 5518cb8d8ae4051ae0e48291a54cf7ee71c1d6b4 /libevdev/libevdev-uinput.c | |
| parent | a5a10423122a67662c36c47a993c1dd4417a7de1 (diff) | |
| download | libevdev-93bc9a329d622fe28aae101710163fae6f03850c.tar.gz | |
Add per-device log handlers
The global log handler isn't a good choice for a low-level library. In the
caser of the X server, both evdev and synaptics are now using the libevdev but
are loaded from the same server process. Thus, there's only one log handler,
but evdev and synaptics don't talk to each other (a bit childish, I know).
Add a per-device log handler that overrides the global log handler, and fall
back to the global log handler if no device log handler is set. The log
macros take care of that automatically, especially as we can't do per-device
log handlers for the uinput code.
Note that we use the same struct for the global and device logging, so in each
instance one of the two function pointers is NULL. Suicide triggers are in
place in case we mess that up.
This also makes libevdev_new_from_fd() a bit less useful since we can't set
the log handler beforehand.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'libevdev/libevdev-uinput.c')
| -rw-r--r-- | libevdev/libevdev-uinput.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libevdev/libevdev-uinput.c b/libevdev/libevdev-uinput.c index f176a00..e0ae31e 100644 --- a/libevdev/libevdev-uinput.c +++ b/libevdev/libevdev-uinput.c @@ -236,7 +236,7 @@ fetch_syspath_and_devnode(struct libevdev_uinput *uinput_dev) if (strcmp(buf, uinput_dev->name) == 0) { if (uinput_dev->syspath) { /* FIXME: could descend into bit comparison here */ - log_info("multiple identical devices found. syspath is unreliable\n"); + log_info(NULL, "multiple identical devices found. syspath is unreliable\n"); break; } else { strcpy(buf, SYS_INPUT_DIR); @@ -274,7 +274,7 @@ libevdev_uinput_create_from_device(const struct libevdev *dev, int fd, struct li new_device->fd_is_managed = 1; } else if (fd < 0) { - log_bug("Invalid fd %d\n", fd); + log_bug(NULL, "Invalid fd %d\n", fd); errno = EBADF; goto error; } @@ -317,7 +317,7 @@ libevdev_uinput_create_from_device(const struct libevdev *dev, int fd, struct li new_device->fd = fd; if (fetch_syspath_and_devnode(new_device) == -1) { - log_error("unable to fetch syspath or device node.\n"); + log_error(NULL, "unable to fetch syspath or device node.\n"); errno = ENODEV; goto error; } |
