Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bfb50b2
Default branch is now main
whot Apr 29, 2021
ef15144
Add some OpenBSD notes
sizeofvoid Nov 2, 2022
cc36e4e
Modify meson to build on OpenBSD
sizeofvoid Nov 4, 2022
e0a6e25
add a generic input-event-code header file
sizeofvoid Nov 6, 2022
fcf9f4c
Fake udev-seat for now
sizeofvoid Nov 6, 2022
63a75a0
Bring back some udev bits since robert imported libudev-openbsd
sizeofvoid Nov 12, 2022
2c5c2a4
Add wscons and wskbdmap from https://github.com/mherrb/libinput/
sizeofvoid Sep 3, 2023
7ac4a15
fix compile with new libinput_init API
sizeofvoid Sep 3, 2023
9357ecb
sync with 1.24.0
sizeofvoid Sep 3, 2023
06f10ec
fix with new API
sizeofvoid Sep 3, 2023
06b4a89
add vertical/horizontal scrolling support
sizeofvoid Sep 3, 2023
d7210ae
Enable dep_libinput_util
sizeofvoid Sep 4, 2023
f84007b
add libevdev.h
sizeofvoid Sep 4, 2023
7327336
Do not install libinput under /etc on OpenBSD
sizeofvoid Sep 4, 2023
1c9a092
try to fix a lazy binding issue
sizeofvoid Sep 4, 2023
c20e869
return unsupported instead of a null ptr
sizeofvoid Sep 4, 2023
26b7c6b
Sync with matthieu
sizeofvoid Sep 4, 2023
7ef612d
Fix the mouse button mapping for wsmouse
mherrb Nov 8, 2023
1369aa2
Fix compile
sizeofvoid Nov 15, 2023
f5930e9
Add support for USB keyboards
mherrb Dec 22, 2023
b12c5d2
OpenBSD lacks strtod_l(3) but defaults to C locale semantics anyways
mherrb Dec 22, 2023
41446a3
white space fixes
mherrb Dec 23, 2023
60f16ee
remove some debugging printf()s
mherrb Dec 23, 2023
ba8406a
Better wscons device initialization and keyboard mapping handling.
mherrb Dec 23, 2023
dbf0663
Provide the actual device names to libinput
mherrb Jul 13, 2024
4e305ac
Implement device enable/disable.
mherrb Jul 13, 2024
3f0bb87
Return 0 as vendor and device id
mherrb Jul 14, 2024
7e4471c
Skip "/dev/" from the device name.
mherrb Jul 14, 2024
9e017da
Add individual input devices, not the mux.
mherrb Jul 14, 2024
2fd417e
Downgrade the display of keyboard type to level 'info'
mherrb Jul 14, 2024
c296ac6
Try to clean up on exit
mherrb Jul 14, 2024
1fcdd91
use close_restricted() to close fd opened by open_restricted().
mherrb Jul 14, 2024
c9ca8a1
Merge tag '1.26.2' into build-on-openbsd
mherrb Nov 4, 2024
8f05875
merge 1.26.2
mherrb Nov 4, 2024
03349b6
openbsd : touchpad: add clickfinger button map
mherrb Nov 5, 2024
c695dd1
remove unused file
mherrb Aug 18, 2024
65eb6c2
port pointer acceleration logic from evdev.c to wscons.c and
VlkrS Aug 1, 2025
cf9699e
Remove extra file not part of libinput.
mherrb Aug 17, 2025
f12f63e
Revert "Remove extra file not part of libinput."
mherrb Sep 19, 2025
b637f07
Build on NetBSD
kikadf Sep 7, 2025
15d0a08
Fix build on NetBSD
kikadf Sep 9, 2025
5e93d5c
Use portable wsevent>type checks instead of OS-specific macros
kikadf Sep 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
libinput
lib(open)input
========

libinput is a library that provides a full input stack for display servers
Expand All @@ -11,6 +11,22 @@ provide the common set of functionality that users expect. Input event
processing includes scaling touch coordinates, generating
relative pointer events from touchpads, pointer acceleration, etc.

OpenBSD related changes
-----------------------
This repository fork from https://gitlab.freedesktop.org/libinput/libinput.
It is an attempt to extend libinput so that it works with wscons(4) and
kqueue(2) and thus on OpenBSD.

```
$ meson setup builddir -Dlibwacom=false -Ddocumentation=false
$ cd builddir && ninja
```

TODO:
[X] Build and Compile on OpenBSD
[ ] Port logic from https://github.com/mpieuchot/libinput


User documentation
------------------

Expand Down
32 changes: 32 additions & 0 deletions include/libevdev/libevdev.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © 2013 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/

#ifndef LIBEVDEV_H
#define LIBEVDEV_H

