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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for magichid-0.2.0.tar.gz
Algorithm Hash digest
SHA256 46815dd1ec03285f44f23afe6e0a30a1726ec18a813490703c1c6c4857f2cf65
MD5 828c735881f508240480c24a402ea9f3
BLAKE2b-256 ce93f4ad2f924c549fb7127fb75eaf9879aaa8a47a9a2821fde6aaaa046ab766

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for magichid-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ae693a0b4f1fd620d0ad56d397d3a185b33360c57ce27f9a2aa970bcb92e77e
MD5 9c033366114296fffbd735a1d549d6cc
BLAKE2b-256 c93186e5c605f8d90bb9db392a103bc29e7f29ba5953a0401951aa3b7471a4eb

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