<!-- Source: https://medius.k4tech.net/comparison/recovery -->
# Recovery

What each box does when a program closes its port, the real device is replugged, or the PC restarts or sleeps.

## Program exit

A program pressed the left button through each box, then closed the port without releasing it.

#### Left button 3 s after the program exits

Stock `km.left`Medius `INJECT`

| Case | Stock`km.left` | Medius`INJECT` | Result |
| --- | --- | --- | --- |
| Pressed, then the port closed | Still held | Released | Medius[Stock defect](/comparison/defect-recovery-exit-held.md) |

## Replug

The real device was unplugged and plugged back in, 10 times a run, two runs.

#### Replug times

| Interval | Stock | Medius | Result |
| --- | --- | --- | --- |
| Unplug to clone gone | 0.19 s | 0.45 s | Stock |
| Replug to clone back | 0.86 s | 0.86-0.87 s | Equal |
| Replug to first report | 0.92-0.93 s | 0.92-0.93 s | Equal |

## PC restart

The PC turned the clone's port off for 3 s (as a restart does) or unconfigured the clone for 3 s, then sent a move once the clone was back.

#### Time until the clone is back, min to max

| PC action | Stock | Medius | Result |
| --- | --- | --- | --- |
| Port off 3 s, then on | 0.601-0.693 s | 0.591-0.669 s | Equal |
| Unconfigured 3 s, then configured | 0.086-0.136 s | 0.092-0.106 s | Equal |

#### First move after the clone is back

Stock `km.move_now`Medius `MOVE(NOW)`

| PC action | Stock`km.move_now` | Medius`MOVE(NOW)` | Result |
| --- | --- | --- | --- |
| Port off 3 s, then on | Sometimes held >1 s | Arrives at once | Medius[Stock defect](/comparison/defect-recovery-restart-move-held.md) |
| Unconfigured 3 s, then configured | Arrives at once | Arrives at once | Equal |

#### First move after the clone is back, device reporting every 8 ms, min to max

Stock `km.move_now`Medius `MOVE(NOW)`

| PC action | Stock`km.move_now` | Medius`MOVE(NOW)` | Result |
| --- | --- | --- | --- |
| Port off 3 s, then on | 2.22-6.37 ms | 1.08-1.66 ms | Medius |
| Unconfigured 3 s, then configured | 3.44-8.12 ms | 0.74-1.52 ms | Medius |

## PC sleep

The PC put each clone to sleep 3 times.

#### Real device while the PC sleeps

| Device | Stock | Medius | Result |
| --- | --- | --- | --- |
| Mouse | Suspended | Suspended | Equal |

#### PC while asleep

| Case | Stock | Medius | Result |
| --- | --- | --- | --- |
| Nothing sent for 2 s | Asleep | Asleep | Equal |

#### Waking the sleeping PC

| Wakeup | Stock | Medius | Result |
| --- | --- | --- | --- |
| Injected move | PC stays asleep | Wakes the PC | Medius |
| The real device's remote wakeup | PC stays asleep | Wakes the PC | Medius[Stock defect](/comparison/defect-recovery-stock-no-wake.md) |
