Frames
Low-level types for inspecting raw frame traffic: FrameType is the TYPE byte and DecodedFrame is one parsed frame.
FrameType A frame's TYPE byte
| Variant | Opcode | Meaning |
|---|---|---|
Move | 0x01 | Cursor, wheel or pan motion, tagged by axis (PC to box). |
Inject | 0x03 | Class-tagged button, key, or media override (PC to box). |
Reset | 0x04 | Clear all injection (PC to box). |
Query | 0x05 | Request a state snapshot (PC to box). |
Resp | 0x06 | Reply to a query, with the request's seq echoed (box to PC). |
RebootDl | 0x07 | Reboot a chip to download or run (PC to box). |
Log | 0x08 | Unsolicited box diagnostics (box to PC). |
Led | 0x09 | Drive a status LED (PC to box). |
Lock | 0x0A | Weigh a native input: block, pass, or amplify (PC to box). |
Catch | 0x0B | Add or remove one subscription-table entry (PC to box). |
MotionEvent | 0x0C | An unsolicited relative-axis catch event, dx/dy/dz/pan (box to PC). |
UsageEvent | 0x0F | An unsolicited held-usage snapshot: button, key, or media (box to PC). |
Option | 0x11 | Set a persistent box option by id, e.g. imperfect-clone opt-in or movement riding (PC to box). |
ClipAppend | 0x12 | Append buffered-clip entries to the box's clip ring; seq = append seq (PC to box). |
ClipCtrl | 0x13 | Drive clip playback: start, stop, pause, resume, restart, toggle, clear, finalize (PC to box). |
ClipSet | 0x14 | Set one clip setting: auto-lock, loop, retain, or ride (PC to box). |
ClipTrigger | 0x15 | Bind a native edge or a matched packet to a clip engine verb (PC to box). |
TrafficEvent | 0x16 | An unsolicited byte-oriented catch event: HID, vendor, control, emit, or bus (box to PC). |
Update | 0x17 | Stage or activate firmware on either chip (PC to box). |
UpdateResp | 0x18 | The reply to one update op (box to PC). |
Raw | 0x19 | Raw bytes on a cloned endpoint (PC to box). |
Transfer | 0x1A | One control transfer against the real device (PC to box). |
TransferResp | 0x1B | The native reply to a Transfer (box to PC). |
Rewrite | 0x1C | Add, overwrite or remove one rewrite rule (PC to box). |
Patch | 0x1D | Store, apply or clear a descriptor patch (PC to box). |
Transform | 0x1E | Add, overwrite or remove one field transform (PC to box). |
DecodedFrame One parsed frame
| Field | Type | Description |
|---|---|---|
ty | FrameType | The frame's opcode. |
seq | u8 | The sequence byte; a reply echoes the request's value. |
payload | Vec<u8> | The raw payload bytes, already CRC-checked. |
EXAMPLE
use medius::{FrameType, DecodedFrame};
// Byte -> variant is fallible; an unknown opcode is an Err.
assert_eq!(FrameType::try_from(0x06), Ok(FrameType::Resp));
assert!(FrameType::try_from(0xFF).is_err());
// Variant -> byte always works.
assert_eq!(u8::from(FrameType::Log), 0x08);
// Read a decoded frame by field: a MOTION_EVENT at ts_us=1000, host chip clock, carrying dx=5, dy=-5, dz=1, pan=0.
let frame = DecodedFrame { ty: FrameType::MotionEvent, seq: 7, payload: vec![0xE8, 3, 0, 0, 0, 5, 0, 0xFB, 0xFF, 1, 0, 0, 0] };
println!("{:?} seq={} {} bytes", frame.ty, frame.seq, frame.payload.len());The wire layout is on the frame page. Requests and Diagnostics cover everyday work.