[PATCH evemu 1/2] tools: evemu-device: rely on libevdev to retrieve the device node
Benjamin Tissoires
benjamin.tissoires at gmail.com
Thu Jan 9 15:08:14 PST 2014
On 09/01/14 17:53, Peter Hutterer wrote:
> On Thu, Jan 09, 2014 at 05:15:10PM -0500, Benjamin Tissoires wrote:
>> Cleanup a little evemu-device now that we rely on libevdev for the internal
>> stuffs.
>> Needs to export a new function evemu_get_devnode, but we already have
>> broken the ABI.
>>
>> Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
>> ---
>>
>> Not sure about the ABI breakage (new function) and the soname bump, but still,
>> there has been no release since the last bump...
>
> no bump needed then, people building against git versions cannot expect ABI
> stability.
>
> Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Thanks
>
> note that we can pass LIBEVDEV_UINPUT_OPEN_MANAGED as fd, so it's likely we
> can drop the rest of this file too.
>
So is this patch validated also?
From: Benjamin Tissoires <benjamin.tissoires at gmail.com>
Date: Thu, 9 Jan 2014 18:06:15 -0500
Subject: [PATCH evemu] tools: device: rely on libevdev to open the
uinput node
libevdev can take care of the uinput node, I am glad to remove this part.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
---
tools/Makefile.am | 2 ++
tools/evemu-device.c | 12 ++----------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index f61aca1..95d417f 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -18,6 +18,8 @@ evemu_record_SOURCES = evemu-record.c
find_event_devices.c find_event_devices.h
evemu_event_CFLAGS = $(LIBEVDEV_CFLAGS)
evemu_event_LDADD = $(LIBEVDEV_LIBS)
+evemu_device_CFLAGS = $(LIBEVDEV_CFLAGS)
+
# man page generation
if HAVE_DOCTOOLS
# actual man pages
diff --git a/tools/evemu-device.c b/tools/evemu-device.c
index 46ffaeb..7dfe1d7 100644
--- a/tools/evemu-device.c
+++ b/tools/evemu-device.c
@@ -49,8 +49,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-
-#define UINPUT_NODE "/dev/uinput"
+#include <libevdev/libevdev-uinput.h>
/*
* Finds the newly created device node and holds it open.
@@ -85,7 +84,6 @@ static int evemu_device(FILE *fp)
{
struct evemu_device *dev;
int ret = -ENOMEM;
- int fd;
dev = evemu_new(NULL);
if (!dev)
@@ -100,18 +98,12 @@ static int evemu_device(FILE *fp)
evemu_set_name(dev, name);
}
- ret = fd = open(UINPUT_NODE, O_WRONLY);
+ ret = evemu_create(dev, LIBEVDEV_UINPUT_OPEN_MANAGED);
if (ret < 0)
goto out;
-
- ret = evemu_create(dev, fd);
- if (ret < 0)
- goto out_close;
hold_device(dev);
evemu_destroy(dev);
-out_close:
- close(fd);
out:
evemu_delete(dev);
--
1.8.3.1
Cheers,
Benjamin
More information about the Input-tools
mailing list