Skip to main content

devinput

devinput is a low-level library to read, write and manage Linux input devices with async IO support.

Overview

Listing devices

devinput.list_devices()
#  -> [<Device 'Logitech Wireless Receiver Mouse' (/dev/input/event16)>, ... 

Listing all devices with a given set of capabilities

devinput.list_capable_devices(devinput.KeyEvent.KEY_A)

# -> [<Device 'AT Translated Set 2 keyboard' (/dev/input/event3)>]

Creating a device

dev = devinput.Device("/dev/input/event6")
# =
dev = devinput.Device.from_event("event6")

Querying device capabilities

Call dev.open() first (or do this inside the with block).

dev.has_cap(devinput.EventType.EV_ABS)
dev.has_cap(devinput.AbsEvent.ABS_X)

List all capabilities of a given type

dev.capabilities.list(devinput.EventType.EV_ABS)

Get all event types supported by the device

dev.capabilities.event_types

Reading events

# ...
with dev:
    event = dev.get_event()

Polling

with dev:
    dev.poll()

Returns whether an event is available immediately or within a given timeout.

with dev:
    dev.wait()

Waits until an event is available.

Sending events

with dev:
    dev.dev.send_event(devinput.Event(devinput.KeyEvent.KEY_A,1))

Grabbing

with (dev, dev.grabbed()):
    # ...

Async

Reading events

with dev:
    await dev.get_event_async()

Polling

with dev:
    await dev.poll_async()
    await dev.wait()

Sending events

with dev:
    await dev.send_event_async(devinput.Event(...))

Examples

Check out the examples on GitHub for more complex usage.

Docs

API docs

Metadata

Release files for devinput 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for devinput 0.0.1
File Size Uploaded
devinput-0.0.1.tar.gz 21.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for devinput 0.0.1
File Interpreter ABI Platform
devinput-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 44.6 kB

Release files / devinput-0.0.1.tar.gz

Download URL devinput-0.0.1.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9c58bd7d11b74c84c8d59f26d6210af4bd61cde7c5d763c40ce2272b369852f0
BLAKE2b-256 checksum
How to use checksums
ae3160ab6b7ffcec9fa15014bb778e0eb9bef1ae0d2f42768f33aac6b819208e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / devinput-0.0.1-py3-none-any.whl

Download URL devinput-0.0.1-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22fb6adcc7612b7439c9e9be7a96a2ccb4d354f1520c41bb77db2fc943085c39
BLAKE2b-256 checksum
How to use checksums
7eac916e6afc951760e1f8242646f5c47a942cd743be2de0aca2a720a52c2a07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page