<!-- Source: https://medius.k4tech.net/native/commands/admin -->
# Admin

_Reset, reboot, and logs_

Three [frames](/native/frame.md) that manage the box rather than inject input: [`RESET`](/native/commands/admin.md#reset), [`REBOOT`](/native/commands/admin.md#reboot), and [`LOG`](/native/commands/admin.md#log).

## RESET

_Back to pure passthrough_

`RESET` drops all injection and returns the box to plain passthrough. [Opcode](/native/frame.md#opcodes) `0x04`.

```text
RESET 0x04 · payload 0 bytes
```

_Fire-and-forget_

#### PAYLOAD

No payload (`LEN` is `0`).

#### EFFECT

Zeroes the accumulators (`accX`, `accY`, `accWheel`) and sets every [`INJECT`](/native/commands/inject.md) override back to none, so injected-held buttons and keys release and the real device passes through. The report is then byte-identical to passthrough; sending it twice is a no-op. This is what the [safety auto-clear](/native/injection.md#safety) performs. Library binding: [`reset`](/library/admin.md#reset).

#### EXAMPLE

A bare `RESET`:

```
+--------+--------+--------+--------+--------+
| A5     | 04     | 00     | 00 00  | lo hi  |
+--------+--------+--------+--------+--------+
| SOF    | TYPE   | SEQ    | LEN    | CRC16  |
+--------+--------+--------+--------+--------+
```

## REBOOT

_Restart a chip_

`REBOOT` restarts one of the box's two chips, mainly to enter ROM download mode (the chip's built-in bootloader, which accepts new firmware) for flashing. [Opcode](/native/frame.md#opcodes) `0x07`.

```text
REBOOT 0x07 · payload 1 byte
```

_Fire-and-forget_

#### PAYLOAD

| Offset | Field | Type | Notes |
| --- | --- | --- | --- |
| 0 | `target` | `u8` | which chip and mode (see below) |

#### TARGETS

| Target | Value | Effect |
| --- | --- | --- |
| device download | `0` | Device chip enters ROM download, then flash over the [CH343 link](/native/transport.md). |
| host download | `1` | Device relays a download reboot to the host chip; the host flashes over its own USB. |
| device run | `2` | Device chip reboots to run firmware. |
| host run | `3` | Device relays a run reboot to the host chip. |

#### EFFECT

Reboot-to-run (`2` or `3`) is the only software cold-reboot on this board; DTR/RTS auto-reset is not wired. No reply: the chip is rebooting. See [Flashing](/native/flashing.md). Library binding: [`reboot`](/library/admin.md#reboot).

#### EXAMPLE

`target = 2` (device chip to run):

```
+--------+--------+--------+--------+--------+--------+
| A5     | 07     | 00     | 01 00  | 02     | lo hi  |
+--------+--------+--------+--------+--------+--------+
| SOF    | TYPE   | SEQ    | LEN    | target | CRC16  |
+--------+--------+--------+--------+--------+--------+
```

## LOG

_Device diagnostics_

`LOG` is diagnostic text the box sends on its own, in place of an ASCII console. [Opcode](/native/frame.md#opcodes) `0x08`.

```text
LOG 0x08 · box → PC
```

_Unsolicited_

#### PAYLOAD

| Offset | Field | Type | Notes |
| --- | --- | --- | --- |
| 0 | `level` | `u8` | severity (see below) |
| 1.. | `text` | `UTF-8` | the log line, not NUL-terminated, length = `LEN - 1` |

#### LEVELS

| Value | Level |
| --- | --- |
| `0` | error |
| `1` | warn |
| `2` | info |
| `3` | debug |
| `4` | verbose |

#### EFFECT

Emitted only while a control PC is attached; logging before first contact is dropped. The box's other outbound frame is [`RESP`](/native/commands/requests.md#resp). Library binding: [`logs`](/library/diagnostics.md#logs).

#### EXAMPLE

`level = 2` (info), text `hi` (`68 69`):

```
+--------+--------+--------+--------+--------+--------+--------+
| A5     | 08     | 00     | 03 00  | 02     | 68 69  | lo hi  |
+--------+--------+--------+--------+--------+--------+--------+
| SOF    | TYPE   | SEQ    | LEN    | level  | text   | CRC16  |
+--------+--------+--------+--------+--------+--------+--------+
```
