Created
April 18, 2026 16:21
-
-
Save EndlessEden/a4297ebe11670658360191bf9455a173 to your computer and use it in GitHub Desktop.
PKGBUILD patch to make monado search $XRT_DATA_DIR for Mercury Hand Tracking ONNX files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 5c5 | |
| < pkgver=25.0.0.r227.g0d513229f | |
| --- | |
| > pkgver=25.1.0.r412.gc32301dd1 | |
| 37a38,56 | |
| > msg2 "Patching Mercury hand tracking to respect XRT_DATA_DIR..." | |
| > | |
| > # 1. Inject the path resolution helper function at the very top of the file | |
| > sed -i '1i \ | |
| > #include <cstdlib>\n\ | |
| > #include <string>\n\ | |
| > static std::string get_mercury_model_path(const char* filename) {\n\ | |
| > const char* data_dir = std::getenv("XRT_DATA_DIR");\n\ | |
| > if (data_dir) {\n\ | |
| > /* Look in the data dir first. Assuming files are directly inside it based on your install script. */\n\ | |
| > return std::string(data_dir) + "/" + filename;\n\ | |
| > }\n\ | |
| > /* Fallback to current working directory */\n\ | |
| > return std::string(filename);\n\ | |
| > }' src/xrt/tracking/hand/mercury/hg_model.cpp | |
| > | |
| > # 2. Replace the hardcoded string literals with the function call | |
| > sed -i 's|"grayscale_detection_160x160.onnx"|get_mercury_model_path("grayscale_detection_160x160.onnx").c_str()|g' src/xrt/tracking/hand/mercury/hg_model.cpp | |
| > sed -i 's|"grayscale_keypoint_jan18.onnx"|get_mercury_model_path("grayscale_keypoint_jan18.onnx").c_str()|g' src/xrt/tracking/hand/mercury/hg_model.cpp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment