Have you considered using Bluetooth directly from the Pi5 to the PC? A search will reveal various methods and code examples for doing this, but one option is too use my Bluetooth library. The sample files include separate keyboard and mouse HID codes, and the mouse reads keyboard arrow keys rather than the Pi's real mouse. It needs some extra work but they can be combined and the real mouse can be used as an input. The details of how to do these modifications can be found in a couple of entries in the Issues section of the github repository as listed in the code section below:
https://github.com/petzval/btferret
https://github.com/petzval/btferret
Code:
DOWNLOAD keyboard.c keyboard.txt mouse.c mouse.txt btlib.c btlib.h devices.txt COMPILE gcc keyboard.c btlib.c -o keyboard gcc mouse.c btlib.c -o mouse RUN sudo ./keyboard sudo ./mouse COMBINE KEYBOARD AND MOUSE AND USE PI MOUSE - See Issues:Issue #58 Using real mouse in mouse.pyIssue #53 How to combine mouse and keyboard Statistics: Posted by petzval — Fri Feb 21, 2025 12:58 pm