![](https://private-user-images.githubusercontent.com/61390950/329008025-13608efd-15c1-4fdd-86b5-e411e15fa638.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTY0NjEsIm5iZiI6MTczODk1NjE2MSwicGF0aCI6Ii82MTM5MDk1MC8zMjkwMDgwMjUtMTM2MDhlZmQtMTVjMS00ZmRkLTg2YjUtZTQxMWUxNWZhNjM4LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDE5MjI0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ4ZjEzM2RiNTJiOTBmNTc5ZTZkNGI3M2U5YjBlMzk3M2E0MmM2ZmRjYzQ2NzExNjJhYjU4YWJhOGZhODdjNDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.g9ulmjfMdZBQCMX8_aHJPVIKd5YbgAAAPexTZGf7C0c)
HID python library for emulating mouse and keyboard on PI.
- 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-hid
withpip
pip3 install zero-hid
- Reboot if not already!
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!')
- Relative / Absolute mouse movements
- Left / Right / Middle click
- Scrolling
- Typing
- Hot keys
- Drag and Drop
- LEDs status
- Easy to setup
- Comprehensive Testing
see examples
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 |
Absolute mouse used only for positining. use relative mouse for clicking etc. see examples.