Skip to main content

Library for emulate mouse and keyboard on raspberry pi zero

Project description

HID python library for emulating mouse and keyboard on PI.

Setup

  1. Install apt dependencies
sudo apt-get update
sudo apt-get install -y git python3-pip python3-venv
  1. install usb gadget module

  2. Create virtual environment

python3 -m venv ~/venv
source ~/venv/bin/activate
  1. Install zero-hid with pip
pip3 install zero-hid
  1. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zero_hid-1.0.2.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zero_hid-1.0.2-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file zero_hid-1.0.2.tar.gz.

File metadata

  • Download URL: zero_hid-1.0.2.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for zero_hid-1.0.2.tar.gz
Algorithm Hash digest
SHA256 18929b87d111a227466c7e49d898c8076d5ae82c6d7720291996f9e5b3c199b7
MD5 d9b60b34e13338296c1eb1992f17927f
BLAKE2b-256 5b8f4b007fa4a99792b20e0435f69161a1ccd3410b00946c472f3565798a1b18

See more details on using hashes here.

File details

Details for the file zero_hid-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: zero_hid-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for zero_hid-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fcb4e205b1f1b943aa961efd1d5ee0de46ee253a2d9cd49d578d59a231866e66
MD5 92e816b4c788441891c4befa58589253
BLAKE2b-256 773be41821bdfc5eb8293581c2b5749134f33af740110c6a813ca3cce629d5c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page