> ## Documentation Index
> Fetch the complete documentation index at: https://docs.efference.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ef-cli

> Control and inspect an Efference M1

`ef-cli` controls the M1 over USB by default. Add `--ble <MAC>` for Bluetooth LE
(BLE).

```sh theme={null}
ef-cli [--ble <MAC>] [--device <id>] [--password <pw>] [--udp <host[:port]>] [--verbose] <command> [args]
```

## Global flags

| Flag                  | Meaning                                                                                               |
| --------------------- | ----------------------------------------------------------------------------------------------------- |
| `--ble <MAC>`         | connect over Bluetooth LE instead of USB                                                              |
| `--device <id>`       | select among multiple attached USB devices                                                            |
| `--password <pw>`     | control password (factory default `123456`); always needed on BLE, and on USB once locked             |
| `--udp <host[:port]>` | with `--ble`: device streams to this host over WiFi/UDP (default port 5005)                           |
| `--verbose`           | print control traffic; over BLE, also print phase-by-phase connect timing as `[ble] +NNNN ms <phase>` |

## Commands

### Discovery & identity

```sh theme={null}
ef-cli list [--scan-ble]      # discover devices
ef-cli info                   # identity snapshot: serial, fw, camera, IMU, WiFi
ef-cli state                  # current DEVICE_STATE
ef-cli config                 # enabled capture modes + current configuration
ef-cli config set 1920 1200 30 h265   # persist a capture config (idle only)
```

### Calibration

```sh theme={null}
ef-cli calibration [--get]            # show camera + IMU calibration
ef-cli calibration --camera --set <fx> <fy> <cx> <cy> <xi> <alpha> <W> <H> [--rectify on|off] [--fov-scale <s>]
                                      # set camera intrinsics (idle only; always
                                      # published as recording metadata)
ef-cli calibration --camera [--rectify on|off] [--fov-scale <s>]
                                      # change rectification without retyping the
                                      # intrinsics: reads the stored calibration,
                                      # edits the named flags, resends it
ef-cli calibration --imu --mode <raw|calibrated|both>   # how recordings carry the IMU calibration
ef-cli calibration [--camera|--imu] --reset             # reset to factory default
```

With `--rectify on` the device undistorts frames itself and produces
rectilinear images. With it off, the default, frames remain raw fisheye.
`--fov-scale` accepts a positive number and sets the rectified field of view,
`1.0` by default, with lower values wider and higher values zoomed. The complete
model is in [Calibration](/device/calibration).

### Health

```sh theme={null}
ef-cli health [--deep]        # on-device sweep; --deep adds the stress tier
```

### Recording

```sh theme={null}
ef-cli record start [name] [--location LAT,LON[,ALT]]
                              # device-local recording (survives disconnect);
                              # --location applies to this recording only
ef-cli record stop
ef-cli record status [name]
ef-cli record list            # each entry marked [encrypted] or [unencrypted]
ef-cli record delete <name>
ef-cli download <name> [dest] # pull over USB/BLE (bytes as stored). dest may be a
                             # file or a directory; a directory receives <name>.mcap
ef-cli storage                # free/total on the recording store
```

`download` never decrypts. An encrypted recording is transferred as ciphertext,
so specify a destination and process it with `ef-decrypt`. See
[Access Control and Encryption](/device/security#reading-an-encrypted-recording).

### Upload

```sh theme={null}
ef-cli upload <name> <presigned-url>   # device uploads over WiFi
ef-cli stop-upload <name>
```

### Update

```sh theme={null}
ef-cli check-update                    # what the update service offers, no download
ef-cli update                          # install whatever it offers
ef-cli update --url <url>              # install from an explicit URL, no service call
ef-cli update --file firmware.eff      # sideload a local image over USB
ef-cli abort-update
```

Name the source explicitly. A bare path remains supported for compatibility but
is inferred: the CLI treats it as a local bundle only if the file exists on disk,
so a mistyped path is fetched as a URL rather than reported as an error.

### WiFi & misc

```sh theme={null}
ef-cli wifi add <ssid> [psk [country]]
ef-cli wifi remove <ssid> | select <ssid> | status
ef-cli wifi list                       # saved networks (marks the connected one)
ef-cli wifi scan                       # top 10 access points in range, strongest
                                       # first (not while recording or streaming)
ef-cli sync-time                       # set the device clock from the host
ef-cli time                            # read the device wall clock
ef-cli location                        # read the device's current location
ef-cli location set <lat> <lon> [alt]  # persist the device location
ef-cli reboot
```

Quote an SSID that contains spaces. Omit `<psk>` to enter it at a hidden
prompt. The optional country is an ISO regulatory-domain code (`US` unlocks
5 GHz).

### Access control & encryption

```sh theme={null}
ef-cli set-password <new>              # rekey the control password (over unlocked USB)
ef-cli set-password <old> <new>        # rekey over BLE, or over locked USB
ef-cli lock on|off [--session]         # lock/unlock the USB control plane
                                       # --session: this power session only
ef-cli encryption on|off               # AES-256 encrypt new recordings (refused with no key)
ef-cli encryption create               # generate the device's key; SHOWN ONCE, save it
ef-cli encryption delete               # show the key and how to destroy it; destroys nothing
ef-cli encryption delete --confirm <key_id> [--yes]
ef-cli key show [--out <file>]         # print the key, or write it to a new 0600 file
ef-cli key set --in <file> | - | <64-hex>   # install a key you supply (32 bytes)
ef-cli factory-reset [--yes]           # restore defaults; DESTROYS the encryption key
```

`--yes` is required when no terminal is available for prompting: the two
destructive commands refuse rather than prompt under cron or
`ssh box 'ef-cli ...'`.

Separate binary, built alongside `ef-cli` when libcrypto is present:

```sh theme={null}
ef-decrypt <in.enc> <key-file> <out.mcap>
```

The complete model, including which fields remain readable on a locked device
and what a factory reset destroys, is in
[Access Control and Encryption](/device/security).
