x11-drivers/xf86-input-evdev: add new port

PR:		196978
Submitted by:	hselasky

This package contains the X.Org xf86-input-evdev driver. It supports
all input devices that webcamd knows about, including tablets,
touchscreens, joysticks and HIDs.
This commit is contained in:
Jan Beich 2015-09-16 10:28:43 +00:00
parent da5c6b0587
commit efa1a100ac
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=397050
7 changed files with 130 additions and 0 deletions

View file

@ -7,6 +7,7 @@
SUBDIR += xf86-input-acecad
SUBDIR += xf86-input-egalax
SUBDIR += xf86-input-elographics
SUBDIR += xf86-input-evdev
SUBDIR += xf86-input-fpit
SUBDIR += xf86-input-hyperpen
SUBDIR += xf86-input-joystick

View file

@ -0,0 +1,33 @@
# $FreeBSD$
PORTNAME= xf86-input-evdev
PORTVERSION= 2.9.2
CATEGORIES= x11-drivers
MAINTAINER= x11@FreeBSD.org
COMMENT= X.Org event device input driver
LICENSE= MIT # various styles
LICENSE_FILE= ${WRKSRC}/COPYING
BUILD_DEPENDS= v4l_compat>=1.0.20110603:${PORTSDIR}/multimedia/v4l_compat
LIB_DEPENDS= libevdev.so:${PORTSDIR}/devel/libevdev
RUN_DEPENDS= webcamd>=3.1.0.1:${PORTSDIR}/multimedia/webcamd
XORG_CAT= driver
USES= pathfix
CONFIGURE_ENV= UDEV_CFLAGS=" " UDEV_LIBS=" "
INSTALL_TARGET= install-strip
OPTIONS_DEFINE= MULTITOUCH
MULTITOUCH_DESC= XInput 2.2 multitouch support
MULTITOUCH_LIB_DEPENDS= libmtdev.so:${PORTSDIR}/devel/libmtdev
post-patch-MULTITOUCH-off:
# XXX Convert to CONFIGURE_ENV
@${REINPLACE_CMD} -i '.mtdev.bak' \
-e '/PKG_CONFIG/s/mtdev/nonexistent/' \
${WRKSRC}/configure
.include <bsd.port.mk>

View file

@ -0,0 +1,2 @@
SHA256 (xorg/driver/xf86-input-evdev-2.9.2.tar.bz2) = 792329b531afc6928ccda94e4b51a5520d4ddf8ef9a00890a5d0d31898acefec
SIZE (xorg/driver/xf86-input-evdev-2.9.2.tar.bz2) = 387095

View file

@ -0,0 +1,66 @@
--- src/evdev.c.orig 2015-03-27 01:35:50 UTC
+++ src/evdev.c
@@ -37,9 +37,13 @@
#include <X11/keysym.h>
#include <X11/extensions/XI.h>
+#ifdef __linux__
#include <linux/version.h>
+#endif
#include <sys/stat.h>
+#ifdef HAVE_LIBUDEV
#include <libudev.h>
+#endif
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
@@ -222,6 +226,7 @@ EvdevIsDuplicate(InputInfoPtr pInfo)
static BOOL
EvdevDeviceIsVirtual(const char* devicenode)
{
+#ifdef HAVE_LIBUDEV
struct udev *udev = NULL;
struct udev_device *device = NULL;
struct stat st;
@@ -252,6 +257,9 @@ out:
udev_device_unref(device);
udev_unref(udev);
return rc;
+#else
+ return FALSE;
+#endif
}
#ifndef HAVE_SMOOTH_SCROLLING
@@ -1086,11 +1094,13 @@ EvdevReadInput(InputInfoPtr pInfo)
do {
rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
if (rc < 0) {
- if (rc == -ENODEV) /* May happen after resume */
+ if (rc != -EAGAIN && rc != -EINTR && rc != -EWOULDBLOCK) {
+ /* May happen after resume or at device detach */
xf86RemoveEnabledDevice(pInfo);
- else if (rc != -EAGAIN)
+ EvdevCloseDevice(pInfo);
LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error: %s\n", pInfo->name,
strerror(-rc));
+ }
break;
} else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) {
#ifdef MULTITOUCH
@@ -1470,10 +1480,15 @@ EvdevAddAbsValuatorClass(DeviceIntPtr de
continue;
abs = libevdev_get_abs_info(pEvdev->dev, axis);
+#ifdef __linux__
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30)
/* Kernel provides units/mm, X wants units/m */
resolution = abs->resolution * 1000;
#endif
+#else
+ /* Kernel provides units/mm, X wants units/m */
+ resolution = abs->resolution * 1000;
+#endif
xf86InitValuatorAxisStruct(device, axnum,
atoms[axnum],

View file

@ -0,0 +1,19 @@
--- src/evdev.h.orig 2015-03-27 01:35:50 UTC
+++ src/evdev.h
@@ -36,7 +36,15 @@
#define EVDEV_H
#include <linux/input.h>
-#include <linux/types.h>
+#include <sys/types.h>
+
+/* XXX Copied from <xf86str.h> for linux */
+/* Tolerate prior #include <linux/input.h> */
+#undef BUS_NONE
+#undef BUS_PCI
+#undef BUS_SBUS
+#undef BUS_PLATFORM
+#undef BUS_last
#include <xorg-server.h>
#include <xf86Xinput.h>

View file

@ -0,0 +1,5 @@
This package contains the X.Org xf86-input-evdev driver. It supports
all input devices that webcamd knows about, including tablets,
touchscreens, joysticks and HIDs.
WWW: http://www.x.org

View file

@ -0,0 +1,4 @@
include/xorg/evdev-properties.h
lib/xorg/modules/input/evdev_drv.so
libdata/pkgconfig/xorg-evdev.pc
man/man4/evdev.4x.gz