Skip to main content

Python client for the MagicHID transparent USB-HID bridge

Project description

MagicHID-py

Python client for the MagicHID.

Install

pip install magichid

Quickstart -- high-level API

from core.io.blocking import BlockingClient
from core.reports import ReportTable
from hid import Keyboard, Keycode, Mouse, MouseButton, Digitizer

with BlockingClient("COM5") as c:
    c.handshake()

    # Keyboard
    kb = Keyboard(c, ReportTable.universal())
    kb.tap(Keycode.A)
    kb.type_text("Hello world")

    # Mouse
    mouse = Mouse(c, ReportTable.universal())
    mouse.move(x=10, y=-5)
    mouse.click(MouseButton.LEFT)

    # Touch digitizer
    dig = Digitizer(c, ReportTable.universal())
    dig.down(x=0.5, y=0.5)
    dig.move(x=0.6, y=0.5)
    dig.up()

35 device classes in hid.universal: keyboard, mouse, gamepad, flight sim, VR headset, golf club, consumer control, digitizer, haptics, force feedback, unicode input, eye tracker, accelerometer, medical ultrasound, braille display, lamp array, monitor, UPS, battery, barcode scanner, scale, MSR, camera, arcade I/O, gaming device, FIDO authenticator, and more.

Horipad (Nintendo Switch, profile 1) in hid.horipad.

Quickstart -- CLI

magichid --port COM5 keyboard type --text "Hello world"
magichid --port COM5 mouse move --x 10 --y -5 --json
magichid --port COM5 digitizer down --x 0.5 --y 0.5
magichid --port COM5 unicode type --text "Hello (U+1F389)"
magichid --port COM5 horipad press --button A --json
magichid --port COM5 soc firmware-chunk --firmware-id 1 --offset 0 --payload-file chunk.bin

# Agent introspection
magichid agent-context | jq .commands.mouse.actions

The CLI is non-interactive by default. --json emits structured stdout. Errors go to stderr with enumerated valid values. agent-context provides a versioned machine-readable schema.

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

magichid-0.2.1.tar.gz (95.9 kB view details)

Uploaded Source

Built Distribution

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

magichid-0.2.1-py3-none-any.whl (82.5 kB view details)

Uploaded Python 3

File details

Details for the file magichid-0.2.1.tar.gz.

File metadata

  • Download URL: magichid-0.2.1.tar.gz
  • Upload date:
  • Size: 95.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for magichid-0.2.1.tar.gz
Algorithm Hash digest
SHA256 639d57de56dfc1a37bab3925bed6cadc69229cb69baa62444321fb4455b74e5a
MD5 25fc780dfc6001c58229ba41d8b6e50f
BLAKE2b-256 612ae6b0d1996b6677a054d24f7fd1256eac1eba1a45fc8c814c9c6cf3f18b43

See more details on using hashes here.

File details

Details for the file magichid-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: magichid-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 82.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for magichid-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d63bd2c6fdd27da52430f3f315e5111160e35440b2b72e971be6a5ea3046730
MD5 02d60e54bb2f669a7340f20ec6aecf8f
BLAKE2b-256 71cf1e1efe9443e3627d03909539030c9f5457d0d0ccfc4970623b035bbed75a

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