# ECP-0029: Linux DVB Auto-Discovery (Adapters and Channels)

Status: Draft

## Problem

Linux DVB tuners should participate with minimal manual configuration. Requiring users to type `linux-dvb` and then fill out adapter, DVR, and channel options adds friction and hides available tuners from the "what can I watch right now" view.

## Decision

On Linux only:

- Auto-discover local DVB adapters by enumerating `/dev/dvb/adapter*`.
- If a `channels.conf` is available, auto-expose each channel as a selectable stream in the main Channels list without requiring Add Stream input.
- Support an explicit `channels.conf` override via `EVERY_CHANNEL_DVB_CHANNELS_CONF` to keep discovery deterministic and testable.

No scanning is introduced here. Auto-discovered channels come only from an existing `channels.conf`.

## Details

- Stream IDs use `StreamKey { source: linux-dvb, device_id: adapterX:dvrY, channel: <name> }` and remain a source-scope fallback until broadcast-scope IDs exist.
- Tuning is performed via a `dvbv5-zap` command embedded into the `linux-dvb://` URL (same mechanism as the Linux DVB picker).

## Consequences

- Linux nodes show their tuner channels "by default" when they already have a `channels.conf`, improving discoverability.
- Non-Linux builds remain unchanged (no `/dev/dvb`, no auto-listed Linux DVB streams).

## Alternatives Considered

- Full frequency scan (`dvbv5-scan`) on first run: rejected for now because it is slow, region-dependent, and hard to test deterministically.
- ioctl-based tuning: deferred until we can validate behavior across real hardware.

