HOGP inputmap reference
inputmap converts accessory HID reports into glasses actions. Prefer App recording for ordinary buttons. Use this reference when reusing configurations, distinguishing values, or handling touch/axis input. It describes the current matching App and reference firmware; actual device capabilities and import results are authoritative.
Download an editable five-button template#
This example maps Page 0x000C Usage 0x0042, 0x0043, 0x0044, 0x0045, and 0x0041 to up, down, left, right, and confirm respectively, matching the sample remote's captured format. These are not universal ring/remote encodings. Replace them using your Report Map and captured values. Omitting application / rid leaves those fields unrestricted.
{
"version": 1,
"rules": [
{
"type": "usage_key",
"page": 12,
"usage": 66,
"key": 0
},
{
"type": "usage_key",
"page": 12,
"usage": 67,
"key": 1
},
{
"type": "usage_key",
"page": 12,
"usage": 68,
"key": 2
},
{
"type": "usage_key",
"page": 12,
"usage": 69,
"key": 3
},
{
"type": "usage_key",
"page": 12,
"usage": 65,
"key": 4
}
]
}Match HID input on the left; choose glasses output on the right#
| Fields | Meaning and values |
|---|---|
| version / rules | The current protocol version is 1. rules contains the complete rule array; each submission replaces the entire table. JSON supports neither comments nor bare 0x numbers. Decimal integers are recommended. |
| type | Use one of the six rule names below with exact case. For example, abs_axis_to_key cannot be abbreviated to abs_axis. |
| page / usage | HID Usage Page and Usage, range 0…65535, from the Report Map or actual captures. These are not glasses action IDs. |
| application | Optional HID Application Collection identifier, usually (Usage Page << 16) | Usage. This is not the plugin ID. Use the actual captured value; omission or 0 means no restriction. |
| rid | Optional Report ID, range 0…255. Use the actual report value. Omission or 0 means unrestricted. Do not copy another device's r value blindly. |
| key / positive / negative / map | Output uses this page's ring_key IDs. They differ from HID usage values and GMP GM_PLUGIN_BUTTON_* numbers. |
Six rule types: choose based on actual reports#
Each block below is a complete single-rule file. Input values illustrate structure and must be replaced with real device data. Combine rules in one rules array and import once; importing separate files successively replaces previous tables.
value_match: map distinct action values to confirm and double click
{
"version": 1,
"rules": [{
"type": "value_match", "page": 65280, "usage": 1,
"values": [{"value": 1, "key": 4}, {"value": 2, "key": 58}]
}]
}rel_axis: positive and negative wheel increments
{
"version": 1,
"rules": [{
"type": "rel_axis", "page": 1, "usage": 56,
"positive": 56, "negative": 57
}]
}abs_axis_to_key: left/right X-axis movement
{
"version": 1,
"rules": [{
"type": "abs_axis_to_key", "page": 1, "usage": 48,
"deadzone": 300, "threshold": 500,
"positive": 3, "negative": 2
}]
}abs_region: divide the touch X-axis range 0…999 into three regions
{
"version": 1,
"rules": [{
"type": "abs_region", "axis": "x",
"tip": {"page": 13, "usage": 66},
"x": {"page": 1, "usage": 48},
"y": {"page": 1, "usage": 49},
"regions": [
{"min": 0, "max": 332, "key": 2},
{"min": 333, "max": 665, "key": 4},
{"min": 666, "max": 999, "key": 3}
]
}]
}touch_gesture: tap and four-direction swipes
{
"version": 1,
"rules": [{
"type": "touch_gesture",
"tip": {"page": 13, "usage": 66},
"x": {"page": 1, "usage": 48},
"y": {"page": 1, "usage": 49},
"map": {
"tap": 4, "swipe_up": 0, "swipe_down": 1,
"swipe_left": 2, "swipe_right": 3
}
}]
}| type | Suitable input | Configuration notes |
|---|---|---|
| usage_key | Ordinary physical buttons with a distinct Usage per action | page, usage, and key, optionally application and rid. Start with App recording. |
| value_match | One Usage reports different integer values for different actions | List value / key entries in values. Do not duplicate one Usage as several ordinary buttons. At most 6 values per rule. |
| rel_axis | Wheel or relative-motion increments | Set positive / negative outputs according to the report's actual polarity. Specify at least one direction. |
| abs_axis_to_key | Self-centering absolute axes such as joysticks | Specify deadzone, threshold, and positive / negative. Current App import requires both thresholds explicitly. |
| abs_region | Stable coordinate regions on a touch panel | Specify axis, tip, x, y, and regions. The current App requires tip/x/y even for x-only regions. At most 6 nonoverlapping closed intervals per rule. |
| touch_gesture | Tap, swipe, or scroll trajectories within one contact | Specify tip, x, y, and map. Input must include contact, coordinate changes, and lift. One coordinate sample cannot identify a gesture. |
Output IDs available for selection and import in the current App#
| ID | Name | Purpose |
|---|---|---|
| 0 / 1 / 2 / 3 | UP / DOWN / LEFT / RIGHT | Navigation directions. |
| 4 | SELECT | Confirm; ordinary press/release lets the glasses distinguish short and long presses. |
| 5 / 6 / 7 | BACK / HOME / MENU | Back, home, and menu; behavior depends on the current UI. |
| 8 / 9 / 10 | NEXT / PREV / PLAY_PAUSE | Next, previous, and play/pause; handled by corresponding system functions. |
| 11 / 12 / 13 | VOL_UP / VOL_DOWN / MUTE | Volume and mute; visible effects depend on product state. |
| 54 / 55 | PAGE_UP / PAGE_DOWN | Turn the page. |
| 56 / 57 | SCROLL_UP / SCROLL_DOWN | Scroll. |
| 58 | DOUBLE | Dispatch an action already distinguished by the device as a double click. |
| 65535 | Unset / no-output placeholder | Behavior depends on the rule. Axis, value, and gesture output slots may dispatch nothing. usage_key skips the entry and continues default matching, so this cannot block a button. |
Short press, long press, double-click and Ignore#
- Map an ordinary confirm button to SELECT(4), with stable press and release reports. The glasses distinguish short and long presses by duration, not report repetition count. The foreground application determines final behavior.
- DOUBLE(58) represents a double-click action already distinguished by the device, using a separate Usage or a different value under one Usage. This mapping does not automatically combine two identical short-press reports into a double click.
- The “Ignore” dropdown omits the ordinary recorded rule; uncovered input may still match firmware defaults. usage_key with key 65535 also skips the entry rather than forcibly disabling input. Advanced-rule output slots set to 65535 dispatch no action for that slot. Verify the specific rule on the target device.
- Explicitly list desired axis and gesture outputs instead of depending on version-specific defaults. scroll_up / scroll_down support touch_gesture scrolling. Choose either regions or trajectories for the same input.
Capacity, validation and saving#
The App queries glasses capabilities on page entry; limits may vary by release. Save the results and matching version information during initial integration. Valid JSON is deliverable only after App validation, glasses confirmation, and physical-device testing.
The complete mapping table is validated, replaced, and saved with the bound device. Unpairing clears it. Use the App's “Clear mapping” to restore defaults; file import currently rejects an empty rules array.
| Item | Current reference-implementation limits |
|---|---|
| inputmap JSON | Version 1; the entire UTF-8 table is limited to 8192 bytes. The App validates against queried glasses capabilities and handles transfer chunking. Users need not split files manually. |
| usage_key | 16 rules. |
| value_match | 4 rules, each with at most 6 values. |
| rel_axis / abs_axis_to_key | 4 rules each. |
| abs_region / touch_gesture | 2 rules each; at most 6 regions per abs_region rule. |
| HID descriptor parsing budget | Report Map: at most 512 bytes, 8 Report characteristics, 40 parsed fields, and 16 Usages per field. These are reference-firmware resource limits, not HOGP standard limits. |
How mapped values reach a GMP plugin#
After the glasses decode and map accessory reports, the Host converts supported system buttons into GM_PLUGIN_EVENT_BUTTON. Read event->data.button.button and action in your existing on_event callback. Input adaptation occurs on the glasses; the plugin does not receive or parse inputmap JSON.
| inputmap output | GMP button | GMP action |
|---|---|---|
| UP(0) / DOWN(1) / LEFT(2) / RIGHT(3) | GM_PLUGIN_BUTTON_UP(2) / DOWN(3) / LEFT(4) / RIGHT(5) | GM_PLUGIN_BUTTON_ACTION_TRIGGER(6). Holding may repeat; handle as navigation steps. |
| SELECT(4) | GM_PLUGIN_BUTTON_PRIMARY(1) | Produces SINGLE / LONG and related actions from actual hold duration; handle RELEASE through the corresponding flow. |
| DOUBLE(58) | GM_PLUGIN_BUTTON_PRIMARY(1) | GM_PLUGIN_BUTTON_ACTION_DOUBLE。 |
| PAGE_UP(54) / PAGE_DOWN(55) | GM_PLUGIN_BUTTON_PAGE_UP(6) / PAGE_DOWN(7) | TRIGGER。 |
| SCROLL_UP(56) / SCROLL_DOWN(57) | GM_PLUGIN_BUTTON_SCROLL_UP(8) / SCROLL_DOWN(9) | TRIGGER。 |
| BACK(5) / HOME(6) | GM_PLUGIN_BUTTON_BACK(10) / HOME(11) | TRIGGER; also verify behavior with the plugin Host and current UI. |
| MENU, Media and Volume Keys, etc. | The current GMP button bridge does not expose a corresponding button for each of these | Not every dropdown action becomes a GMP event; some are handled by system features. |
Final checks before delivery#
- Confirm JSON inputs come from the current accessory firmware's actual Report Map/reports. Document the physical button or gesture for each rule; do not reuse another model's values blindly.
- Wear the glasses, import in the App, and wait for success. Test trigger, release, and retrigger for every rule. With multiple Reports, verify that inputs do not activate the wrong buttons.
- Test both the target system UI and GMP plugin. An available button event does not mean every foreground application supports the action.
- Verify reconnection and reboot recovery. Keep validated JSON and version information. Retest after descriptor or action-encoding changes; updating the product description alone is insufficient.