Skip to content

Commit eda8be2

Browse files
committed
FreeBSD related fixes
1 parent ed39ab8 commit eda8be2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

docs/changelog.rst

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Changelog
88

99
- Slightly faster reading of events.
1010

11+
- Fix build on FreeBSD.
12+
1113

1214
1.8.0 (Jan 25, 2025)
1315
====================

setup.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
import shutil
44
import textwrap
5+
import platform
56
from pathlib import Path
67
from subprocess import run
78

@@ -25,7 +26,11 @@ def create_ecodes(headers=None):
2526
include_paths.update(c_inc_path.split(":"))
2627

2728
include_paths.add("/usr/include")
28-
files = ["linux/input.h", "linux/input-event-codes.h", "linux/uinput.h"]
29+
if platform.system().lower() == "freebsd":
30+
files = ["dev/evdev/input.h", "dev/evdev/input-event-codes.h", "dev/evdev/uinput.h"]
31+
else:
32+
files = ["linux/input.h", "linux/input-event-codes.h", "linux/uinput.h"]
33+
2934
headers = [os.path.join(path, file) for path in include_paths for file in files]
3035

3136
headers = [header for header in headers if os.path.isfile(header)]

src/evdev/genecodes_c.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
# -----------------------------------------------------------------------------
28-
macro_regex = r"#define +((?:KEY|ABS|REL|SW|MSC|LED|BTN|REP|SND|ID|EV|BUS|SYN|FF|UI_FF|INPUT_PROP)_\w+)"
28+
macro_regex = r"#define\s+((?:KEY|ABS|REL|SW|MSC|LED|BTN|REP|SND|ID|EV|BUS|SYN|FF|UI_FF|INPUT_PROP)_\w+)"
2929
macro_regex = re.compile(macro_regex)
3030

3131
# Uname without hostname.
@@ -38,6 +38,7 @@
3838
#include <Python.h>
3939
#ifdef __FreeBSD__
4040
#include <dev/evdev/input.h>
41+
#include <dev/evdev/uinput.h>
4142
#else
4243
#include <linux/input.h>
4344
#include <linux/uinput.h>

0 commit comments

Comments
 (0)