# YKUSH Board Commands

## Command overview

YKUSH board commands have the following structure.

ykushcmd ykush [-s serial_number] [OPTION]

Where:

-s serial_number | Board serial number to which the command is addressed. When multiple YKUSH boards are connected to a host, this option should be used to specify the board. If more than one board is connected and this option is not provided the command will be sent to the first board in the USB enumeration list.
-l | List attached YKUSH boards. The serial number of each board attached to the host will be displayed.
-d 1|2|3|a | Power Down/Off downstream port with the number provided. If a is provided as the port number then all ports will be switched.
-u 1|2|3|a | Power Up/On downstream port with the number provided. If a is provided as the port number then all ports will be switched.
-g 1|2|3 | Get state of downstream port.

## List attached boards

The [-l] option is used to list all attached YKUSH boards. All YKUSH board have unique serial numbers which are displayed when this option is used.

    #list the serial number for each of the attached YKUSH boards
    $ ykushcmd ykush -l

    Attached YKUSH Boards:
    1. Board found with serial number: YK17125
    2. Board found with serial number: YK21493

## Downstream port On/Off switching

When only one YKUSH board is attached to the host the [-s serial_number] option is not required. Bellow are some examples.

    #power-down downstream port 1
    $ ykushcmd ykush -d 1

    #power-down downstream port 2
    $ ykushcmd ykush -d 2

    #power down downstream port 3
    $ ykushcmd ykush -d 3

    #power-down all three downstream ports
    $ ykushcmd ykush -d a

    #power-up downstream port 1
    $ ykushcmd ykush -u 1

    #power-up downstream port 2
    $ ykushcmd ykush -u 2

    #power-up downstream port 3
    $ ykushcmd ykush -u 3

    #power-up all three downstream ports
    $ ykushcmd ykush -u a

If more than one YKUSH board is attached to the host the [-s serial_number] option should be used. Bellow are some examples.

    #list the serial number for each of the attached YKUSH boards
    $ ykushcmd ykush -l

    Attached YKUSH Boards:
    1. Board found with serial number: YK17125
    2. Board found with serial number: YK21493

    #power-down downstream port 1 of the board with serial number YK17125
    $ ykushcmd ykush -s YK17125 -d 1

    #power-down downstream port 1 of the board with serial number YK21493
    $ ykushcmd ykush -s YK21493 -d 1

    #power-down downstream port 3
    $ ykushcmd ykush -d 3

    #power-down all three downstream ports of the board with serial number YK21493
    $ ykushcmd ykush -s YK21493 -d a

## Port switching state

The current switching state of each downstream port can be fetched from the YKUSH board using the [-g 1|2|3] option.

    #State of downstream port 1
    $ ykushcmd ykush -g 1

    Downstream port 1 is ON

    #power-down downstream port 1
    $ ykushcmd ykush -d 1

    #State of downstream port 1
    $ ykushcmd ykush -g 1

    Downstream port 1 is OFF

    #list the serial number for each of the attached YKUSH boards
    $ ykushcmd ykush -l

    Attached YKUSH Boards:
    1. Board found with serial number: YK17125
    2. Board found with serial number: YK21493

    #State of downstream port 1 of the board with serial number YK17125
    $ ykushcmd ykush -s YK17125 -g 1

    Downstream port 1 is OFF

    #power-up downstream port 1 of the board with serial number YK17125
    $ ykushcmd ykush -s YK17125 -u 1