#include <linux/input.h>

extern int libevdev_event_code_from_name(unsigned int type, const char *name);
extern const char * libevdev_event_code_get_name(unsigned int type, unsigned int code);
#endif
5 changes: 5 additions & 0 deletions include/linux/input-event-codes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef __linux__
#include "linux/input-event-codes.h"
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
#include "freebsd/input-event-codes.h"
#endif
2 changes: 1 addition & 1 deletion include/linux/input.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef __linux__
#include "linux/input.h"
#elif __FreeBSD__
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
#include "freebsd/input.h"
#endif
76 changes: 67 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,17 @@ config_h.set10('HAVE_INSTALLED_TESTS', get_option('install-tests'))

# Dependencies
pkgconfig = import('pkgconfig')
dep_udev = dependency('libudev')
dep_mtdev = dependency('mtdev', version : '>= 1.1.0')
dep_libevdev = dependency('libevdev')
config_h.set10('HAVE_LIBEVDEV_DISABLE_PROPERTY',
dep_libevdev.version().version_compare('>= 1.9.902'))
if host_machine.system() == 'openbsd' or host_machine.system() == 'netbsd'
dep_udev = dependency('libudev')
dep_mtdev = []
dep_libevdev = []
else
dep_udev = dependency('libudev')
dep_mtdev = dependency('mtdev', version : '>= 1.1.0')
dep_libevdev = dependency('libevdev')
config_h.set10('HAVE_LIBEVDEV_DISABLE_PROPERTY',
dep_libevdev.version().version_compare('>= 1.9.902'))
endif

dep_lm = cc.find_library('m', required : false)
dep_rt = cc.find_library('rt', required : false)
Expand All @@ -158,7 +164,11 @@ includes_src = include_directories('src')

############ libwacom configuration ############

if host_machine.system() == 'openbsd' or host_machine.system() == 'netbsd'
have_libwacom = false
else
have_libwacom = get_option('libwacom')
endif
config_h.set10('HAVE_LIBWACOM', have_libwacom)
if have_libwacom
dep_libwacom = dependency('libwacom', version : '>= 0.27')
Expand All @@ -167,7 +177,7 @@ else
endif

############ udev bits ############

if host_machine.system() != 'openbsd' and host_machine.system() != 'netbsd'
executable('libinput-device-group',
'udev/libinput-device-group.c',
dependencies : [dep_udev, dep_libwacom],
Expand Down Expand Up @@ -222,6 +232,7 @@ if get_option('tests')
suite : ['all'])
endif

endif
############ libepoll-shim (BSD) ############

if cc.has_header_symbol('sys/epoll.h', 'epoll_create1', prefix : prefix)
Expand Down Expand Up @@ -251,7 +262,6 @@ else
endif

############ libinput-util.a ############

