device_key
Send a keycode to a device. Accepts numeric keycode OR named key (HOME, BACK, ENTER, VOLUME_UP, VOLUME_DOWN, POWER, APP_SWITCH, ESCAPE, DELETE, TAB, SEARCH, MENU). System-policy keys (APP_SWITCH/187, MENU/82, POWER/26) are always sent via shell — they require policy-level handling that the control channel cannot reach. Other keys try the control channel first and fall back to shell on error/timeout. Every route here is injected — this tool has no kernel input path. Use device_uhid_key_press instead when the target app filters or ignores injected key events and the press has to land as real kernel input.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Device serial number (UDID) | |
| keycode | Yes | Android keycode number OR name (HOME, BACK, ENTER, VOLUME_UP, VOLUME_DOWN, POWER, APP_SWITCH, ESCAPE, DELETE, TAB, SEARCH, MENU) |