base: Add find_paired_node functions

Avoid the need for hidapi imports and add them to the base API module.
This commit is contained in:
MattHag 2024-09-28 14:03:23 +02:00 committed by Peter F. Patel-Schneider
parent a7ad625023
commit 90c41dbe32
1 changed files with 14 additions and 2 deletions

View File

@ -14,8 +14,7 @@
## with this program; if not, write to the Free Software Foundation, Inc., ## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Base low-level functions used by the API proper. """Base low-level functions as API for upper layers."""
# Unlikely to be used directly unless you're expanding the API.
from __future__ import annotations from __future__ import annotations
@ -449,6 +448,19 @@ def _get_next_sw_id() -> int:
return _get_next_sw_id.software_id return _get_next_sw_id.software_id
def find_paired_node(receiver_path: str, index: int, timeout: int):
"""Find the node of a device paired with a receiver."""
return hidapi.find_paired_node(receiver_path, index, timeout)
def find_paired_node_wpid(receiver_path: str, index: int):
"""Find the node of a device paired with a receiver.
Get wpid from udev.
"""
return hidapi.find_paired_node_wpid(receiver_path, index)
# a very few requests (e.g., host switching) do not expect a reply, but use no_reply=True with extreme caution # a very few requests (e.g., host switching) do not expect a reply, but use no_reply=True with extreme caution
def request( def request(
handle, handle,