YKUSH3 Board Commands

Command overview

YKUSH3 board commands have the following structure.

ykushcmd ykush3 [-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 YKUSH3 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 port state.
-on Switch On the 5V output power port.
-off Switch Off the 5V output power port.
-r 1|2|3 Read GPIO with the number provided (1, 2 or 3).
-w 1|2|3 0|1 Write to the GPIO with the number provided (1, 2 or 3). Writing a value of 1 or 0 will drive the GPIO to logical high or low, respectively.
--reset Resets (reboot) the YKUSH3 board.

List attached boards

The [-l] option is used to list all attached YKUSH3 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 YKUSH3 boards
$ ykushcmd ykush3 -l

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

Downstream port On/Off switching

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


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

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

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

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

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

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

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

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

If more than one YKUSH3 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 YKUSH3 boards
$ ykushcmd ykush3 -l

Attached YKUSH3 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 ykush3 -s YK17125 -d 1

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

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

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

Port switching state

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


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

Downstream port 1 is ON

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

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

Downstream port 1 is OFF

#list the serial number for each of the attached YKUSH boards
$ ykushcmd ykush3 -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 ykush3 -s YK17125 -g 1

Downstream port 1 is OFF

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

GPIO read/write

The [-r|-w] option is used to read from or write to a GPIO.


#Writing a 0 to a GPIO will drive it to logical low (0V).
#Example of writing value 0 to GPIO 1
$ ykushcmd ykush3 -w 1 0

#Writing a 1 to a GPIO will drive it to logical high (3.3V).
#Example of writing value 1 to GPIO 1
$ ykushcmd ykush3 -w 1 1

#Example of writing value 1 to GPIO 2
$ ykushcmd ykush3 -w 2 1

#Reading from a GPIO will get the digital value of that pin,
#0 if Low and 1 if High.
#Example of reading from GPIO 3
$ ykushcmd ykush3 -r 3

Reset/reboot board

The [--reset] option is used to reset (reboot) the board.


#Example of resetting YKUSH3
$ ykushcmd ykush3 --reset