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

_Reboot a chip and return to passthrough_

Box-maintenance calls: [`reboot`](/library/admin.md#reboot) restarts one of the two chips, [`reset`](/library/admin.md#reset) drops the box back to [passthrough](/native/injection.md). Both are [fire-and-forget](/native/injection.md#fire-and-forget): send one frame, no reply.

#### EXAMPLE

```rust
use medius::Device;

let device = Device::find()?;   // first box on the system, handshake done
device.reset()?;                // back to passthrough
```

[`find`](/library/connection.md#open) opens the first box; related calls [`reapply`](/library/lifecycle.md#reapply) and [`reconnect`](/library/lifecycle.md#reconnect) are on the [Lifecycle](/library/lifecycle.md) page.

## reset

_Clear all injection, return to passthrough_

```text
fn reset(&self) -> Result<()>
```

_Fire-and-forget_

#### EFFECT

| State | What reset does |
| --- | --- |
| Box accumulator | Zeroed. This is the box's running total of injected motion and scroll not yet emitted to the PC. |
| Box overrides | All released. An [override](/library/inject.md) is a per-usage decision to hold an input down or up. |
| Library held-state | Cleared. The library forgets which overrides it was holding, so a later [`reapply`](/library/lifecycle.md#reapply) or [`reconnect`](/library/lifecycle.md#reconnect) re-asserts nothing. |

Sends one [`RESET`](/native/commands/admin.md#reset) frame and clears the library's held state. Afterward the box behaves as if nothing was injected.

#### EXAMPLE

```rust
use medius::Button;

device.move_rel(40, 0)?;        // nudge the cursor 40 right
device.press(Button::Left)?;    // hold left down
device.release(Button::Left)?;  // let it back up

device.reset()?;                // drop all of the above, back to passthrough
```

## reboot

_Restart or download-mode one of the two chips_

```text
fn reboot(&self, target: RebootTarget) -> Result<()>
```

_Fire-and-forget_

[`RebootTarget`](/library/types/enums.md#reboot-target) picks the chip and whether it comes back running its firmware or in download mode; the four variants and their bytes are on [Types](/library/types/enums.md). See the native [`REBOOT`](/native/commands/admin.md#reboot) command for the wire layout.

#### EXAMPLE

```rust
use medius::RebootTarget;

device.reboot(RebootTarget::DeviceRun)?;   // restart the chip you're talking to
```

> **Warning**
>
> A `Download` variant leaves the chip in ROM download mode: it stops acting as a mouse and stops answering until reflashed or power-cycled. Don't send one unless you're about to flash.

> **Note**
>
> Rebooting the device chip drops the serial link, so the call can return `Ok` as the connection goes away. The reader thread auto-reconnects, or force it with [`reconnect`](/library/lifecycle.md#reconnect).

The [flash](/library/features/flash.md) feature issues the download reboot for you, so you rarely send a `Download` variant by hand.

## On AsyncDevice

_Still fire-and-forget, no await_

[`AsyncDevice`](/library/features/async.md) re-exposes `reset` and `reboot` unchanged: they expect no reply, so no `.await` and no [`block_on`](https://docs.rs/futures/latest/futures/executor/fn.block_on.html). Only the queries are async.

#### EXAMPLE

```rust
use medius::{AsyncDevice, RebootTarget};

let device = AsyncDevice::open("/dev/ttyACM0")?;
device.reset()?;                          // sync, no await
device.reboot(RebootTarget::HostRun)?;    // sync, no await
```
