Skip to content

Commit 7806499

Browse files
authored
Migrate to hidapi python package (#1812)
1 parent 8461676 commit 7806499

File tree

19 files changed

+56
-392
lines changed

19 files changed

+56
-392
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ jobs:
656656
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/dist.txt', 'reqs/dist_extra_gui_qt.txt', 'reqs/test.txt') }}
657657

658658
- name: Install system dependencies
659-
run: apt_get_install cmake libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev libegl-dev libxkbcommon-x11-0
659+
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libegl-dev libxkbcommon-x11-0
660660

661661
- name: Setup Python environment
662662
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/dist_extra_gui_qt.txt -r reqs/test.txt
@@ -862,7 +862,7 @@ jobs:
862862
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/build.txt', 'reqs/setup.txt', 'reqs/dist_*.txt', 'linux/appimage/deps.sh') }}
863863

864864
- name: Install system dependencies
865-
run: apt_get_install cmake libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev libegl-dev libxkbcommon-x11-0
865+
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libegl-dev libxkbcommon-x11-0
866866

867867
- name: Setup Python environment
868868
run: setup_python_env -c reqs/constraints.txt -r reqs/build.txt -r reqs/setup.txt

.github/workflows/ci/workflow_template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
<% endif %>
147147
<% if j.type in ['build', 'test_gui_qt'] and j.os == 'Linux' %>
148148
- name: Install system dependencies
149-
run: apt_get_install cmake libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev libegl-dev libxkbcommon-x11-0
149+
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libegl-dev libxkbcommon-x11-0
150150

151151
<% endif %>
152152
<% if j.type != 'notarize' %>

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ include test/*.py
3434
include test/gui_qt/*.py
3535
include tox.ini
3636
include windows/*
37-
exclude dev/*
3837
exclude .pre-commit-config.yaml
3938
# without first including it, exluding .readthedocs.yml results in a warning when running locally
4039
include .readthedocs.yml

dev/build_hidapi.sh

Lines changed: 0 additions & 158 deletions
This file was deleted.

dev/write_hidapi_pth.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

linux/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
To be able to setup a complete development environment, you'll need to manually
66
install some system libraries (including the development version of your
77
distribution corresponding packages):
8-
- Treal support: `libusb` (1.0) and `libudev` are needed by
9-
the [`hidapi` package](https://pypi.org/project/hidapi/).
108
- log / notifications support: `libdbus` is needed.
119

1210
For the rest of the steps, follow the [developer guide](../doc/developer_guide.md).

linux/appimage/build.sh

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
set -e
44

5-
. ./plover_build_utils/deps.sh
65
. ./plover_build_utils/functions.sh
76

87
topdir="$PWD"
@@ -197,33 +196,10 @@ run "$linuxdeploy" \
197196
# Install Plover and dependencies.
198197
bootstrap_dist "$wheel"
199198

200-
# ------- Start: Build & bundle hidapi from source -------
201-
hidapi_src="$builddir/hidapi-src"
202-
hidapi_bld="$builddir/hidapi-build"
203-
204-
. ./linux/build_hidapi.sh
205-
206-
echo "Downloading and unpacking hidapi ${hidapi_version}"
207-
fetch_hidapi "$hidapi_src" "$builddir"
208-
209-
echo "Building hidapi…"
210-
cmake_build_linux "$hidapi_src" "$hidapi_bld" "Release"
211-
212-
# Locate the produced .so
213-
hidapi_so="$(find "$hidapi_bld" -name 'libhidapi-hidraw.so*' -type f -print -quit)"
214-
if [ -z "$hidapi_so" ] || [ ! -f "$hidapi_so" ]; then
215-
echo "Error: built libhidapi-hidraw.so not found." >&2
216-
exit 3
217-
fi
218-
219-
# Bundle into the AppDir's lib directory
220-
run cp -v "$hidapi_so" "$appdir/usr/lib/"
221-
base="$(basename "$hidapi_so")"
222-
# Add symlink for unversioned .so if needed
223-
if [ ! -e "$appdir/usr/lib/libhidapi-hidraw.so" ]; then
224-
ln -s "$base" "$appdir/usr/lib/libhidapi-hidraw.so"
225-
fi
226-
# ------- End: Build & bundle hidapi from source -------
199+
# Reinstall hidapi with the hidraw backend; libusb reports usage/usage_page as 0,
200+
# which results in HID keyboards not being detected by Plover.
201+
run "$python" -m pip uninstall -y hidapi || true
202+
run_eval "HIDAPI_WITH_HIDRAW=1 HIDAPI_WITH_LIBUSB=0 $python -m pip install --no-binary :all: --no-cache-dir hidapi"
227203

228204
# Trim the fat, second pass.
229205
run "$python" -m plover_build_utils.trim "$appdir" "$builddir/blacklist.txt"

linux/build_hidapi.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

news.d/api/1812.core.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Migrate HID library to cython-hidapi.

osx/build_hidapi.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)