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.1.1.tar.gz (90.7 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.1.1-py3-none-any.whl (79.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for magichid-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2bcadfb1a7d4d5b95dd64c6a5d416a77e33e874e1ea5e94e3257364ea917c421
MD5 6864b20d09e5c1298b1d96d55acf3e0d
BLAKE2b-256 ef3156a1159aa23bd1e6cdf261336f141ebcdc835d57de1947ebd620fc5b5726

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for magichid-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8972b6db94962abb939b63953dd14180f3f96c166c88081962689c091bf08727
MD5 c34d22d01c083d4faa1695b53629f3e9
BLAKE2b-256 1c06da6253480ac8d547d3c9239fa1844f758224babd9f7df8373bfe63dea01e

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