pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Import devel/libopeninput



Module Name:	pkgsrc-wip
Committed By:	kikadf <kikadf.01%gmail.com@localhost>
Pushed By:	kikadf
Date:		Sat Apr 18 13:16:49 2026 +0200
Changeset:	c4814611b63c7b1365ec3d36d5222d6e4ee2abc0

Modified Files:
	Makefile
Added Files:
	libopeninput/DESCR
	libopeninput/Makefile
	libopeninput/Makefile.common
	libopeninput/PLIST
	libopeninput/buildlink3.mk
	libopeninput/distinfo
	libopeninput/patches/patch-src_wscons.c
	libopeninput/patches/patch-src_wscons.h

Log Message:
Import devel/libopeninput

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c4814611b63c7b1365ec3d36d5222d6e4ee2abc0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                |   1 +
 libopeninput/DESCR                      |   4 +
 libopeninput/Makefile                   |  24 ++++
 libopeninput/Makefile.common            |  18 +++
 libopeninput/PLIST                      |  83 +++++++++++++
 libopeninput/buildlink3.mk              |  16 +++
 libopeninput/distinfo                   |   7 ++
 libopeninput/patches/patch-src_wscons.c | 212 ++++++++++++++++++++++++++++++++
 libopeninput/patches/patch-src_wscons.h |  19 +++
 9 files changed, 384 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index c47da10f15..b7e5b8aac0 100644
--- a/Makefile
+++ b/Makefile
@@ -2128,6 +2128,7 @@ SUBDIR+=	libntfs
 SUBDIR+=	libode
 SUBDIR+=	liboglappth
 SUBDIR+=	libopenmodeller
+SUBDIR+=	libopeninput
 SUBDIR+=	libopenshot
 SUBDIR+=	libopenshot-audio
 SUBDIR+=	libopensync-dev
