Skip to main content

Python client for the MagicHID transparent USB-HID bridge

Project description

magichid

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for magichid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bc216d42bcea2530377728524c1e300e6f444dae0b75db4bb8cd2191f57f8ae7
MD5 f45350542b7c216904ce76a3fe5c6bf7
BLAKE2b-256 80be833c65a34962620fc4ddf58ab2a52271934c9dfb1b193996f76b94259d36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: magichid-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0881d3a9630dcfe8da69722cc5ab913ad7038e38d0d00d03cc03325a28f73c59
MD5 6cab2d21d3971af05ce2386355f2bfec
BLAKE2b-256 4687c2ec4488945a684c09df365901fd5128e9298e758aafaf3ea50fbbfa8c5e

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