//----------------------------------------------------------------------------
//
// TSDuck - The MPEG Transport Stream Toolkit
// Copyright (c) 2005-2025, Thierry Lelegard
// BSD-2-Clause license, see LICENSE.txt file or https://tsduck.io/license
//
//----------------------------------------------------------------------------

<<<
=== tsdektec

[.cmd-header]
Dektec device control

This utility controls Dektec devices, which include input and/or output DVB-ASI devices or modulators (see <<Dektec>>).

[.usage]
Restrictions

This command is available on Linux and Windows only, Intel processors only.
Dektec provides no software support on macOS and other processors.
Moreover, this command may be unavailable on some Linux distributions since it integrates a closed-source library from Dektec,
which is prohibited by the policy of some distributions.

[.usage]
Usage

[source,shell]
----
$ tsdektec [options] [device]
----

[.usage]
Device

[.optdoc]
The optional parameter is a device index, from 0 to N-1 (with N being the number of Dektec devices in the system).
The default is 0, the first device.

[.optdoc]
Use option `--list-all` (or `-a`) to have a complete list of devices in the system.

[.usage]
Options

[.opt]
*-a* +
*--list-all*

[.optdoc]
List all Dektec devices available on the system.

[.opt]
*-i* _port-number_ +
*--input* _port-number_

[.optdoc]
Set the specified port in input mode.
This applies to bidirectional ports which can be either set in input or output mode.
The port number of each channel can be seen using the command `tsdektec -av`.

[.opt]
*-l* _state_ +
*--led* _state_

[.optdoc]
Set the state of the LED on the rear panel.
Useful to identify a Dektec device when more than one is present.
The state is one of `off`, `green`, `red`, `yellow`, `blue`, `hardware`.
See also option `--wait` (the led state is automatically returned to `hardware` after exit).

[.opt]
*-n* +
*--normalized*

[.optdoc]
With --all, list the Dektec devices in a normalized output format (useful for automatic analysis).

[.opt]
*-o* _port-number_ +
*--output* _port-number_

[.optdoc]
Set the specified port in output mode.
This applies to bidirectional ports which can be either set in input or output mode.
The port number of each channel can be seen using the command `tsdektec -av`.

[.opt]
*-p* _value_ +
*--power-mode* _value_

[.optdoc]
On DTU-315 USB modulators, set the power mode to the specified value.

[.optdoc]
Must be one of `high-quality`, `low-power`.

[.opt]
*-r* +
*--reset*

[.optdoc]
Reset the device.

[.opt]
*-w* _seconds_ +
*--wait* _seconds_

[.optdoc]
Wait the specified number of seconds before exiting.

[.optdoc]
The default if 5 seconds if option `--led` is specified and 0 otherwise.

include::{docdir}/opt/group-json-output.adoc[tags=!*;json-short;dektec]
include::{docdir}/opt/group-common-commands.adoc[tags=!*]

[.usage]
Normalized output format

In normalized output, each line describes one object (driver, device, channel, etc).
The format of each line is:

[source,text]
----
type:name[=value]:...
----

The _type_ identifies the kind of object which is described by the line.
The _name_ identifies a characteristics for the object with an optional value.
There is no space characters.
All integer values are in decimal format.

The normalized syntax can be used to search for specific objects with specific characteristics.
See also the description of the command `tsanalyze` for another example of normalized output.

*Obsolescence*: Note that this format was designed in the early times of TSDuck.
Nowadays, more modern formats such as JSON are more appropriate.
The option `--json` can be used instead of `--normalized` to produce a JSON report.
Such an output is easily manipulated and explored using the open source tool `jq`.