# Basic compilation test to make sure the headers include and define all the
# necessary bits.
util_headers = [
Expand Down Expand Up @@ -304,11 +314,14 @@ src_libfilter = [
'src/filter-trackpoint.c',
'src/filter-trackpoint-flat.c',
]
if host_machine.system() == 'openbsd' or host_machine.system() == 'netbsd'
dep_libfilter = []
else
libfilter = static_library('filter', src_libfilter,
dependencies : [dep_udev, dep_libwacom],
include_directories : includes_include)
dep_libfilter = declare_dependency(link_with : libfilter)

endif
############ libquirks.a #############
libinput_data_path = dir_data
libinput_data_override_path = dir_overrides / 'local-overrides.quirks'
Expand All @@ -332,14 +345,25 @@ libquirks = static_library('quirks', src_libquirks,
dep_libquirks = declare_dependency(link_with : libquirks)

# Create /etc/libinput
if host_machine.system() != 'openbsd' and host_machine.system() != 'netbsd'
if meson.version().version_compare('>= 0.60')
install_emptydir(dir_etc / 'libinput')
else
install_subdir('libinput', install_dir : dir_etc)
endif
endif

############ libinput.so ############
install_headers('src/libinput.h')
if host_machine.system() == 'openbsd' or host_machine.system() == 'netbsd'
src_libinput = src_libfilter + [
'src/libinput_openbsd.c',
'src/libinput-private-config.c',
'src/timer.c',
'src/wskbdmap.c',
'src/wscons.c'
]
else
src_libinput = src_libfilter + [
'src/libinput.c',
'src/libinput-private-config.c',
Expand All @@ -362,6 +386,7 @@ src_libinput = src_libfilter + [
'src/udev-seat.c',
'src/timer.c',
]
endif

deps_libinput = [
dep_mtdev,
Expand Down Expand Up @@ -391,13 +416,26 @@ mapfile = dir_src / 'libinput.sym'
version_flag = '-Wl,--version-script,@0@'.format(mapfile)
lib_libinput = shared_library('input',
src_libinput,
include_directories : [include_directories('.'), includes_include],
include_directories : [include_directories('.'),
include_directories('include'),
include_directories('include/linux/freebsd'),
includes_include],
dependencies : deps_libinput,
version : libinput_so_version,
link_args : version_flag,
link_depends : mapfile,
install : true
)
if host_machine.system() == 'openbsd'
install_headers('include/linux/freebsd/input-event-codes.h', subdir: 'linux/freebsd')
install_headers('include/linux/freebsd/input.h', subdir: 'linux/freebsd')

install_headers('include/linux/linux/input-event-codes.h', subdir: 'linux/linux')
install_headers('include/linux/linux/input.h', subdir: 'linux/linux')

install_headers('include/linux/input.h', subdir: 'linux')
install_headers('include/linux/input-event-codes.h', subdir: 'linux')
endif

dep_libinput = declare_dependency(
link_with : lib_libinput,
Expand Down Expand Up @@ -432,6 +470,8 @@ endif
subdir('completion/zsh')

############ tools ############
if host_machine.system() != 'openbsd' and host_machine.system() != 'netbsd'

libinput_tool_path = dir_libexec
config_h.set_quoted('LIBINPUT_TOOL_PATH', libinput_tool_path)
tools_shared_sources = [ 'tools/shared.c' ]
Expand Down Expand Up @@ -675,7 +715,9 @@ test('tools-builddir-lookup-installed',
suite : ['all'],
workdir : '/tmp')

endif
############ tests ############
if host_machine.system() != 'openbsd' and host_machine.system() != 'netbsd'

test('symbols-leak-test',
find_program('test/symbols-leak-test'),
Expand Down Expand Up @@ -729,8 +771,10 @@ if get_option('tests')
config_h.set10('HAVE_GSTACK', gstack.found())

# for inhibit support during test run
if host_machine.system() != 'openbsd' and host_machine.system() != 'netbsd'
dep_libsystemd = dependency('libsystemd', version : '>= 221', required : false)
config_h.set10('HAVE_LIBSYSTEMD', dep_libsystemd.found())
endif

litest_sources = [
'src/libinput-private-config.c',
Expand Down Expand Up @@ -839,6 +883,7 @@ if get_option('tests')
'test/litest.c',
]

if host_machine.system() != 'openbsd' and host_machine.system() != 'netbsd'
dep_dl = cc.find_library('dl')
deps_litest = [
dep_libinput,
Expand All @@ -850,6 +895,14 @@ if get_option('tests')
dep_libsystemd,
dep_libquirks,
]
else
deps_litest = [
dep_libinput,
dep_check,
dep_lm,
dep_libquirks,
]
endif

litest_config_h = configuration_data()
litest_config_h.set_quoted('LIBINPUT_DEVICE_GROUPS_RULES_FILE',
Expand Down Expand Up @@ -973,6 +1026,7 @@ if get_option('tests')
endif


endif
############ man pages ############
man_config = configuration_data()
man_config.set('LIBINPUT_VERSION', meson.project_version())
Expand Down Expand Up @@ -1032,3 +1086,7 @@ configure_file(input : 'tools/libinput-quirks.man',

############ output files ############
configure_file(output : 'config.h', configuration : config_h)

warning('*********************************************************************')
warning('This branch is no longer updated. Please switch to the "main" branch.')
warning('*********************************************************************')
13 changes: 13 additions & 0 deletions src/libinput-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ struct libinput_device {
void *user_data;
int refcount;
struct libinput_device_config config;
struct libinput_source *source;
char* devname;
int fd;
};

enum libinput_tablet_tool_axis {
Expand Down Expand Up @@ -1011,4 +1014,14 @@ static inline void *libinput_libwacom_ref(struct libinput *li) { return NULL; }
static inline void libinput_libwacom_unref(struct libinput *li) {}
#endif


#if defined(__OpenBSD__) || defined(__NetBSD__)
void
axis_notify_event(struct libinput_device *device,
uint64_t time,
const struct normalized_coords *delta,
const struct device_float_coords *raw);
#endif


#endif /* LIBINPUT_PRIVATE_H */
5 changes: 5 additions & 0 deletions src/libinput-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@
#define LIBINPUT_EXPORT __attribute__ ((visibility("default")))
#define LIBINPUT_UNUSED __attribute__ ((unused))

#if defined(__OpenBSD__) || defined(__NetBSD__)
#define bit(x_) (1UL << (x_))
#define NBITS(b) (b * 8)
#endif

#endif /* LIBINPUT_UTIL_H */
Loading