@desklink/host 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +44 -0
- package/README.md +266 -0
- package/bin/desklink-host.mjs +113 -0
- package/dist/bridge.d.ts +57 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +208 -0
- package/dist/bridge.js.map +1 -0
- package/dist/engineProcess.d.ts +82 -0
- package/dist/engineProcess.d.ts.map +1 -0
- package/dist/engineProcess.js +243 -0
- package/dist/engineProcess.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +169 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +18 -0
- package/dist/protocol.js.map +1 -0
- package/dist/resolveEngine.d.ts +34 -0
- package/dist/resolveEngine.d.ts.map +1 -0
- package/dist/resolveEngine.js +103 -0
- package/dist/resolveEngine.js.map +1 -0
- package/docs/BOUNDARY.md +145 -0
- package/docs/PROTOCOL.md +363 -0
- package/engine/Cargo.lock +3077 -0
- package/engine/Cargo.toml +37 -0
- package/engine/build.rs +107 -0
- package/engine/native/inputtino_shim.cpp +11 -0
- package/engine/native/vpx_shim.c +184 -0
- package/engine/native/wrapper.h +7 -0
- package/engine/src/capture.rs +510 -0
- package/engine/src/clipboard.rs +132 -0
- package/engine/src/convert.rs +299 -0
- package/engine/src/encoder.rs +204 -0
- package/engine/src/input.rs +355 -0
- package/engine/src/keymap.rs +338 -0
- package/engine/src/main.rs +614 -0
- package/engine/src/peer.rs +775 -0
- package/engine/src/portal.rs +115 -0
- package/engine/src/protocol.rs +331 -0
- package/engine/src/session.rs +2159 -0
- package/engine/src/x11.rs +244 -0
- package/engine/vendor/inputtino/.clang-format +166 -0
- package/engine/vendor/inputtino/.clang-tidy +30 -0
- package/engine/vendor/inputtino/.dockerignore +11 -0
- package/engine/vendor/inputtino/.github/workflows/mirror-repo.yml +14 -0
- package/engine/vendor/inputtino/.github/workflows/python-lint-format-test-typecheck.yml +124 -0
- package/engine/vendor/inputtino/.github/workflows/python-test-install.yaml +49 -0
- package/engine/vendor/inputtino/.github/workflows/rust.yml +40 -0
- package/engine/vendor/inputtino/CMakeLists.txt +187 -0
- package/engine/vendor/inputtino/LICENSE +21 -0
- package/engine/vendor/inputtino/README.md +110 -0
- package/engine/vendor/inputtino/bindings/python/.devcontainer/Dockerfile +23 -0
- package/engine/vendor/inputtino/bindings/python/.devcontainer/devcontainer.json +28 -0
- package/engine/vendor/inputtino/bindings/python/.python-version +1 -0
- package/engine/vendor/inputtino/bindings/python/CMakeLists.txt +23 -0
- package/engine/vendor/inputtino/bindings/python/CPPLINT.cfg +2 -0
- package/engine/vendor/inputtino/bindings/python/Makefile +49 -0
- package/engine/vendor/inputtino/bindings/python/README.md +215 -0
- package/engine/vendor/inputtino/bindings/python/pyproject.toml +178 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/__init__.py +43 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/_core.pyi +533 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/base.py +63 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/joypad.py +248 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/keyboard.py +256 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/mouse.py +106 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/pentablet.py +73 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/py.typed +0 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/touchscreen.py +61 -0
- package/engine/vendor/inputtino/bindings/python/src/inputtino/trackpad.py +74 -0
- package/engine/vendor/inputtino/bindings/python/src/main.cpp +217 -0
- package/engine/vendor/inputtino/bindings/python/tests/__init__.py +0 -0
- package/engine/vendor/inputtino/bindings/python/tests/helpers.py +3 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_base.py +60 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_inputtino.py +5 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_joypad.py +332 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_keyboard.py +164 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_mouse.py +185 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_pentablet.py +198 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_touchscreen.py +144 -0
- package/engine/vendor/inputtino/bindings/python/tests/test_trackpad.py +146 -0
- package/engine/vendor/inputtino/bindings/python/uv.lock +390 -0
- package/engine/vendor/inputtino/bindings/rust/Cargo.toml +6 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/.dockerignore +1 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/Cargo.toml +18 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/examples/keyboard.rs +33 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/examples/mouse.rs +17 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/common.rs +116 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/error.rs +17 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/joypad.rs +74 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/joypad_nintendo.rs +135 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/joypad_ps5.rs +280 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/joypad_xbox.rs +134 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/keyboard.rs +76 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/lib.rs +32 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/src/mouse.rs +178 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/tests/common.rs +38 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/tests/joypads.rs +150 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/tests/keyboard.rs +73 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino/tests/mouse.rs +139 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino-sys/.dockerignore +1 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino-sys/Cargo.toml +12 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino-sys/build.rs +48 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino-sys/src/lib.rs +5 -0
- package/engine/vendor/inputtino/bindings/rust/inputtino-sys/wrapper.h +1 -0
- package/engine/vendor/inputtino/cmake/utils.cmake +9 -0
- package/engine/vendor/inputtino/docker/Dockerfile +70 -0
- package/engine/vendor/inputtino/include/inputtino/input.h +324 -0
- package/engine/vendor/inputtino/include/inputtino/input.hpp +466 -0
- package/engine/vendor/inputtino/include/inputtino/result.hpp +37 -0
- package/engine/vendor/inputtino/share/pkgconfig/libinputtino.pc.in +17 -0
- package/engine/vendor/inputtino/src/c-bindings/helpers.hpp +19 -0
- package/engine/vendor/inputtino/src/c-bindings/joypad_ps5.cpp +115 -0
- package/engine/vendor/inputtino/src/c-bindings/joypad_switch.cpp +63 -0
- package/engine/vendor/inputtino/src/c-bindings/joypad_xone.cpp +62 -0
- package/engine/vendor/inputtino/src/c-bindings/keyboard.cpp +42 -0
- package/engine/vendor/inputtino/src/c-bindings/mouse.cpp +67 -0
- package/engine/vendor/inputtino/src/c-bindings/pen_tablet.cpp +50 -0
- package/engine/vendor/inputtino/src/c-bindings/touchscreen.cpp +43 -0
- package/engine/vendor/inputtino/src/c-bindings/trackpad.cpp +49 -0
- package/engine/vendor/inputtino/src/uhid/README.adoc +63 -0
- package/engine/vendor/inputtino/src/uhid/include/crc32.hpp +38 -0
- package/engine/vendor/inputtino/src/uhid/include/uhid/protected_types.hpp +36 -0
- package/engine/vendor/inputtino/src/uhid/include/uhid/ps5.hpp +550 -0
- package/engine/vendor/inputtino/src/uhid/include/uhid/uhid.hpp +168 -0
- package/engine/vendor/inputtino/src/uhid/joypad_ps5.cpp +580 -0
- package/engine/vendor/inputtino/src/uinput/include/inputtino/keyboard.hpp +84 -0
- package/engine/vendor/inputtino/src/uinput/include/inputtino/protected_ps5_types.hpp +7 -0
- package/engine/vendor/inputtino/src/uinput/include/inputtino/protected_types.hpp +110 -0
- package/engine/vendor/inputtino/src/uinput/joypad_nintendo.cpp +190 -0
- package/engine/vendor/inputtino/src/uinput/joypad_ps.cpp +203 -0
- package/engine/vendor/inputtino/src/uinput/joypad_utils.hpp +246 -0
- package/engine/vendor/inputtino/src/uinput/joypad_xbox.cpp +190 -0
- package/engine/vendor/inputtino/src/uinput/keyboard.cpp +120 -0
- package/engine/vendor/inputtino/src/uinput/mouse.cpp +199 -0
- package/engine/vendor/inputtino/src/uinput/pentablet.cpp +162 -0
- package/engine/vendor/inputtino/src/uinput/touchscreen.cpp +140 -0
- package/engine/vendor/inputtino/src/uinput/trackpad.cpp +192 -0
- package/examples/reference-client.html +428 -0
- package/package.json +38 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.13...3.24)
|
|
2
|
+
|
|
3
|
+
# Project name and a few useful settings. Other commands can pick up the results
|
|
4
|
+
project(inputtino
|
|
5
|
+
VERSION 0.1
|
|
6
|
+
DESCRIPTION "A virtual input library"
|
|
7
|
+
LANGUAGES C CXX)
|
|
8
|
+
|
|
9
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
10
|
+
# general settings and options
|
|
11
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
include(cmake/utils.cmake)
|
|
14
|
+
include(GNUInstallDirs)
|
|
15
|
+
include(CMakePackageConfigHelpers)
|
|
16
|
+
|
|
17
|
+
# Only do these if this is the main project, and not if it is included through add_subdirectory
|
|
18
|
+
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
|
19
|
+
|
|
20
|
+
# Optionally set things like CMAKE_CXX_STANDARD, CMAKE_POSITION_INDEPENDENT_CODE here
|
|
21
|
+
|
|
22
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
23
|
+
|
|
24
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
25
|
+
|
|
26
|
+
# Let's ensure -std=c++xx instead of -std=g++xx
|
|
27
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
28
|
+
|
|
29
|
+
# Let's nicely support folders in IDEs
|
|
30
|
+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
31
|
+
|
|
32
|
+
option(BUILD_SHARED_LIBS "Build libs as shared" ON)
|
|
33
|
+
|
|
34
|
+
include(CTest)
|
|
35
|
+
|
|
36
|
+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
|
37
|
+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
|
38
|
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
|
39
|
+
|
|
40
|
+
if (NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
|
|
41
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
|
42
|
+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
|
43
|
+
endif ()
|
|
44
|
+
endif ()
|
|
45
|
+
|
|
46
|
+
# Make an automatic library - will be static or dynamic based on user setting
|
|
47
|
+
add_library(libinputtino)
|
|
48
|
+
add_library(inputtino::libinputtino ALIAS libinputtino)
|
|
49
|
+
|
|
50
|
+
# All users of this library will need at least C++17
|
|
51
|
+
target_compile_features(libinputtino PUBLIC cxx_std_17)
|
|
52
|
+
set_target_properties(libinputtino PROPERTIES LINKER_LANGUAGE CXX)
|
|
53
|
+
target_compile_definitions(libinputtino PUBLIC "$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:INPUTTINO_STATIC_DEFINE>")
|
|
54
|
+
|
|
55
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
56
|
+
# Export symbols
|
|
57
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
include(GenerateExportHeader)
|
|
60
|
+
set(export_file_name "export_shared.h")
|
|
61
|
+
|
|
62
|
+
if (NOT BUILD_SHARED_LIBS)
|
|
63
|
+
set(export_file_name "export_static.h")
|
|
64
|
+
endif ()
|
|
65
|
+
|
|
66
|
+
message(STATUS "Export file name: ${export_file_name}")
|
|
67
|
+
|
|
68
|
+
generate_export_header(libinputtino EXPORT_FILE_NAME include/inputtino/${export_file_name})
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
72
|
+
# Options
|
|
73
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
option(BUILD_C_BINDINGS "Build C bindings" OFF)
|
|
76
|
+
option(LIBINPUTTINO_INSTALL "Generate the install target" OFF)
|
|
77
|
+
option(USE_UHID "Add uhid implementation for advanced DualSense features" ON)
|
|
78
|
+
|
|
79
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
80
|
+
# Dependencies
|
|
81
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
82
|
+
|
|
83
|
+
if (UNIX AND NOT APPLE)
|
|
84
|
+
option(LIBEVDEV_CUSTOM_INCLUDE_DIR "Location to a custom libevdev source" OFF)
|
|
85
|
+
option(LIBEVDEV_CUSTOM_LIBRARY "Location to a custom libevdev library" OFF)
|
|
86
|
+
if (LIBEVDEV_CUSTOM_INCLUDE_DIR AND LIBEVDEV_CUSTOM_LIBRARY)
|
|
87
|
+
target_include_directories(libinputtino PUBLIC "${LIBEVDEV_CUSTOM_INCLUDE_DIR}")
|
|
88
|
+
target_link_libraries(libinputtino PUBLIC "${LIBEVDEV_CUSTOM_LIBRARY}")
|
|
89
|
+
else ()
|
|
90
|
+
find_package(PkgConfig)
|
|
91
|
+
pkg_check_modules(LIBEVDEV REQUIRED IMPORTED_TARGET libevdev)
|
|
92
|
+
target_link_libraries(libinputtino PUBLIC PkgConfig::LIBEVDEV)
|
|
93
|
+
endif ()
|
|
94
|
+
endif ()
|
|
95
|
+
|
|
96
|
+
find_program(CCACHE_FOUND ccache)
|
|
97
|
+
if (CCACHE_FOUND)
|
|
98
|
+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
99
|
+
endif (CCACHE_FOUND)
|
|
100
|
+
|
|
101
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
102
|
+
# Sources
|
|
103
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
set(PUBLIC_HEADERS
|
|
106
|
+
include/inputtino/input.hpp
|
|
107
|
+
include/inputtino/result.hpp
|
|
108
|
+
include/inputtino/input.h)
|
|
109
|
+
|
|
110
|
+
if (UNIX AND NOT APPLE)
|
|
111
|
+
list(APPEND SRC_LIST
|
|
112
|
+
"src/uinput/joypad_nintendo.cpp"
|
|
113
|
+
"src/uinput/joypad_xbox.cpp"
|
|
114
|
+
"src/uinput/keyboard.cpp"
|
|
115
|
+
"src/uinput/mouse.cpp"
|
|
116
|
+
"src/uinput/pentablet.cpp"
|
|
117
|
+
"src/uinput/touchscreen.cpp"
|
|
118
|
+
"src/uinput/trackpad.cpp")
|
|
119
|
+
|
|
120
|
+
if (USE_UHID)
|
|
121
|
+
message("Using uhid implementation for DualSense controller")
|
|
122
|
+
list(APPEND SRC_LIST "src/uhid/joypad_ps5.cpp")
|
|
123
|
+
target_include_directories(libinputtino PUBLIC "src/uhid/include/")
|
|
124
|
+
else ()
|
|
125
|
+
message("Using uinput implementation for DualSense controller")
|
|
126
|
+
list(APPEND SRC_LIST "src/uinput/joypad_ps.cpp")
|
|
127
|
+
endif ()
|
|
128
|
+
|
|
129
|
+
target_sources(libinputtino PRIVATE ${SRC_LIST})
|
|
130
|
+
target_include_directories(libinputtino PUBLIC "src/uinput/include")
|
|
131
|
+
endif ()
|
|
132
|
+
|
|
133
|
+
if (BUILD_C_BINDINGS)
|
|
134
|
+
file(GLOB C_SRC_FILES SRCS src/c-bindings/*.cpp)
|
|
135
|
+
target_sources(libinputtino PRIVATE
|
|
136
|
+
src/c-bindings/helpers.hpp
|
|
137
|
+
${C_SRC_FILES})
|
|
138
|
+
endif ()
|
|
139
|
+
|
|
140
|
+
# Testing only available if this is the main app
|
|
141
|
+
# Emergency override MODERN_CMAKE_BUILD_TESTING provided as well
|
|
142
|
+
if ((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MODERN_CMAKE_BUILD_TESTING)
|
|
143
|
+
AND BUILD_TESTING)
|
|
144
|
+
add_subdirectory(tests)
|
|
145
|
+
endif ()
|
|
146
|
+
|
|
147
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
148
|
+
# Install
|
|
149
|
+
#----------------------------------------------------------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
# Only do these if this is the main project, and not if it is included through add_subdirectory
|
|
152
|
+
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
|
153
|
+
# Only export explicitly defined symbols
|
|
154
|
+
set_if_undefined(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
155
|
+
set_if_undefined(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
156
|
+
|
|
157
|
+
if (LIBINPUTTINO_INSTALL AND NOT CMAKE_SKIP_INSTALL_RULES)
|
|
158
|
+
install(TARGETS libinputtino
|
|
159
|
+
EXPORT libinputtino_export
|
|
160
|
+
RUNTIME COMPONENT libinputtino
|
|
161
|
+
LIBRARY COMPONENT libinputtino
|
|
162
|
+
NAMELINK_COMPONENT libinputtino-dev
|
|
163
|
+
ARCHIVE COMPONENT libinputtino-dev
|
|
164
|
+
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
165
|
+
install(DIRECTORY include/
|
|
166
|
+
TYPE INCLUDE
|
|
167
|
+
COMPONENT libinputtino-dev)
|
|
168
|
+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/inputtino/${export_file_name}"
|
|
169
|
+
COMPONENT libinputtino-dev
|
|
170
|
+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/inputtino")
|
|
171
|
+
configure_file(
|
|
172
|
+
${CMAKE_CURRENT_SOURCE_DIR}/share/pkgconfig/libinputtino.pc.in
|
|
173
|
+
${CMAKE_CURRENT_BINARY_DIR}/libinputtino.pc
|
|
174
|
+
@ONLY
|
|
175
|
+
)
|
|
176
|
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libinputtino.pc
|
|
177
|
+
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
|
|
178
|
+
endif ()
|
|
179
|
+
endif ()
|
|
180
|
+
|
|
181
|
+
target_include_directories(libinputtino PUBLIC
|
|
182
|
+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
|
183
|
+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
|
|
184
|
+
set_target_properties(libinputtino PROPERTIES
|
|
185
|
+
VERSION ${PROJECT_VERSION}
|
|
186
|
+
PUBLIC_HEADER "${PUBLIC_HEADERS}")
|
|
187
|
+
set_target_properties(libinputtino PROPERTIES OUTPUT_NAME "libinputtino")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-2024 Games on Whales https://github.com/games-on-whales/
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# inputtino
|
|
2
|
+
|
|
3
|
+
An easy to use virtual input library for Linux built on top of `uinput`, `evdev` and `uhid`.
|
|
4
|
+
Currently in use by [Wolf](https://github.com/games-on-whales/wolf), [Sunshine](https://github.com/LizardByte/Sunshine) and [Moonshine](https://github.com/hgaiser/moonshine)
|
|
5
|
+
|
|
6
|
+
Supports:
|
|
7
|
+
|
|
8
|
+
- Keyboard
|
|
9
|
+
- Mouse
|
|
10
|
+
- Touchscreen
|
|
11
|
+
- Trackpad
|
|
12
|
+
- Pen tablet
|
|
13
|
+
- Joypad
|
|
14
|
+
- Correctly emulates Xbox, PS5 or Nintendo joypads
|
|
15
|
+
- Supports callbacks on Rumble events
|
|
16
|
+
- Gyro, Acceleration, Touchpad, Adaptive triggers, LED and battery status fully supported when creating a virtual DualSense joypad (with full support without Steam Input for games that are compatible with DualSense)
|
|
17
|
+
|
|
18
|
+
Interested in how the joypad works under the hood? Checkout these blog posts:
|
|
19
|
+
- [When uinput Isn’t Enough: Virtualizing a DualSense controller](https://abeltra.me/blog/inputtino-uhid-1/)
|
|
20
|
+
- [Creating a Virtual DualSense Controller via UHID](https://abeltra.me/blog/inputtino-uhid-2/)
|
|
21
|
+
- [Beyond USB: Improving Virtual Controller Support in Linux Games](https://abeltra.me/blog/inputtino-uhid-3/)
|
|
22
|
+
|
|
23
|
+
A special thanks goes to [@hgaiser](https://github.com/hgaiser) for all the help in yak shaving the DualSense implementation.
|
|
24
|
+
|
|
25
|
+
## Include in a C++ project
|
|
26
|
+
|
|
27
|
+
If using `Cmake` it's as simple as
|
|
28
|
+
|
|
29
|
+
```cmake
|
|
30
|
+
FetchContent_Declare(
|
|
31
|
+
inputtino
|
|
32
|
+
GIT_REPOSITORY https://github.com/games-on-whales/inputtino.git
|
|
33
|
+
GIT_TAG <GIT_SHA_OR_TAG>)
|
|
34
|
+
FetchContent_MakeAvailable(inputtino)
|
|
35
|
+
target_link_libraries(<your_project_name> PUBLIC inputtino::libinputtino)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Example usage
|
|
39
|
+
|
|
40
|
+
```c++
|
|
41
|
+
#include <inputtino/input.hpp>
|
|
42
|
+
|
|
43
|
+
auto joypad = Joypad::create(Joypad::PS, Joypad::RUMBLE | Joypad::ANALOG_TRIGGERS);
|
|
44
|
+
|
|
45
|
+
joypad->set_stick(Joypad::LS, 1000, 2000);
|
|
46
|
+
joypad->set_pressed_buttons(Joypad::X | Joypad::DPAD_RIGHT);
|
|
47
|
+
|
|
48
|
+
auto rumble_data = std::make_shared<std::pair<int, int>>();
|
|
49
|
+
joypad.set_on_rumble([rumble_data](int low_freq, int high_freq) {
|
|
50
|
+
rumble_data->first = low_freq;
|
|
51
|
+
rumble_data->second = high_freq;
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For more examples you can look at the unit tests under `tests/`: Joypads have been tested using `SDL2` other input
|
|
56
|
+
devices have been tested with `libinput`.
|
|
57
|
+
|
|
58
|
+
The main interface is easily accessible
|
|
59
|
+
under [include/inputtino/input.hpp](include/inputtino/input.hpp)
|
|
60
|
+
|
|
61
|
+
## Using the Python bindings
|
|
62
|
+
|
|
63
|
+
Checkout the instructions in [bindings/python/](bindings/python/); example usage:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from inputtino import Mouse, MouseButton
|
|
67
|
+
|
|
68
|
+
# Initialize mouse device
|
|
69
|
+
mouse = Mouse()
|
|
70
|
+
|
|
71
|
+
# Move mouse
|
|
72
|
+
mouse.move(100, 50) # Move right 100, down 50
|
|
73
|
+
mouse.move_abs(500, 300, 1920, 1080) # Move to absolute position
|
|
74
|
+
|
|
75
|
+
# Click operations
|
|
76
|
+
mouse.click(MouseButton.LEFT)
|
|
77
|
+
mouse.click(MouseButton.RIGHT, duration=0.5) # Hold for 0.5 seconds
|
|
78
|
+
|
|
79
|
+
# Scrolling
|
|
80
|
+
mouse.scroll_vertical(120) # Scroll up
|
|
81
|
+
mouse.scroll_horizontal(-120) # Scroll left
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Using the Rust bindings
|
|
85
|
+
|
|
86
|
+
After building and installing `inputtino` you can use the Rust bindings by adding the following to your `Cargo.toml`:
|
|
87
|
+
|
|
88
|
+
```toml
|
|
89
|
+
[dependencies]
|
|
90
|
+
inputtino = { git = "https://github.com/games-on-whales/inputtino.git", branch="stable" }
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Example usage:
|
|
94
|
+
|
|
95
|
+
```rust
|
|
96
|
+
let device = DeviceDefinition::new(
|
|
97
|
+
"Rusty Keyboard",
|
|
98
|
+
0xAB,
|
|
99
|
+
0xCD,
|
|
100
|
+
0xEF,
|
|
101
|
+
"Rusty Keyboard Phys",
|
|
102
|
+
"Rusty Keyboard Uniq",
|
|
103
|
+
);
|
|
104
|
+
let keyboard = Keyboard::new(&device).unwrap();
|
|
105
|
+
|
|
106
|
+
keyboard.press_key(0x41); // KEY_A
|
|
107
|
+
keyboard.release_key(0x41);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
See the [tests](bindings/rust/inputtino/tests) for more examples.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
FROM ubuntu:24.04
|
|
2
|
+
|
|
3
|
+
# Install uv
|
|
4
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
5
|
+
ENV UV_LINK_MODE=copy
|
|
6
|
+
# Shell completion
|
|
7
|
+
RUN echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrc
|
|
8
|
+
|
|
9
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
10
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
11
|
+
build-essential \
|
|
12
|
+
ca-certificates \
|
|
13
|
+
cmake \
|
|
14
|
+
clang-format \
|
|
15
|
+
# clang-tidy \
|
|
16
|
+
cpplint \
|
|
17
|
+
cppcheck \
|
|
18
|
+
# iwyu \
|
|
19
|
+
libevdev-dev \
|
|
20
|
+
make \
|
|
21
|
+
pkg-config \
|
|
22
|
+
git \
|
|
23
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "inputtino-python-dev",
|
|
3
|
+
"build": {
|
|
4
|
+
"context": "../../../", // The root of the repository
|
|
5
|
+
"dockerfile": "Dockerfile"
|
|
6
|
+
},
|
|
7
|
+
"privileged": true,
|
|
8
|
+
// Mount the root of the repository so that the C++ code can be built
|
|
9
|
+
"workspaceMount": "source=${localWorkspaceFolder}/../../,target=/workspace,type=bind",
|
|
10
|
+
"workspaceFolder": "/workspace/bindings/python",
|
|
11
|
+
"mounts": [
|
|
12
|
+
"source=uv-cache,target=/root/.cache/uv,type=volume",
|
|
13
|
+
"source=pip-cache,target=/root/.cache/pip,type=volume",
|
|
14
|
+
"source=pre-commit-cache,target=/root/.cache/pre-commit,type=volume"
|
|
15
|
+
],
|
|
16
|
+
"customizations": {
|
|
17
|
+
"vscode": {
|
|
18
|
+
"extensions": [
|
|
19
|
+
"ms-python.python",
|
|
20
|
+
"ms-vscode.cpptools-extension-pack"
|
|
21
|
+
],
|
|
22
|
+
"settings": {
|
|
23
|
+
"python.defaultInterpreterPath": "/workspace/.venv/bin/python"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"shutdownAction": "stopContainer"
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15)
|
|
2
|
+
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
5
|
+
|
|
6
|
+
set(PYBIND11_FINDPYTHON ON)
|
|
7
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
8
|
+
|
|
9
|
+
# add inputtino
|
|
10
|
+
get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../.." ABSOLUTE)
|
|
11
|
+
add_subdirectory(${PROJECT_ROOT} "${CMAKE_CURRENT_BINARY_DIR}/inputtino")
|
|
12
|
+
|
|
13
|
+
execute_process(
|
|
14
|
+
COMMAND pybind11-config --includes
|
|
15
|
+
OUTPUT_VARIABLE PYBIND11_INCLUDES
|
|
16
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
pybind11_add_module(_core MODULE src/main.cpp)
|
|
20
|
+
target_include_directories(_core PRIVATE ${PYBIND11_INCLUDES})
|
|
21
|
+
target_link_libraries(_core PUBLIC inputtino::libinputtino)
|
|
22
|
+
|
|
23
|
+
install(TARGETS _core DESTINATION inputtino)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
help: ## Show help
|
|
2
|
+
@grep -E '^[.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
3
|
+
|
|
4
|
+
clean: ## Clean autogenerated files
|
|
5
|
+
rm -rf dist
|
|
6
|
+
rm -rf build
|
|
7
|
+
rm -rf .venv
|
|
8
|
+
find . -type f -name "*.DS_Store" -ls -delete
|
|
9
|
+
find . | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -rf
|
|
10
|
+
find . | grep -E ".pytest_cache" | xargs rm -rf
|
|
11
|
+
find . | grep -E ".ipynb_checkpoints" | xargs rm -rf
|
|
12
|
+
find . | grep -E ".ruff_cache" | xargs rm -rf
|
|
13
|
+
rm -f .coverage
|
|
14
|
+
|
|
15
|
+
install: ## Install this project to site-packages
|
|
16
|
+
uv sync --reinstall
|
|
17
|
+
|
|
18
|
+
stubs: install ## Generate stub file.
|
|
19
|
+
uv run pybind11-stubgen inputtino._core -o src/
|
|
20
|
+
@sed -i 's/def _pybind11_conduit_v1_(\*args, \*\*kwargs):/def _pybind11_conduit_v1_(*args: typing.Any, **kwargs: typing.Any) -> typing.Any:/' src/inputtino/_core.pyi
|
|
21
|
+
|
|
22
|
+
type: ## Run type check
|
|
23
|
+
uv run pyright src
|
|
24
|
+
|
|
25
|
+
test: ## Run tests
|
|
26
|
+
uv run pytest -v --log-level INFO --cov -m "not practical"
|
|
27
|
+
|
|
28
|
+
test-full: ## Run full test
|
|
29
|
+
uv run pytest -v --cov
|
|
30
|
+
|
|
31
|
+
CPP_FILES=$(shell find src -regex '.*\.\(cpp\|hpp\|cc\|cxx\)')
|
|
32
|
+
PYTHON_FILES=$(shell find src -regex '.*\.\(py\|pyi\)')
|
|
33
|
+
PYTHON_TEST_FILES=$(shell find tests -regex '.*\.\(py\|pyi\)')
|
|
34
|
+
lint: ## Run linter
|
|
35
|
+
uv run ruff check . --fix
|
|
36
|
+
cppcheck $(CPP_FILES)
|
|
37
|
+
cpplint $(CPP_FILES)
|
|
38
|
+
|
|
39
|
+
format: ## Run formatter
|
|
40
|
+
uv run docformatter $(PYTHON_FILES) $(PYTHON_TEST_FILES) --in-place --wrap-summaries=79 --wrap-descriptions=72
|
|
41
|
+
uv run pyupgrade --py310-plus $(PYTHON_FILES) $(PYTHON_TEST_FILES)
|
|
42
|
+
uv run ruff format .
|
|
43
|
+
clang-format --style=Google -i $(CPP_FILES)
|
|
44
|
+
|
|
45
|
+
run: format lint test type ## Run all workflow.
|
|
46
|
+
|
|
47
|
+
includes: ## Shows the include directories.
|
|
48
|
+
@pybind11-config --includes | tr ' ' '\n' | grep -e '^-I' | sed 's/^-I//'
|
|
49
|
+
@echo $(PWD)/../../include
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
[](https://www.python.org/downloads/)
|
|
2
|
+
[](https://opensource.org/licenses/MIT)
|
|
3
|
+
[](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings)
|
|
4
|
+
|
|
5
|
+
# inputtino-python
|
|
6
|
+
|
|
7
|
+
Python bindings for the [inputtino](../../README.md) library, providing virtual input device control for Linux.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Mouse, keyboard, touchscreen, trackpad and pen tablet input simulation
|
|
12
|
+
- Full gamepad support (Xbox One, PS5, Nintendo Switch)
|
|
13
|
+
- Complete type hints and documentation
|
|
14
|
+
- Pythonic interface with easy-to-use API
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Python 3.10 or higher
|
|
19
|
+
- Linux system with uinput support
|
|
20
|
+
- Root privileges or appropriate permissions for `/dev/uinput` and `/dev/uhid` (for PS5Joypad)
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
1. Install system dependencies:
|
|
25
|
+
|
|
26
|
+
**Ubuntu / Debian**:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
sudo apt install git cmake build-essential pkg-config libevdev-dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Arch Linux**:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
sudo pacman -Sy git cmake base-devel pkgconf libevdev
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Fedora**:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
sudo dnf install git cmake gcc gcc-c++ make pkgconf-pkg-config libevdev-devel
|
|
42
|
+
# Optional python3-devel
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
2. Install inputtino-python:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install "git+https://github.com/games-on-whales/inputtino.git#subdirectory=bindings/python&branch=stable"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This package requires root privileges or appropriate permissions for /dev/uinput to work properly.
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
### Mouse Control
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from inputtino import Mouse, MouseButton
|
|
59
|
+
|
|
60
|
+
# Initialize mouse device
|
|
61
|
+
mouse = Mouse()
|
|
62
|
+
|
|
63
|
+
# Move mouse
|
|
64
|
+
mouse.move(100, 50) # Move right 100, down 50
|
|
65
|
+
mouse.move_abs(500, 300, 1920, 1080) # Move to absolute position
|
|
66
|
+
|
|
67
|
+
# Click operations
|
|
68
|
+
mouse.click(MouseButton.LEFT)
|
|
69
|
+
mouse.click(MouseButton.RIGHT, duration=0.5) # Hold for 0.5 seconds
|
|
70
|
+
|
|
71
|
+
# Scrolling
|
|
72
|
+
mouse.scroll_vertical(120) # Scroll up
|
|
73
|
+
mouse.scroll_horizontal(-120) # Scroll left
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Keyboard Control
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from inputtino import Keyboard, KeyCode
|
|
80
|
+
|
|
81
|
+
# Initialize keyboard device
|
|
82
|
+
keyboard = Keyboard()
|
|
83
|
+
|
|
84
|
+
# Type individual keys
|
|
85
|
+
keyboard.press(KeyCode.A)
|
|
86
|
+
keyboard.release(KeyCode.A)
|
|
87
|
+
|
|
88
|
+
# Convenient typing with auto-release
|
|
89
|
+
keyboard.type(KeyCode.ENTER)
|
|
90
|
+
keyboard.type(KeyCode.from_str("space")) # From string representation
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### PS5 Controller
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from inputtino import PS5Joypad, ControllerButton, StickPosition
|
|
97
|
+
|
|
98
|
+
# Initialize PS5 controller
|
|
99
|
+
joypad = PS5Joypad()
|
|
100
|
+
|
|
101
|
+
# Set button states
|
|
102
|
+
joypad.set_pressed_buttons(ControllerButton.X | ControllerButton.DPAD_UP)
|
|
103
|
+
|
|
104
|
+
# Move analog sticks
|
|
105
|
+
joypad.set_stick(StickPosition.LS, x=100, y=200)
|
|
106
|
+
|
|
107
|
+
# Set trigger pressure
|
|
108
|
+
joypad.set_triggers(left=32000, right=16000)
|
|
109
|
+
|
|
110
|
+
# Handle rumble feedback
|
|
111
|
+
joypad.set_on_rumble(lambda low, high: print(f"Rumble: {low}, {high}"))
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Docker Container Integration
|
|
115
|
+
|
|
116
|
+
When using inputtino-python in Docker environments, add these required configurations:
|
|
117
|
+
|
|
118
|
+
### Required Docker Settings
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
# docker-compose.yml example
|
|
122
|
+
services:
|
|
123
|
+
your-service:
|
|
124
|
+
volumes:
|
|
125
|
+
- /dev/input:/dev/input:rw # For input device access
|
|
126
|
+
- /dev/uhid:/dev/uhid # For PS5 controller support
|
|
127
|
+
devices:
|
|
128
|
+
- /dev/uinput # For virtual device creation
|
|
129
|
+
privileged: true # Required for device access
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Or when running Docker:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
docker run -it --rm \
|
|
136
|
+
-v /dev/input:/dev/input:rw \
|
|
137
|
+
-v /dev/uhid:/dev/uhid \
|
|
138
|
+
--device /dev/uinput \
|
|
139
|
+
--privileged \
|
|
140
|
+
your-image-name
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
Simply open this directory in your favorite IDE and use [devcontainers](https://code.visualstudio.com/docs/devcontainers/containers)!
|
|
146
|
+
|
|
147
|
+
Or for a more manual approach, follow these steps:
|
|
148
|
+
|
|
149
|
+
### Prerequisites
|
|
150
|
+
|
|
151
|
+
- Python 3.10 or higher
|
|
152
|
+
- Git
|
|
153
|
+
|
|
154
|
+
### Setting Up
|
|
155
|
+
|
|
156
|
+
1. If using `uv` (recommended):
|
|
157
|
+
```bash
|
|
158
|
+
git clone https://github.com/your-username/inputtino.git
|
|
159
|
+
cd inputtino/bindings/python
|
|
160
|
+
uv sync
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. If using `pip`:
|
|
164
|
+
```bash
|
|
165
|
+
git clone https://github.com/your-username/inputtino.git
|
|
166
|
+
cd inputtino/bindings/python
|
|
167
|
+
python -m venv ./venv
|
|
168
|
+
source ./venv/bin/activate
|
|
169
|
+
pip install .
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Running Tests
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
uv run pytest -v --log-level INFO --cov -m "not practical"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Coding Standards
|
|
179
|
+
|
|
180
|
+
### Python Code
|
|
181
|
+
|
|
182
|
+
- Use type hints for all function arguments and return values
|
|
183
|
+
- Prefer built-in `list` and `tuple` over `typing.List` and `typing.Tuple`
|
|
184
|
+
- All public classes and methods must have docstrings (Google Style)
|
|
185
|
+
- Follow PEP 8 guidelines
|
|
186
|
+
- Keep functions focused and single-purpose
|
|
187
|
+
- Prioritize code readability
|
|
188
|
+
|
|
189
|
+
Example docstring:
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
def function_name(param1: str, param2: list[int]) -> bool:
|
|
193
|
+
"""Short description of function.
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
param1: Description of first parameter
|
|
197
|
+
param2: Description of second parameter
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
Description of return value
|
|
201
|
+
|
|
202
|
+
Raises:
|
|
203
|
+
ValueError: Description of when this is raised
|
|
204
|
+
"""
|
|
205
|
+
pass
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### C++ Code
|
|
209
|
+
|
|
210
|
+
- Use pybind11 for Python bindings
|
|
211
|
+
- Run `make includes` to see the include directories path for your IDE setup
|
|
212
|
+
- After modifying C++ binding code, always run `make stubs` to regenerate Python stubs
|
|
213
|
+
- Follow modern C++ practices
|
|
214
|
+
- Keep binding code simple and focused on Python integration
|
|
215
|
+
- Document any platform-specific considerations
|