ykushcmd-reference-ykush.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <h1>YKUSH Board Commands</h1>
  2. <div class="reference_page_toc">
  3. <ul>
  4. <li><a href="#command_overview">Command overview</a></li>
  5. <li><a href="#list_attached_example">List attached boards</a></li>
  6. <li><a href="#switch_command_example">Downstream port On/Off switching</a></li>
  7. <li><a href="#switch_state_command_example">Port switching state</a></li>
  8. </ul>
  9. </div>
  10. <h2 id="command_overview">Command overview</h2>
  11. <p>YKUSH board commands have the following structure.</p>
  12. <p class="command_line">ykushcmd ykush [-s serial_number] [OPTION]</p>
  13. <p>Where:</p>
  14. <table cellpadding="10">
  15. <tr>
  16. <td width="30%" valign="top">-s serial_number</td>
  17. <td>
  18. Board serial number to which the command is addressed.
  19. When multiple YKUSH boards are connected to a host, this option should be used
  20. to specify the board. If more than one board is connected and this option is not
  21. provided the command will be sent to the first board in the USB enumeration list.
  22. </td>
  23. </tr>
  24. <tr>
  25. <td valign="top">-l</td>
  26. <td>
  27. List attached YKUSH boards.
  28. The serial number of each board attached to the host will be displayed.
  29. </td>
  30. </tr>
  31. <tr>
  32. <td valign="top">-d 1|2|3|a</td>
  33. <td>
  34. Power Down/Off downstream port with the number provided.
  35. If <i>a</i> is provided as the port number then all ports will be switched.
  36. </td>
  37. </tr>
  38. <tr>
  39. <td valign="top">-u 1|2|3|a</td>
  40. <td>
  41. Power Up/On downstream port with the number provided.
  42. If <i>a</i> is provided as the port number then all ports will be switched.
  43. </td>
  44. </tr>
  45. <tr>
  46. <td>-g 1|2|3</td>
  47. <td>
  48. Get state of downstream port.
  49. </td>
  50. </tr>
  51. </table>
  52. <h2 id="list_attached_example">List attached boards</h2>
  53. <p>
  54. The <b>[-l]</b> option is used to list all attached YKUSH boards.
  55. All YKUSH board have unique serial numbers which are displayed when this option is used.
  56. </p>
  57. <pre>
  58. <code class="language-bash">
  59. #list the serial number for each of the attached YKUSH boards
  60. $ ykushcmd ykush -l
  61. Attached YKUSH Boards:
  62. 1. Board found with serial number: YK17125
  63. 2. Board found with serial number: YK21493
  64. </code>
  65. </pre>
  66. <h2 id="switch_command_example">Downstream port On/Off switching</h2>
  67. <p>
  68. When only one YKUSH board is attached to the host the <b>[-s serial_number]</b> option is not required.
  69. Bellow are some examples.
  70. </p>
  71. <pre>
  72. <code class="language-bash">
  73. #power-down downstream port 1
  74. $ ykushcmd ykush -d 1
  75. #power-down downstream port 2
  76. $ ykushcmd ykush -d 2
  77. #power down downstream port 3
  78. $ ykushcmd ykush -d 3
  79. #power-down all three downstream ports
  80. $ ykushcmd ykush -d a
  81. #power-up downstream port 1
  82. $ ykushcmd ykush -u 1
  83. #power-up downstream port 2
  84. $ ykushcmd ykush -u 2
  85. #power-up downstream port 3
  86. $ ykushcmd ykush -u 3
  87. #power-up all three downstream ports
  88. $ ykushcmd ykush -u a
  89. </code>
  90. </pre>
  91. <p>
  92. If more than one YKUSH board is attached to the host the <b>[-s serial_number]</b> option should be used.
  93. Bellow are some examples.
  94. </p>
  95. <pre>
  96. <code class="language-bash">
  97. #list the serial number for each of the attached YKUSH boards
  98. $ ykushcmd ykush -l
  99. Attached YKUSH Boards:
  100. 1. Board found with serial number: YK17125
  101. 2. Board found with serial number: YK21493
  102. #power-down downstream port 1 of the board with serial number YK17125
  103. $ ykushcmd ykush -s YK17125 -d 1
  104. #power-down downstream port 1 of the board with serial number YK21493
  105. $ ykushcmd ykush -s YK21493 -d 1
  106. #power-down downstream port 3
  107. $ ykushcmd ykush -d 3
  108. #power-down all three downstream ports of the board with serial number YK21493
  109. $ ykushcmd ykush -s YK21493 -d a
  110. </code>
  111. </pre>
  112. <h2 id="switch_state_command_example">Port switching state</h2>
  113. <p>
  114. The current switching state of each downstream port can be fetched from the YKUSH board using the <b>[-g 1|2|3]</b> option.
  115. </p>
  116. <pre>
  117. <code class="language-bash">
  118. #State of downstream port 1
  119. $ ykushcmd ykush -g 1
  120. Downstream port 1 is ON
  121. #power-down downstream port 1
  122. $ ykushcmd ykush -d 1
  123. #State of downstream port 1
  124. $ ykushcmd ykush -g 1
  125. Downstream port 1 is OFF
  126. #list the serial number for each of the attached YKUSH boards
  127. $ ykushcmd ykush -l
  128. Attached YKUSH Boards:
  129. 1. Board found with serial number: YK17125
  130. 2. Board found with serial number: YK21493
  131. #State of downstream port 1 of the board with serial number YK17125
  132. $ ykushcmd ykush -s YK17125 -g 1
  133. Downstream port 1 is OFF
  134. #power-up downstream port 1 of the board with serial number YK17125
  135. $ ykushcmd ykush -s YK17125 -u 1
  136. </code>
  137. </pre>