Skip to content
Snippets Groups Projects
Commit 87e7479e authored by gm2g20's avatar gm2g20
Browse files

Upload New File

parent d6021d94
No related branches found
No related tags found
No related merge requests found
# SPDX-FileCopyrightText: 2017 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_hid`
====================================================
This driver simulates USB HID devices.
* Author(s): Scott Shawcroft, Dan Halbert
Implementation Notes
--------------------
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
"""
# imports
try:
from typing import Sequence
import usb_hid
except ImportError:
pass
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_HID.git"
def find_device(
devices: Sequence[usb_hid.Device], *, usage_page: int, usage: int
) -> usb_hid.Device:
"""Search through the provided sequence of devices to find the one with the matching
usage_page and usage."""
if hasattr(devices, "send_report"):
devices = [devices]
for device in devices:
if (
device.usage_page == usage_page
and device.usage == usage
and hasattr(device, "send_report")
):
return device
raise ValueError("Could not find matching HID device.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment