aio-usb-hotplug
aio-usb-hotplug is a Python library that provides asynchronous generators
yielding detected hotplug events on the USB buses.
Requires Python >= 3.10.
Installation
Use the package manager pip to install
aio-usb-hotplug.
pip install aio-usb-hotplug
aio-usb-hotplug depends on PyUSB, which
in turn requires libusb or
openusb. An easy way to satisfy
this requirement is to install
libusb-package, which supplies
pre-compiled binaries for most platforms:
pip install libusb-package
aio-usb-hotplug will make use of
libusb-package if it is installed in
the current Python environment.
Usage
Dump all hotplug events related to a specific USB device
from aio_usb_hotplug import HotplugDetector
from trio import run # ...or asyncio
async def dump_events():
detector = HotplugDetector.for_device(vid="1050", pid="0407")
async for event in detector.events():
print(repr(event))
trio.run(dump_events)
Run an async task for each USB device matching a VID/PID pair
from aio_usb_hotplug import HotplugDetector
from trio import sleep_forever
async def handle_device(device):
print("Handling device:", repr(device))
try:
# Do something meaningful with the device. The task gets cancelled
# when the device is unplugged.
await sleep_forever()
finally:
# Device unplugged or an exception happened
print("Stopped handling device:", repr(device))
async def handle_detected_devices():
detector = HotplugDetector.for_device(vid="1050", pid="0407")
await detector.run_for_each_device(handle_device)
trio.run(handle_detected_devices)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Metadata
Release files for aio-usb-hotplug 8.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aio_usb_hotplug-8.0.0.tar.gz | 8.1 kB | Without provenance | Details for aio_usb_hotplug-8.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aio_usb_hotplug-8.0.0-py3-none-any.whl | Python 3 | none | any | Details for aio_usb_hotplug-8.0.0-py3-none-any.whl |
Total release size: 20.1 kB
Release files / aio_usb_hotplug-8.0.0.tar.gz
| Download URL | aio_usb_hotplug-8.0.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6dc22e816557d1d8ac053da28b17368410c391d7dd35ec0e2f1889fd3e4a01a
|
|
BLAKE2b-256 checksum How to use checksums |
d75e0ddb9c673ff9a34023c012df82c7b4d116bc63cd13df947280e6c92e1b27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / aio_usb_hotplug-8.0.0-py3-none-any.whl
| Download URL | aio_usb_hotplug-8.0.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a341fa08309863a562450d3302141bd34cd07398efa25eb4ac4a65d4d9197f33
|
|
BLAKE2b-256 checksum How to use checksums |
519de773bf985433db57cf1aaf5df06712581a6ce46e83539373cd6e093b2437
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for aio-usb-hotplug 8.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.