Send USB commands

You are here:
Estimated reading time: 2 min

Command syntax

To top

KSH commands are intended to have human-friendly syntax to easy manual execution by a user from a PC. The command syntax is structured in levels and is based in space separated ASCII arguments which specify down-level commands and parameters. It is represented as:

$   command   < argument1 … argumentN >   [ parameter1 … parameterN ]

Where command is the name of the first level command to execute also called System command. It could have arguments to execute a lower-level command up to a maximum of three arguments (three levels). Commands also could have parameters which are variable data required to a successful command execution.

To display a system command list type help in the serial terminal and press enter:

kinos@local:~$ help
    clear       config      debug       ifdown      ifup
    ping        reset       show
  Consult KSH User’s guide for Command Reference

If an unknown system command is entered KSH will respond Command not found.

kinos@local:~$ wrongCommand
Command not found ( ‘help’ or ‘?’ for list of commands )

If commands are not entered with the correct syntax KSH will respond Invalid syntax.

kinos@local:~$ clear wrongKey
Invalid syntax
Refer to KSH – Reference Guide for more detailed command and syntax information.



To top

Commands are entered in the serial terminal by separating all arguments and parameters with spaces.

Arguments and parameters syntax depend on each command. There could be commands without any argument and two parameters, three arguments and no parameter or no arguments and no parameters at all.

Ping is a system command with no down-levels (no arguments) that sends a ping request to a remote node. It requires two parameters to be executed the destination IP address and the number of bytes to send:

kinos@local:~$ ping ff02::1 10

System command:  ping

[ param1: ff02::1 ]  – IPv6 address of remote node.

[ param2: 10 ]  – Decimal number of bytes to send.

Debug is a system command which allows to enable different debugging logs which are specified by up to three down-levels (arguments). No parameters are required for this command:

kinos@local:~$ debug module app dtls

System command:  debug

[ arg1: module ]
[ arg2: app ]
[ arg3: dtls ]  – This down-level command enables the logs for the DTLS module only.
[ no params ]

Help is a system command with no arguments and no parameters that shows a list of all first level system commands:

kinos@local:~$ help

System command: help

[ no args ]
[ no params ]

For config and show system commands <arg1> specifies the setting to configure or to show. To display the list of all the available settings (arg1) for show or config system commands type show ?show help or config ?, config help.

An example of configuration system command whose first argument specifies the setting to configure:

kinos@local:~$ config ipaddr add ff02::1

System commad: config

[ arg1: ipaddr ]
[ arg2: add ]
[ param1: ff02::1 ]  – IPv6 addr