Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thewh1teagle/zero-hid
Raspberry pi virtual HID mouse and keyboard
https://github.com/thewh1teagle/zero-hid
hid mouse python raspberry-pi usb
Last synced: 1 day ago
JSON representation
Raspberry pi virtual HID mouse and keyboard
- Host: GitHub
- URL: https://github.com/thewh1teagle/zero-hid
- Owner: thewh1teagle
- License: lgpl-3.0
- Created: 2021-10-27T19:44:37.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-27T00:02:21.000Z (25 days ago)
- Last Synced: 2025-01-12T01:06:21.051Z (8 days ago)
- Topics: hid, mouse, python, raspberry-pi, usb
- Language: Python
- Homepage: https://pypi.org/project/zero-hid
- Size: 126 KB
- Stars: 99
- Watchers: 2
- Forks: 23
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
HID python library for emulating mouse and keyboard on PI.
## Setup
1. Install apt dependencies
```console
sudo apt-get update
sudo apt-get install -y git python3-pip python3-venv
```2. install [usb gadget module](https://github.com/thewh1teagle/zero-hid/tree/main/usb_gadget#usb-gadget-module-configuration-for-zero-hid)
3. Create virtual environment
```console
python3 -m venv ~/venv
source ~/venv/bin/activate
```4. Install `zero-hid` with `pip`
```console
pip3 install zero-hid
```
5. 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
```python
from zero_hid import Mouse
m = Mouse()
for i in range(5):
m.move(10, 10)
```
- Control keyboard
```python
from zero_hid import Keyboardk = 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](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.