HID python library for emulating mouse and keyboard on PI.
Setup
- Install apt dependencies
sudo apt-get update
sudo apt-get install -y git python3-pip python3-venv
-
install usb gadget module
-
Create virtual environment
python3 -m venv ~/venv
source ~/venv/bin/activate
- Install
zero-hidwithpip
pip3 install zero-hid
- Reboot if not already!
Usage
Note: You should connect the data usb port (left one) to the raspberry, and NOT the power port
- Control mouse
from zero_hid import Mouse
m = Mouse()
for i in range(5):
m.move(10, 10)
- Control keyboard
from zero_hid import Keyboard
k = Keyboard()
k.type('Hello world!')
Features
- Relative / Absolute mouse movements
- Left / Right / Middle click
- Scrolling
- Typing
- Hot keys
- Drag and Drop
- LEDs status
- Easy to setup
- Comprehensive Testing
Examples
see examples
Tests
| Raspberry Pi Model | Raspbian Version | Kernel Version | Date of Testing |
|---|---|---|---|
| Raspberry Pi 4 | Raspbian 12 (bookworm) | 6.6.31 | 04/08/2024 |
| Raspberry Pi 4 | Raspbian 12 | 6.1 | 01/01/2023 |
| Raspberry Pi Zero | Raspbian 5.10 | - | 01/01/2023 |
Gotchas
Absolute mouse used only for positioning - use relative mouse for clicking, etc. See examples.
Metadata
Release files for zero-hid 1.0.2
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 |
|---|---|---|---|---|
| zero_hid-1.0.2.tar.gz | 28.5 kB | Without provenance | Details for zero_hid-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zero_hid-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for zero_hid-1.0.2-py3-none-any.whl |
Total release size: 64.7 kB
Release files / zero_hid-1.0.2.tar.gz
| Download URL | zero_hid-1.0.2.tar.gz |
|---|---|
| Size | 28.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18929b87d111a227466c7e49d898c8076d5ae82c6d7720291996f9e5b3c199b7
|
|
BLAKE2b-256 checksum How to use checksums |
5b8f4b007fa4a99792b20e0435f69161a1ccd3410b00946c472f3565798a1b18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / zero_hid-1.0.2-py3-none-any.whl
| Download URL | zero_hid-1.0.2-py3-none-any.whl |
|---|---|
| Size | 36.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fcb4e205b1f1b943aa961efd1d5ee0de46ee253a2d9cd49d578d59a231866e66
|
|
BLAKE2b-256 checksum How to use checksums |
773be41821bdfc5eb8293581c2b5749134f33af740110c6a813ca3cce629d5c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Security for zero-hid 1.0.2
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.