API Documentation¶
Device classes¶
-
class
uhid.
UHIDDevice
(vid, pid, name, report_descriptor, *, bus=<Bus.USB: 3>, physical_name=None, unique_name=None, version=0, country=0, backend=<class 'uhid.PolledBlockingUHID'>) UHID device
-
destroy
() - Return type
-
dispatch
(stop=None) - Return type
-
initialize
() Initializes the device
Subclasses can overwrite this method. There are several use cases for that, eg. delay initialization, custom initialization, etc.
- Return type
-
send_input
(data) - Return type
-
single_dispatch
() - Return type
-
wait_for_start
(delay=0.05) - Return type
-
await
wait_for_start_asyncio
(delay=0.05) - Return type
-
-
class
uhid.
AsyncUHIDDevice
(backend, vid, pid, name, report_descriptor, bus=<Bus.USB: 3>, physical_name=None, unique_name=None, version=0, country=0) UHID device with an async API
-
await
destroy
() - Return type
-
await
dispatch
() - Return type
-
await
initialize
() Initializes the device
Subclasses can overwrite this method. There are several use cases for that, eg. delay initialization, custom initialization, etc.
- Return type
-
classmethod await
new
(vid, pid, name, report_descriptor, *, bus=<Bus.USB: 3>, physical_name=None, unique_name=None, version=0, country=0, backend) - Return type
AsyncUHIDDevice
-
await
send_input
(data) - Return type
-
await
single_dispatch
() - Return type
-
await
wait_for_start
(delay=0.05) - Return type
-
await
IO backends¶
-
class
uhid.
PolledBlockingUHID
Blocking IO UHID implementation using epoll
-
dispatch
(stop=None) - Return type
-
single_dispatch
() - Return type
-
-
class
uhid.
AsyncioBlockingUHID
(loop=None) Blocking IO UHID implementation using AsyncIO readers and writers
AsyncIO will watch the UHID file descriptor and schedule read and write tasks when it is ready for those operations.