diff --git a/libopeninput/DESCR b/libopeninput/DESCR
new file mode 100644
index 0000000000..d5da285300
--- /dev/null
+++ b/libopeninput/DESCR
@@ -0,0 +1,4 @@
+The libinput is an input device management and event
+handling library to linux.
+The libopeninput is a wscons(4) and kqueue(2) based
+reimplementation of libinput, originally to OpenBSD.
diff --git a/libopeninput/Makefile b/libopeninput/Makefile
new file mode 100644
index 0000000000..487a25c8fb
--- /dev/null
+++ b/libopeninput/Makefile
@@ -0,0 +1,24 @@
+# $NetBSD: Makefile,v 1.1 2026/04/13 15:19:36 kikadf Exp $
+
+.include "Makefile.common"
+
+COMMENT=	Wscons(4) and kqueue(2) based port of libinput
+
+USE_TOOLS+=	pkg-config
+
+# wscons
+ONLY_FOR_PLATFORM=	NetBSD-*-*
+ONLY_FOR_PLATFORM+=	OpenBSD-*-*
+
+MESON_ARGS+=	-Dlibwacom=false
+MESON_ARGS+=	-Ddocumentation=false
+MESON_ARGS+=	-Dtests=false
+
+PKGCONFIG_OVERRIDE+=		output/meson-private/libinput.pc
+PKGCONFIG_OVERRIDE_STAGE=	post-build
+
+.include "../../devel/meson/build.mk"
+.include "../../devel/libepoll-shim/buildlink3.mk"
+.include "../../devel/libudev-bsd/buildlink3.mk"
+.include "../../devel/input-headers/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/libopeninput/Makefile.common b/libopeninput/Makefile.common
new file mode 100644
index 0000000000..16f48801da
--- /dev/null
+++ b/libopeninput/Makefile.common
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile.common,v 1.1 2026/04/13 15:19:36 kikadf Exp $
+
+# used by devel/libopeninput/Makefile
+# used by devel/input-headers/Makefile
+
+DISTNAME=	libopeninput-${VERSION}
+VERSION=	1.30.2
+CATEGORIES=	devel
+MASTER_SITES=	${MASTER_SITE_GITHUB:=sizeofvoid/}
+GITHUB_PROJECT=	libopeninput
+GITHUB_TAG=	1db645a4a690088135ba34a70efd7b764ecd8c0f
+
+MAINTAINER=	kikadf.01%gmail.com@localhost
+HOMEPAGE=	https://github.com/sizeofvoid/libopeninput/tree/libopeninput/
+LICENSE=	mit
+
+DISTINFO_FILE=	${.CURDIR}/../../devel/libopeninput/distinfo
+PATCHDIR=	${.CURDIR}/../../devel/libopeninput/patches
diff --git a/libopeninput/PLIST b/libopeninput/PLIST
new file mode 100644
index 0000000000..367c8f2229
--- /dev/null
+++ b/libopeninput/PLIST
@@ -0,0 +1,83 @@
+@comment $NetBSD: PLIST,v 1.1 2026/04/13 15:19:36 kikadf Exp $
+include/libinput.h
+lib/libinput.so
+lib/libinput.so.10
+lib/libinput.so.10.13.0
+lib/pkgconfig/libinput.pc
+man/man1/libinput-analyze-buttons.1
+man/man1/libinput-analyze-per-slot-delta.1
+man/man1/libinput-analyze-recording.1
+man/man1/libinput-analyze-touch-down-state.1
+man/man1/libinput-analyze.1
+man/man1/libinput-debug-events.1
+man/man1/libinput-debug-tablet-pad.1
+man/man1/libinput-debug-tablet.1
+man/man1/libinput-list-devices.1
+man/man1/libinput-list-kernel-devices.1
+man/man1/libinput-measure-fuzz.1
+man/man1/libinput-measure-touch-size.1
+man/man1/libinput-measure-touchpad-pressure.1
+man/man1/libinput-measure-touchpad-size.1
+man/man1/libinput-measure-touchpad-tap.1
+man/man1/libinput-measure.1
+man/man1/libinput-quirks-list.1
+man/man1/libinput-quirks-validate.1
+man/man1/libinput-quirks.1
+man/man1/libinput-record.1
+man/man1/libinput-replay.1
+man/man1/libinput-test.1
+man/man1/libinput.1
+share/libinput/10-generic-keyboard.quirks
+share/libinput/10-generic-mouse.quirks
+share/libinput/10-generic-trackball.quirks
+share/libinput/30-vendor-a4tech.quirks
+share/libinput/30-vendor-aiptek.quirks
+share/libinput/30-vendor-alps.quirks
+share/libinput/30-vendor-contour.quirks
+share/libinput/30-vendor-cypress.quirks
+share/libinput/30-vendor-elantech.quirks
+share/libinput/30-vendor-glorious.quirks
+share/libinput/30-vendor-goodix.quirks
+share/libinput/30-vendor-huion.quirks
+share/libinput/30-vendor-ibm.quirks
+share/libinput/30-vendor-ite.quirks
+share/libinput/30-vendor-kensington.quirks
+share/libinput/30-vendor-logitech.quirks
+share/libinput/30-vendor-madcatz.quirks
+share/libinput/30-vendor-microsoft.quirks
+share/libinput/30-vendor-nulea.quirks
+share/libinput/30-vendor-oracle.quirks
+share/libinput/30-vendor-qemu.quirks
+share/libinput/30-vendor-razer.quirks
+share/libinput/30-vendor-synaptics.quirks
+share/libinput/30-vendor-trust.quirks
+share/libinput/30-vendor-uniwill.quirks
+share/libinput/30-vendor-vmware.quirks
+share/libinput/30-vendor-wacom.quirks
+share/libinput/50-system-acer.quirks
+share/libinput/50-system-apple.quirks
+share/libinput/50-system-asus.quirks
+share/libinput/50-system-chicony.quirks
+share/libinput/50-system-chuwi.quirks
+share/libinput/50-system-cyborg.quirks
+share/libinput/50-system-dell.quirks
+share/libinput/50-system-framework.quirks
+share/libinput/50-system-gigabyte.quirks
+share/libinput/50-system-google.quirks
+share/libinput/50-system-gpd.quirks
+share/libinput/50-system-graviton.quirks
+share/libinput/50-system-honor.quirks
+share/libinput/50-system-hp.quirks
+share/libinput/50-system-huawei.quirks
+share/libinput/50-system-icl.quirks
+share/libinput/50-system-lenovo.quirks
+share/libinput/50-system-lg.quirks
+share/libinput/50-system-minisforum.quirks
+share/libinput/50-system-pine64.quirks
+share/libinput/50-system-sony.quirks
+share/libinput/50-system-starlabs.quirks
+share/libinput/50-system-system76.quirks
+share/libinput/50-system-tongfang.quirks
+share/libinput/50-system-toshiba.quirks
+share/libinput/50-system-vaio.quirks
+share/zsh/site-functions/_libinput
diff --git a/libopeninput/buildlink3.mk b/libopeninput/buildlink3.mk
new file mode 100644
index 0000000000..8b11a74bd9
--- /dev/null
+++ b/libopeninput/buildlink3.mk
@@ -0,0 +1,16 @@
+# $NetBSD: buildlink3.mk,v 1.1 2026/04/13 15:19:36 kikadf Exp $
+
+BUILDLINK_TREE+=	libopeninput
+
+.if !defined(LIBOPENINPUT_BUILDLINK3_MK)
+LIBOPENINPUT_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.libopeninput+=	libopeninput>=1.30.2
+BUILDLINK_ABI_DEPENDS.libopeninput+=	libopeninput>=1.30.2
+BUILDLINK_PKGSRCDIR.libopeninput?=	../../devel/libopeninput
+
+.include "../../devel/input-headers/buildlink3.mk"
+
+.endif # LIBOPENINPUT_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-libopeninput
diff --git a/libopeninput/distinfo b/libopeninput/distinfo
new file mode 100644
index 0000000000..529cd9c2f6
--- /dev/null
+++ b/libopeninput/distinfo
@@ -0,0 +1,7 @@
+$NetBSD: distinfo,v 1.1 2026/04/13 15:19:36 kikadf Exp $
+
+BLAKE2s (libopeninput-1.30.2-1db645a4a690088135ba34a70efd7b764ecd8c0f.tar.gz) = dba9c2fcdb4266afb55833bd560a2af3c24d1383e3b46c2f50158d1b2940c932
+SHA512 (libopeninput-1.30.2-1db645a4a690088135ba34a70efd7b764ecd8c0f.tar.gz) = a801125dfd3fafeb360e13ee8ed4ab2835b3a46c4234cfba699a54994f28a4ad46f854ee5465a6e8eb4fa573393e67dcaa0308e1f104026a289417440577fe46
+Size (libopeninput-1.30.2-1db645a4a690088135ba34a70efd7b764ecd8c0f.tar.gz) = 1189202 bytes
+SHA1 (patch-src_wscons.c) = ccec4d8ced02d46525e62f082adc7bb03730c2e8
+SHA1 (patch-src_wscons.h) = 20c749ef79352094e1b646fdbe9566f95d7e0a41
diff --git a/libopeninput/patches/patch-src_wscons.c b/libopeninput/patches/patch-src_wscons.c
new file mode 100644
index 0000000000..95880c9781
--- /dev/null
+++ b/libopeninput/patches/patch-src_wscons.c
@@ -0,0 +1,212 @@
+$NetBSD: patch-src_wscons.c,v 1.1 2026/04/13 15:19:37 kikadf Exp $
+
+* Handle attached-detached devices with udev monitor
+
+--- src/wscons.c.orig	2026-03-08 12:38:09.000000000 +0000
++++ src/wscons.c
+@@ -46,51 +46,121 @@ static void
+ wscons_device_init_pointer_acceleration(struct wscons_device *device,
+               struct motion_filter *filter);
+ 
+-static int
+-udev_input_enable(struct libinput *libinput)
++static void
++wscons_udev_handler(void *data)
+ {
++	struct udev_input *input = data;
++	struct udev_device *udev_device;
+ 	struct libinput_seat *seat;
+ 	struct libinput_device *device;
++	uint64_t time;
++	struct timespec ts;
++	struct libinput_event *event;
++	const char *action, *devnode, *sysname;
+ 
+-	seat = wscons_seat_get(libinput, default_seat, default_seat_name);
+-	list_for_each(device, &seat->devices_list, link) {
+-		device->fd = open_restricted(libinput, device->devname, O_RDWR);
+-		device->source =
+-		    libinput_add_fd(libinput, device->fd,
+-			wscons_device_dispatch, device);
+-		if (!device->source) {
+-			return -ENOMEM;
++	udev_device = udev_monitor_receive_device(input->udev_monitor);
++	if (!udev_device)
++		return;
++
++	action = udev_device_get_action(udev_device);
++	devnode = udev_device_get_devnode(udev_device);
++	sysname = udev_device_get_sysname(udev_device);
++	if (!action || !devnode || !sysname)
++		goto out;
++
++	if (!(strneq(sysname, "wskbd", 5) || strneq(sysname, "wsmouse", 7)))
++		goto out;
++
++	if (streq(action, "add")) {
++		device = libinput_path_add_device(&input->base, devnode);
++		if (!device)
++			goto out;
++		clock_gettime(CLOCK_REALTIME, &ts);
++		time = s2us(ts.tv_sec) + ns2us(ts.tv_nsec);
++		event = calloc(1, sizeof(*event));
++		post_device_event(device, time, LIBINPUT_EVENT_DEVICE_ADDED, event);
++	}
++	else if (streq(action, "remove")) {
++		seat = wscons_seat_get(&input->base, default_seat, default_seat_name);
++		list_for_each(device, &seat->devices_list, link) {
++			if (device->devname && strcmp(device->devname, devnode) == 0) {
++				clock_gettime(CLOCK_REALTIME, &ts);
++				time = s2us(ts.tv_sec) + ns2us(ts.tv_nsec);
++				event = calloc(1, sizeof(*event));
++				post_device_event(device, time, LIBINPUT_EVENT_DEVICE_REMOVED, event);
++				libinput_path_remove_device(device);
++				break;
++			}
+ 		}
+ 	}
+-	return 0;
++
++out:
++	udev_device_unref(udev_device);
++}
++
++static int
++udev_input_enable(struct libinput *libinput)
++{
++	struct udev_input *input = (struct udev_input *)libinput;
++	struct udev *udev = input->udev;
++	int fd;
++
++	input->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
++	if (!input->udev_monitor) {
++		log_info(libinput, "udev: failed to create the udev monitor\n");
++		return -1;
++	}
++
++	if (udev_monitor_filter_add_match_subsystem_devtype(input->udev_monitor, "input", NULL)) {
++		log_info(libinput, "udev: failed to set up filter\n");
++		goto err;
++	}
++
++	if (udev_monitor_enable_receiving(input->udev_monitor)) {
++		log_info(libinput, "udev: failed to bind the udev monitor\n");
++		goto err;
++ 	}
++
++	fd = udev_monitor_get_fd(input->udev_monitor);
++	input->udev_monitor_source =
++			libinput_add_fd(&input->base, fd, wscons_udev_handler, input);
++	if (!input->udev_monitor_source) {
++		goto err;
++	}
++
++ 	return 0;
++
++err:
++	if (input->udev_monitor) {
++		udev_monitor_unref(input->udev_monitor);
++		input->udev_monitor = NULL;
++	}
++	return -1;
+ }
+ 
+ static void
+ udev_input_disable(struct libinput *libinput)
+ {
+-	struct libinput_seat *seat;
+-	struct libinput_device *device;
++	struct udev_input *input = (struct udev_input*)libinput;
+ 
+-	seat = wscons_seat_get(libinput, default_seat, default_seat_name);
+-	list_for_each(device, &seat->devices_list, link) {
+-		if (device->source) {
+-			libinput_remove_source(libinput, device->source);
+-			device->source = NULL;
+-		}
+-		close_restricted(libinput, device->fd);
++	if (input->udev_monitor_source) {
++		libinput_remove_source(&input->base, input->udev_monitor_source);
++		input->udev_monitor_source = NULL;
++	}
++	if (input->udev_monitor) {
++		udev_monitor_unref(input->udev_monitor);
++		input->udev_monitor = NULL;
+ 	}
+ }
+ 
+ static void
+ udev_input_destroy(struct libinput *libinput)
+ {
+-	struct libinput_seat *seat;
+-	struct libinput_device *device;
++	struct udev_input *input = (struct udev_input*)libinput;
+ 
+-	fprintf(stderr, "%s", __func__);
+-	seat = wscons_seat_get(libinput, default_seat, default_seat_name);
+-	list_for_each(device, &seat->devices_list, link) {
+-		close_restricted(libinput, device->fd);
++	if (input->udev) {
++		udev_unref(input->udev);
++		input->udev = NULL;
+ 	}
+ }
+ 
+@@ -295,17 +365,24 @@ libinput_udev_create_context(const struc
+ 			     void *user_data,
+ 			     struct udev *udev)
+ {
+-	struct libinput *libinput;
++	struct udev_input *input;
+ 
+-	libinput = calloc(1, sizeof(*libinput));
+-	if (libinput == NULL)
++	if (!interface || !udev)
++ 		return NULL;
++
++	input = calloc(1, sizeof(*input));
++	if (!input)
+ 		return NULL;
+ 
+-	if (libinput_init(libinput, interface, &interface_backend, user_data) != 0) {
+-		free(libinput);
++	if (libinput_init(&input->base, interface, &interface_backend, user_data) != 0) {
++		libinput_unref(&input->base);
++		free(input);
+ 		return NULL;
+ 	}
+-	return libinput;
++
++	input->udev = udev_ref(udev);
++
++	return &input->base;
+ }
+ 
+ LIBINPUT_EXPORT int
+@@ -317,6 +394,7 @@ libinput_udev_assign_seat(struct libinpu
+ 	uint64_t time;
+ 	struct timespec ts;
+ 	struct libinput_event *event;
++	struct udev_input *input = (struct udev_input*)libinput;
+ 
+ 	/* Add standard devices */
+ 	for (int i = 0; i < 10; i++) {
+@@ -342,6 +420,10 @@ libinput_udev_assign_seat(struct libinpu
+ 		post_device_event(device, time, LIBINPUT_EVENT_DEVICE_ADDED,
+ 		    event);
+ 	}
++
++	if (udev_input_enable(&input->base) < 0)
++		return -1;
++
+ 	return 0;
+ }
+ 
+@@ -609,6 +691,7 @@ libinput_path_remove_device(struct libin
+ {
+ 	struct libinput *libinput = device->seat->libinput;
+ 
++	list_remove(&device->link);
+ 	libinput_remove_source(libinput, device->source);
+ 	device->source = NULL;
+ 
diff --git a/libopeninput/patches/patch-src_wscons.h b/libopeninput/patches/patch-src_wscons.h
new file mode 100644
index 0000000000..f7fcac0310
--- /dev/null
+++ b/libopeninput/patches/patch-src_wscons.h
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_wscons.h,v 1.1 2026/04/13 15:19:37 kikadf Exp $
+
+* Handle attached-detached devices with udev monitor
+
+--- src/wscons.h.orig	2026-03-08 12:38:09.000000000 +0000
++++ src/wscons.h
+@@ -25,6 +25,12 @@ struct wscons_device {
+ 	} pointer;
+ };
+ 
++struct udev_input {
++	struct libinput base;
++	struct udev *udev;
++	struct udev_monitor *udev_monitor;
++	struct libinput_source *udev_monitor_source;
++};
+ 
+ static inline struct wscons_device *
+ wscons_device(struct libinput_device *device)


Home | Main Index | Thread Index | Old Index