Another async libusb wrapper.
Project description
asyncusb
The goal of this library is to be an efficient and pythonic asynchronous usb library written in pure python.
Here's an example that sends some data to a predetermined device endpoint.
import asyncio
from asyncusb.core import *
async def main():
with Context() as ctx:
devices = ctx.get_device_list()
# Inspect device attributes and choose a device. We'll just take the
# first device for the purposes of this example.
dev = devices[0]
async with dev.open() as handle:
# Handle kernel drivers automatically.
handle.set_auto_detach_kernel_driver(True)
# Claim the interface for the duration of this with block. This
# example assumes we're using interface 1.
with handle.bind_interface(1):
# Create and submit the transfer. This example assumes
# we're just sending some data to endpoint 0x02.
transfer = handle.fill_bulk_transfer(0x02, b'hello world!')
transfer.submit()
# Wait for transfer completion. If we don't, the dev.open()
# context manager might cancel our transfer before it
# finishes!
await transfer.wait()
asyncio.run(main())
That's it! No manual resouce cleanup is required, as all cleanup is handled by the context managers.
Current Features:
- async event handling
- thread-safe transfer creation and submission
- automated resource handling
- Termux compatibility
Planned Features:
- async endpoint read/write streams
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncusb-0.0.1.tar.gz.
File metadata
- Download URL: asyncusb-0.0.1.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32c376b37cda69bb32d2d8729cd0a9ee9291dbfd1c1f1fc2debda3f01b7a905a
|
|
| MD5 |
d8ade012537202f108e7f564f7d41349
|
|
| BLAKE2b-256 |
56dd48d0f7f6f5e91c8b872403b41624997f96d3216759404f5bc17b8df715dc
|
Provenance
The following attestation bundles were made for asyncusb-0.0.1.tar.gz:
Publisher:
publish-to-pypi.yml on JacobTDC/asyncusb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asyncusb-0.0.1.tar.gz -
Subject digest:
32c376b37cda69bb32d2d8729cd0a9ee9291dbfd1c1f1fc2debda3f01b7a905a - Sigstore transparency entry: 799070467
- Sigstore integration time:
-
Permalink:
JacobTDC/asyncusb@4c85b875ce7fec43ddb63815e957aaf27685655b -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/JacobTDC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4c85b875ce7fec43ddb63815e957aaf27685655b -
Trigger Event:
release
-
Statement type:
File details
Details for the file asyncusb-0.0.1-py3-none-any.whl.
File metadata
- Download URL: asyncusb-0.0.1-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f494882975864d619dabe89dcc9c1f30e73be47a89fcb57cf49423df65fc42e
|
|
| MD5 |
df7ef3c5cf42c7c59a8c63fd188b7fb9
|
|
| BLAKE2b-256 |
f0cda77d2ba8f35c2f12606b4e09e7d4f7c76c293cd57f61e6882122b65f9562
|
Provenance
The following attestation bundles were made for asyncusb-0.0.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on JacobTDC/asyncusb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asyncusb-0.0.1-py3-none-any.whl -
Subject digest:
1f494882975864d619dabe89dcc9c1f30e73be47a89fcb57cf49423df65fc42e - Sigstore transparency entry: 799070470
- Sigstore integration time:
-
Permalink:
JacobTDC/asyncusb@4c85b875ce7fec43ddb63815e957aaf27685655b -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/JacobTDC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4c85b875ce7fec43ddb63815e957aaf27685655b -
Trigger Event:
release
-
Statement type: