Browse Source

Import upstream version 1.2.5

Paulo 1 year ago
parent
commit
75f5aadd69
63 changed files with 8452 additions and 803 deletions
  1. 10 6
      .gitignore
  2. 27 0
      .vscode/launch.json
  3. 2494 0
      Doxyfile
  4. 10 18
      LICENSE.md
  5. 34 13
      Makefile
  6. 34 0
      Makefile_tests
  7. 42 0
      Makefile_win32
  8. 40 0
      Makefile_win32_cross
  9. 42 0
      Makefile_win64
  10. 39 0
      Makefile_win64_cross
  11. 29 94
      README.md
  12. 0 0
      bin/placeholder
  13. 3 22
      build.sh
  14. 118 0
      doc/general_help.txt
  15. 14 0
      doc/reference-manual-ykushcmd/INDEX_reference-manual-ykushcmd.json
  16. 16 0
      doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykush.json
  17. 16 0
      doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykush3.json
  18. 16 0
      doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykushxs.json
  19. 31 0
      doc/reference-manual-ykushcmd/crud_cmd_example.txt
  20. 435 0
      doc/reference-manual-ykushcmd/ykushcmd-reference-manual-ykush3.html
  21. 173 0
      doc/reference-manual-ykushcmd/ykushcmd-reference-ykush.html
  22. 243 0
      doc/reference-manual-ykushcmd/ykushcmd-reference-ykush3.html
  23. 145 0
      doc/reference-manual-ykushcmd/ykushcmd-reference-ykushxs.html
  24. 136 0
      doc/ykush3_help.txt
  25. 49 0
      doc/ykushxs_help.txt
  26. 0 5
      install.sh
  27. 435 0
      learn/html/ykushcmd-reference-manual-ykush3.html
  28. 116 0
      src/commandParser.cpp
  29. 0 0
      ykushcmd/commandParser.h
  30. 160 0
      src/help/ykush_help.cpp
  31. 49 0
      src/help/ykush_help.h
  32. 0 0
      ykushcmd/objs/placeholder
  33. 0 0
      ykushcmd/platformdefs.h
  34. 0 0
      ykushcmd/stdafx.cpp
  35. 0 0
      ykushcmd/stdafx.h
  36. 0 0
      ykushcmd/targetver.h
  37. 67 0
      src/tests/test_usbhid.cpp
  38. 407 0
      src/usbhid/usbhid.cpp
  39. 156 0
      src/usbhid/usbhid.h
  40. 147 0
      src/utils/command_parser.cpp
  41. 82 0
      src/utils/command_parser.h
  42. 101 0
      src/utils/string2val.cpp
  43. 31 0
      src/utils/string2val.h
  44. 0 0
      src/windows/placeholder
  45. 204 0
      src/yk_usb_device.cpp
  46. 115 0
      src/yk_usb_device.h
  47. 14 0
      src/yktrl.cpp
  48. 283 0
      src/ykush/ykush.cpp
  49. 104 0
      src/ykush/ykush.h
  50. 417 0
      src/ykush2/ykush2.cpp
  51. 70 0
      src/ykush2/ykush2.h
  52. 857 0
      src/ykush3/ykush3.cpp
  53. 128 0
      src/ykush3/ykush3.h
  54. 18 10
      ykushcmd/ykushcmd.vcxproj
  55. 20 2
      ykushcmd/ykushcmd.vcxproj.filters
  56. 6 0
      src/ykushcmd.vcxproj.user
  57. 191 0
      src/ykushxs/ykushxs.cpp
  58. 78 0
      src/ykushxs/ykushxs.h
  59. 0 0
      ykush.sln
  60. 0 268
      ykushcmd/commandParser.cpp
  61. 0 338
      ykushcmd/usbcom.cpp
  62. 0 15
      ykushcmd/usbcom.h
  63. 0 12
      ykushcmd/ykushcmd.cpp

+ 10 - 6
.gitignore

@@ -1,10 +1,14 @@
-hidapi/
-Release/
-Debug/
-release/
-debug/
 *.swp
 *.bak
 *.o
 .directory
-bin/ykushcmd
+bin/ykushcmd*
+.vs/
+*.exe
+*.so
+*.exp
+nbproject
+doc/ykushcmd-doxygen/*
+.vscode
+dev/
+

+ 27 - 0
.vscode/launch.json

@@ -0,0 +1,27 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "(gdb) Launch",
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "enter program name, for example ${workspaceFolder}/a.out",
+            "args": [],
+            "stopAtEntry": false,
+            "cwd": "${workspaceFolder}",
+            "environment": [],
+            "externalConsole": true,
+            "MIMode": "gdb",
+            "setupCommands": [
+                {
+                    "description": "Enable pretty-printing for gdb",
+                    "text": "-enable-pretty-printing",
+                    "ignoreFailures": true
+                }
+            ]
+        }
+    ]
+}

File diff suppressed because it is too large
+ 2494 - 0
Doxyfile


+ 10 - 18
LICENSE.md

@@ -1,21 +1,13 @@
- Copyright (c) 2016 Yepkit Lda
+Copyright (c) 2017 Yepkit Lda
 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
+    http://www.apache.org/licenses/LICENSE-2.0
 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.

+ 34 - 13
Makefile

@@ -1,23 +1,44 @@
+PROG_SOURCE = yktrl.cpp
+SOURCE += commandParser.cpp
+SOURCE += ykushxs/ykushxs.cpp
+SOURCE += ykush/ykush.cpp
+SOURCE += ykush2/ykush2.cpp
+SOURCE += ykush3/ykush3.cpp
+SOURCE += yk_usb_device.cpp
+SOURCE += help/ykush_help.cpp
+SOURCE += utils/command_parser.cpp
+SOURCE += utils/string2val.cpp
+SOURCE += usbhid/usbhid.cpp
+
+
+SOURCE_FULL = $(addprefix src/, $(SOURCE))
+PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
+OBJS = $(SOURCE_FULL:.cpp=.o)
+PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)
+
+DEFINES += _LINUX_
+DEFINES += _LIBUSB_
+
+COMPILE_FLAGS += $(addprefix -D, $(DEFINES))
+
 CUR_PATH = $(shell echo $(PWD))
-OBJS = $(addprefix ykushcmd/objs/,ykushcmd.o commandParser.o usbcom.o)
-LIBS = -lhidapi-libusb -lusb-1.0 -ludev
-LOADPATHS = -L$(CUR_PATH)/ykushcmd/linux
-PREPROCESSOR_DEFS = -DLINUX
+INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) libusb )
+LOADPATHS = 
+LIBS = -lusb-1.0
 CPP = g++
+ 
 
-ykushcmd : $(OBJS)
-	$(CPP) $(LOADPATHS) -o bin/ykushcmd $(OBJS) $(LIBS)
 
+ykushcmd : $(PROG_OBJ) $(OBJS)
+	$(CPP) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
 
-ykushcmd/objs/ykushcmd.o : ykushcmd/ykushcmd.cpp ykushcmd/commandParser.h
-	$(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/ykushcmd.cpp -o ykushcmd/objs/ykushcmd.o
+$(PROG_OBJ) :  %.o : %.cpp
+	$(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
 
-ykushcmd/objs/commandParser.o : ykushcmd/commandParser.cpp ykushcmd/commandParser.h ykushcmd/usbcom.h 
-	$(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/commandParser.cpp -o ykushcmd/objs/commandParser.o
+$(OBJS) : %.o : %.cpp %.h
+	$(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
 
-ykushcmd/objs/usbcom.o : ykushcmd/usbcom.cpp ykushcmd/linux/hidapi.h ykushcmd/usbcom.h
-	$(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/usbcom.cpp -o ykushcmd/objs/usbcom.o
 
 clean :
-	rm -f bin/ykushcmd $(OBJS)
+	rm -f bin/yktrl $(OBJS) $(PROG_OBJ)
 

+ 34 - 0
Makefile_tests

@@ -0,0 +1,34 @@
+PROG_SOURCE = tests/test_usbhid.cpp
+SOURCE += usbhid/usbhid.cpp
+
+
+SOURCE_FULL = $(addprefix src/, $(SOURCE))
+PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
+OBJS = $(SOURCE_FULL:.cpp=.o)
+PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)
+
+CUR_PATH = $(shell echo $(PWD))
+INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)))
+LOADPATHS =
+LIBS = -lusb-1.0
+CPP = g++
+
+
+
+#OBJS = $(addprefix src/objs/, ykushcmd.o commandParser.o ykushxs.o yk_usb_device.o ykush.o ykush_help.o ykush2.o ykush3.o command_parser.o string2val.o)
+#LOADPATHS = -L$(CUR_PATH)/src/linux
+#INCLUDEPATHS= -I$(CUR_PATH)/src/linux -I$(CUR_PATH)/src/ykushxs -I$(CUR_PATH)/src/ykush -I$(CUR_PATH)/src -I$(CUR_PATH)/src/help -I$(CUR_PATH)/src/ykush2 -I$(CUR_PATH)/src/ykush3 -I$(CUR_PATH)/src/utils
+
+
+ykushcmd : $(PROG_OBJ) $(OBJS)
+	$(CPP) $(LOADPATHS) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
+
+$(PROG_OBJ) :  %.o : %.cpp
+	$(CPP) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+$(OBJS) : %.o : %.cpp %.h
+	$(CPP) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+clean :
+	rm -f bin/ykushcmd $(OBJS) $(PROG_OBJ)
+

+ 42 - 0
Makefile_win32

@@ -0,0 +1,42 @@
+PROG_SOURCE = yktrl.cpp
+SOURCE += commandParser.cpp
+SOURCE += ykushxs/ykushxs.cpp
+SOURCE += ykush/ykush.cpp
+SOURCE += ykush2/ykush2.cpp
+SOURCE += ykush3/ykush3.cpp
+SOURCE += yk_usb_device.cpp
+SOURCE += help/ykush_help.cpp
+SOURCE += utils/command_parser.cpp
+SOURCE += utils/string2val.cpp
+
+
+SOURCE_FULL = $(addprefix src/, $(SOURCE))
+PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
+OBJS = $(SOURCE_FULL:.cpp=.o)
+PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)
+
+CUR_PATH = $(CURDIR)
+INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) hidapi )
+LOADPATHS = -L$(CUR_PATH)/hidapi/mingw32
+LIBS = -lhidapi
+FLAGS = -static-libgcc -static-libstdc++
+
+#Change MinGW exec name to match version instaled in your system
+CPP = i686-w64-mingw32-g++
+#CPP_WIN32 =  i686-w64-mingw32-g++ 
+#CPP_WIN64 =  x86_64-w64-mingw32-g++ 
+
+
+ykushcmd_win32.exe : $(PROG_OBJ) $(OBJS)
+	$(CPP) $(FLAGS) $(LOADPATHS) -o bin/Win32/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
+
+$(PROG_OBJ) :  %.o : %.cpp
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+$(OBJS) : %.o : %.cpp %.h
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+
+clean :
+	rm -f bin/Win32/yktrl_win32.exe $(OBJS) $(PROG_OBJ)
+

+ 40 - 0
Makefile_win32_cross

@@ -0,0 +1,40 @@
+PROG_SOURCE = yktrl.cpp
+SOURCE += commandParser.cpp
+SOURCE += ykushxs/ykushxs.cpp
+SOURCE += ykush/ykush.cpp
+SOURCE += ykush2/ykush2.cpp
+SOURCE += ykush3/ykush3.cpp
+SOURCE += yk_usb_device.cpp
+SOURCE += help/ykush_help.cpp
+SOURCE += utils/command_parser.cpp
+SOURCE += utils/string2val.cpp
+
+
+SOURCE_FULL = $(addprefix src/, $(SOURCE))
+PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
+OBJS = $(SOURCE_FULL:.cpp=.o)
+PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)
+
+CUR_PATH = $(shell echo $(PWD))
+INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) hidapi )
+LOADPATHS = -L$(CUR_PATH)/hidapi/mingw32
+LIBS = -lhidapi
+FLAGS = -static-libgcc -static-libstdc++
+CPP = i686-w64-mingw32-g++
+#CPP_WIN32 =  i686-w64-mingw32-g++ 
+#CPP_WIN64 =  x86_64-w64-mingw32-g++ 
+
+
+ykushcmd_win32.exe : $(PROG_OBJ) $(OBJS)
+	$(CPP) $(FLAGS) $(LOADPATHS) -o bin/Win32/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
+
+$(PROG_OBJ) :  %.o : %.cpp
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+$(OBJS) : %.o : %.cpp %.h
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+
+clean :
+	rm -f bin/Win32/yktrl_win32.exe $(OBJS) $(PROG_OBJ)
+

+ 42 - 0
Makefile_win64

@@ -0,0 +1,42 @@
+PROG_SOURCE = yktrl.cpp
+SOURCE += commandParser.cpp
+SOURCE += ykushxs/ykushxs.cpp
+SOURCE += ykush/ykush.cpp
+SOURCE += ykush2/ykush2.cpp
+SOURCE += ykush3/ykush3.cpp
+SOURCE += yk_usb_device.cpp
+SOURCE += help/ykush_help.cpp
+SOURCE += utils/command_parser.cpp
+SOURCE += utils/string2val.cpp
+
+
+SOURCE_FULL = $(addprefix src/, $(SOURCE))
+PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
+OBJS = $(SOURCE_FULL:.cpp=.o)
+PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)
+
+CUR_PATH = $(CURDIR)
+INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) hidapi )
+LOADPATHS = -L$(CUR_PATH)/hidapi/mingw32
+LIBS = -lhidapi
+FLAGS = -static-libgcc -static-libstdc++
+
+#Change MinGW exec name to match version instaled in your system
+CPP = x86_64-w64-mingw32-g++
+#CPP_WIN32 =  i686-w64-mingw32-g++ 
+#CPP_WIN64 =  x86_64-w64-mingw32-g++ 
+
+
+ykushcmd_win64.exe : $(PROG_OBJ) $(OBJS)
+	$(CPP) $(FLAGS) $(LOADPATHS) -o bin/Win32/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
+
+$(PROG_OBJ) :  %.o : %.cpp
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+$(OBJS) : %.o : %.cpp %.h
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+
+clean :
+	rm -f bin/Win64/yktrl_win32.exe $(OBJS) $(PROG_OBJ)
+

+ 39 - 0
Makefile_win64_cross

@@ -0,0 +1,39 @@
+PROG_SOURCE = yktrl.cpp
+SOURCE += commandParser.cpp
+SOURCE += ykushxs/ykushxs.cpp
+SOURCE += ykush/ykush.cpp
+SOURCE += ykush2/ykush2.cpp
+SOURCE += ykush3/ykush3.cpp
+SOURCE += yk_usb_device.cpp
+SOURCE += help/ykush_help.cpp
+SOURCE += utils/command_parser.cpp
+SOURCE += utils/string2val.cpp
+
+
+SOURCE_FULL = $(addprefix src/, $(SOURCE))
+PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
+OBJS = $(SOURCE_FULL:.cpp=.o)
+PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)
+
+CUR_PATH = $(shell echo $(PWD))
+INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) hidapi )
+LOADPATHS = -L$(CUR_PATH)/hidapi/mingw64
+LIBS = -lhidapi
+FLAGS = -static-libgcc -static-libstdc++
+CPP = x86_64-w64-mingw32-g++
+#CPP_WIN32 =  i686-w64-mingw32-g++ 
+#CPP_WIN64 =  x86_64-w64-mingw32-g++ 
+
+
+ykushcmd_win64.exe : $(PROG_OBJ) $(OBJS)
+	$(CPP) $(FLAGS) $(LOADPATHS) -o bin/Win64/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
+
+$(PROG_OBJ) :  %.o : %.cpp
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+$(OBJS) : %.o : %.cpp %.h
+	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@
+
+clean :
+	rm -f bin/Win64/yktrl_win64.exe $(OBJS) $(PROG_OBJ)
+

+ 29 - 94
README.md

@@ -1,151 +1,86 @@
 # YKUSH Command Application
 
 
-Control application for Yepkit YKUSH Switchable USB Hub board.
+Control application for Yepkit YKUSH Switchable USB Hub boards.
 
 
 Description
 ===========
 
-Console application developed to illustrate the programmatic control of YKUSH capabilities.
+Console application developed to illustrate the programmatic control of YKUSH family boards capabilities.
 It executes one command per run, being appropriate to be executed as a console command.
 But it can be easily adapted to execute a work-flow with multiple commands and we encourage you to alter it to best fit your needs.
 
-The core of the application is consolidated in two source code files, the *commandParser.cpp* and the *usbcom.cpp*.
-The first contains the work-flow control and the second the communication functions.
+The implementation makes use of libusb for Linux builds and hidapi for Windows.
+For Linux we include a build and installation script, `build.sh` and `install.sh` respectively, for building and installing the application. 
 
-The implementation makes use of hidapi open-source library which is portable across several operating systems.
-We include a Visual Studio solution file for building on Windows. For Linux we include a build and installation script, `build.sh` and `install.sh` respectively, for building and installing the application. 
 
-Note that hidapi is not included in the source code package and has to be obtained beforehand. For Linux, if the
-`build.sh` script is used, to build the application, it will take care of downloading and building the hidapi library for you. In Windows this step has to
-be manually performed by the user.
+Boards Supported
+================
+- [YKUSH](https://www.yepkit.com/products/ykush)
+- [YKUSHXS](https://www.yepkit.com/product/300115/YKUSHXS)
+- [YKUSH3](https://www.yepkit.com/product/300110/YKUSH3)
 
 
 Licensing
 =========
 
-The source code is licensed under MIT license. 
+The source code is licensed Apache License, Version 2.0. 
 Refer to [LICENSE](LICENSE.md) file.
 
 
 Building
 ========
 
-The steps for building on Windows and Linux are detailed bellow.
-
-Windows
--------
-
-Before building the application from source on Windows you need to get the [hidapi library](http://www.signal11.us/oss/hidapi/) and build it.
-Follow the instructions in the hidapi documentation for building the library in the several systems. 
-
-After building the hidapi library you need to include the relevant hidapi files to *ykushcmd* project. 
-
-Copy to `ykush\ykushcmd\windows\` the following hidapi library files:
-- hidapi.dll
-- hidapi.exp
-- hidapi.lib
-
-
-Open the `ykush\ykush.sln` with Microsoft Visual Studio and build the solution.
-After a successful build process the executable file will be created in the`ykush\bin\` folder.
-
-The next step is to make the dynamically linked library accessible to executable.
-We can install the `hidapi.dll` in the system or ensure that a copy of the file is in the same folder than the `ykush.exe`.
+The steps for building on Linux and Windows are detailed bellow.
 
 
 Linux
 -----
 
-The easiest way to build the application on Linux is to use the `build.sh` script which is in the `ykush/` folder.
-Nonetheless the application can be built running make and using the provided Makefile directly, but it will require
-some prior manual configuration detailed ahead. 
-
-To build the application using the scripts run the following inside the `ykush/` folder.
+For Linux `libusb-1.0` must be installed. For Debian based systems run the following.
 ```
-./build.sh
+sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
 ```
-Note that the script requires Internet connectivity to fetch the latest version of hidapi library.
-
-Some dependencies may not have been satisfied and some additional systems components and utilities may be required.
-If that was the case please install them and re-run the script. 
-
-After a successful build process you can install the ykush command in the system. To do so, in `ykush/` folder run:
+With these dependencies installed, build the application the running the following script.
 ```
-sudo ./install.sh
+./build.sh
 ```
 
-After install, the `ykush` command is ready for use.
-
-
-On the other hand, if you want to build running make directly with the provided Makefile do the following.
-
-First get the [hidapi library](http://www.signal11.us/oss/hidapi/) and build it.
-Please follow the instructions in the hidapi documentation for building the library in the several systems. 
-
-After building the hidapi library include the relevant hidapi files to *ykushcmd* project. 
-
-Copy to `ykush/ykushcmd/linux/` the `libhidapi-hidraw.so` and the `libhidapi-libusb.so` files from hidapi library you
-just built.
-
-Now add the following lines to the `platformdefs.h` file which is in the `ykush/ykushcmd/` folder.
+After a successful build process you can install the ykush command in the system. To do so, run:
 ```
-#ifndef PLATFORMDEFS_H
-#define PLATFORMDEFS_H
-#define LINUX
-#endif
+sudo ./install.sh
 ```
 
+After install, the `ykushcmd` command is ready for use.
 
-Next, in the `ykush/` folder run `make` to build the application.
-If the build process is successful the ykush executable will be created in the `ykush/bin/` folder.
-
-The next step is to make the shared library accessible to the executable.
-Do this by installing the *libhidapi-hidraw.so* or the *libhidapi-libusb.so*, depending if the hidraw or the libusb back-end is to be used (in doubt install both), in a system folder (e.g., /usr/lib/) or set the environment variable *LD_LIBRARY_PATH* with the path to the library files. 
-Alternatively you can run the script `install.sh` which is located in the `ykush/` folder.
 
 
-Using it
-========
-
 Windows
 -------
-Navigate to the `ykush\bin\` folder and run `ykush.exe -h` to print all the available command options a syntax.
 
-Let's look at some command examples.
+To build using MinGW run the following command.
 
-Assuming that just one YKUSH board is connected to our host, if we wanted to turn **OFF** the downstream port 1 we would issue the following command.
+For 32bit:
 ```
-ykushcmd.exe -d 1
+make -f Makefile_win32
 ```
 
-Similarly, if we wanted to turn the downstream 1 back **ON** we would issue the following command.
+For 64bit:
 ```
-ykushcmd.exe -u 1
+make -f Makefile_win64
 ```
 
-Assuming that two YKUSH boards are connected to our host and we wanted to turn **OFF** the downstream port 1 of one specific board. 
-To accomplish this we need to address the command by the YKUSH board **serial number**. 
-To find out the boards serial number we can issue the following command.
-```
-ykushcmd.exe -l
-```
-This will print the serial number of all YKUSH boards attached to the host.
-Assuming the our board had the serial number YK1234567, we would issue the following command.
-```
-ykushcmd.exe -s YK1234567 -d 1
-```
-This would turn **OFF** the downstream port 1 of the board with the serial number YK12345.
+After a successful build process the executable file will be created in the `bin\Win32` or `bin\Win64` folder depending if it was the 32 or 64 bit build.
 
 
-Linux
------
-For Linux the command options and syntax are the same with the slight difference that the executable file does not have the `.exe` extension.
-Also depending of your user permissions you may need to precede the command with the *sudo* directive (e.g, `sudo ykushcmd -d 1`).
+
+Using it
+========
+
+For details on using YKUSHCMD please refer to the [YKUSHCMD Reference Manual](https://www.learn.yepkit.com/reference/ykushcmd-reference-ykush/1/2).
 
 
-For more information and resources for the YKUSH board please visit the [yepkit website ykush page](https://www.yepkit.com/products/ykush).
 
 
 

+ 0 - 0
bin/placeholder


+ 3 - 22
build.sh

@@ -2,28 +2,9 @@
 #
 # YKUSH command application build script
 
-rm -rf hidapi
+make clean
 
-echo "Checking for git..."
-command -v git >/dev/null 2>&1 || { echo >&2 "Git is required and is not installed. Aborting."; exit 1; }
-
-echo "Fetching latest version of hidapi..."
-git clone git://github.com/signal11/hidapi.git
-
-echo "Building hidapi..."
-make --directory=hidapi/linux -f Makefile-manual
-cp -fv hidapi/linux/libhidapi-hidraw.so ykushcmd/linux/
-
-make --directory=hidapi/libusb -f Makefile-manual
-cp -fv hidapi/libusb/libhidapi-libusb.so ykushcmd/linux/
-
-echo "Configuring ykush app files..."
-
-echo "#ifndef PLATFORMDEFS_H" > ykushcmd/platformdefs.h
-echo "#define PLATFORMDEFS_H" >> ykushcmd/platformdefs.h
-echo "#define LINUX" >> ykushcmd/platformdefs.h
-echo "#endif" >> ykushcmd/platformdefs.h
-
-echo "Building ykush command..."
+echo "Building YKUSHCMD..."
 make
 
+

+ 118 - 0
doc/general_help.txt

@@ -0,0 +1,118 @@
+--------------------------------------------------------------------------
+
+        YKUSH Boards Command Application Help
+        
+--------------------------------------------------------------------------
+
+
+Command Structure:
+-------------------
+
+ykushcmd <board_prefix> [<options>]
+
+board_prefix            Indexes the scopeboard being commanded. 
+                        Prefixes/board scope mapping:
+                        
+                        -------------------------
+                        | Board     | Prefix    |
+                        -------------------------
+                        | YKUSH     | No prefix |
+                        -------------------------
+                        | YKUSH XS  | ykushxs   |
+                        -------------------------
+                        | YKUSH 2   | ykush2    |
+                        -------------------------
+                        | YKUSH 3   | ykush3    |
+                        -------------------------
+                        
+
+ options                Options specific to each board scope as detailed
+                        bellow.                      
+                        
+
+                        
+1. Available Commands For YKUSH Boards:
+------------------------------------------
+
+ykushcmd -d dn_number                       Turns DOWN the downstream port
+                                            with the number dn_number
+                                            
+
+ykushcmd -u dn_number                       Turns UP the downstream port 
+                                            with the number dn_number
+                                            
+
+ykushcmd -g dn_number                       Obtains the switching status 
+                                            of port with the number dn_number
+                                            
+
+ykushcmd -l                                 Lists all currently attached 
+                                            YKUSH boards
+                                            
+
+ykushcmd -s serial_number -d dn_number      Turns DOWN the downstream port 
+                                            with the number dn_number for
+                                            the board with the specified
+                                            serial number
+                                            
+
+ykushcmd -s serial_number -u dn_number      Turns UP the downstream port
+                                            with the number dn_number for
+                                            the board with the specified
+                                            serial number
+
+
+
+ykushcmd -s serial_number -g dn_number      Obtains the switching status
+                                            of port with the number
+                                            dn_number for the board with
+                                            the specified serial number
+
+
+
+                                            
+NOTE: For Windows operating systems add the .exe extension when calling the ykushcmd command. For example for disconnecting the downstream port 1 the command is as follows.
+
+ykushcmd.exe -d 1                                            
+                                            
+                   
+                   
+
+
+2. Available Commands For YKUSH XS Boards:
+------------------------------------------
+
+ykushcmd ykushxs -d                     Turns DOWN the downstream port
+
+
+ykushcmd ykushxs -u                     Turns UP the downstream port
+
+
+ykushcmd ykushxs -g                     Obtains the switching status of
+                                        the downstream port
+                                        
+
+ykushcmd ykushxs -l                     Lists all currently attached
+                                        YKUSH XS boards
+                                        
+
+ykushcmd ykushxs -s serial_number -d    Turns DOWN the downstream port for
+                                        the board with the specified
+                                        serial number
+                                        
+
+ykushcmd ykushxs -s serial_number -u    Turns UP the downstream port for
+                                        the board with the specified
+                                        serial number
+                                        
+
+ykushcmd ykushxs -s serial_number -g    Obtains the switching status of
+                                        port for the board with the
+                                        specified serial number
+
+                                        
+NOTE: For Windows operating systems add the .exe extension when calling the ykushcmd command. For example for disconnecting the downstream port the command is as follows.
+
+ykushcmd.exe ykushxs -d
+
+

+ 14 - 0
doc/reference-manual-ykushcmd/INDEX_reference-manual-ykushcmd.json

@@ -0,0 +1,14 @@
+{
+    "reference_uid" : "reference-manual-ykushcmd",
+    "reference_title" : "YKUSHCMD Reference Manual",
+    "version" : {
+                    "major" : 1,
+                    "minor" : 2
+            },
+    "pages" : [
+            { "page_uid" : "ykushcmd-reference-ykush", "page_title" : "YKUSH"},
+            { "page_uid" : "ykushcmd-reference-ykushxs", "page_title" : "YKUSHXS"},
+            { "page_uid" : "ykushcmd-reference-ykush3", "page_title" : "YKUSH3"}
+    ],
+    "root_page_uid" : "ykushcmd-reference-ykush"
+}

+ 16 - 0
doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykush.json

@@ -0,0 +1,16 @@
+{
+        "page_uid": "ykushcmd-reference-ykush",
+        "page_title" : "YKUSH with YKUSHCMD",
+        "reference_uid" :"reference-manual-ykushcmd",
+        "reference_title" : "YKUSHCMD Reference Manual",
+        "version" : {
+                "major" : 1,
+                "minor" :  2
+        },
+        "status": "published",
+        "content": {
+                "tags": ["YKUSHCMD","YKUSH","User Manual","Switched Hub","USB Hub", "Yepkit"],
+                "title": "Controlling YKUSH with YKUSHCMD",
+                "subtitle": "Command options and examples"
+        }
+}

+ 16 - 0
doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykush3.json

@@ -0,0 +1,16 @@
+{
+        "page_uid": "ykushcmd-reference-ykush3",
+        "page_title" : "YKUSH3 with YKUSHCMD",
+        "reference_uid" :"reference-manual-ykushcmd",
+        "reference_title" : "YKUSHCMD Reference Manual",
+        "version" : {
+                "major" : 1,
+                "minor" :  2
+        },
+        "status": "published",
+        "content": {
+                "tags": ["YKUSHCMD","YKUSH3","User Manual","Switched Hub","USB Hub", "Yepkit", "USB 3.1"],
+                "title": "Controlling YKUSH3 with YKUSHCMD",
+                "subtitle": "Command options and examples"
+        }
+}

+ 16 - 0
doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykushxs.json

@@ -0,0 +1,16 @@
+{
+        "page_uid": "ykushcmd-reference-ykushxs",
+        "page_title" : "YKUSHXS with YKUSHCMD",
+        "reference_uid" :"reference-manual-ykushcmd",
+        "reference_title" : "YKUSHCMD Reference Manual",
+        "version" : {
+                "major" : 1,
+                "minor" :  2
+        },
+        "status": "published",
+        "content": {
+                "tags": ["YKUSHCMD","YKUSHXS","User Manual","Switched Hub","USB Hub", "Yepkit"],
+                "title": "Controlling YKUSHXS with YKUSHCMD",
+                "subtitle": "Command options and examples"
+        }
+}

+ 31 - 0
doc/reference-manual-ykushcmd/crud_cmd_example.txt

@@ -0,0 +1,31 @@
+node reference_index_create_replace.js /home/paulo/development/software/ykushcmd/doc/reference-manual-ykushcmd/INDEX_reference-manual-ykushcmd.json
+
+#YKUSH
+node reference_page_create_replace.js /home/paulo/development/software/ykushcmd/doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykush.json /home/paulo/development/software/ykushcmd/doc/reference-manual-ykushcmd/ykushcmd-reference-ykush.html
+
+
+#YKUSHXS
+node reference_page_create_replace.js /home/paulo/development/software/ykushcmd/doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykushxs.json /home/paulo/development/software/ykushcmd/doc/reference-manual-ykushcmd/ykushcmd-reference-ykushxs.html
+
+#YKUSH3
+node reference_page_create_replace.js /home/paulo/development/software/ykushcmd/doc/reference-manual-ykushcmd/METADATA_ykushcmd-reference-ykush3.json /home/paulo/development/software/ykushcmd/doc/reference-manual-ykushcmd/ykushcmd-reference-ykush3.html
+
+
+
+
+
+#
+#AWS
+#
+
+node reference_index_create_replace.js /home/yepkit/web/nodejs/apps/learn.yepkit.com/htmls/reference/ykushcmd/INDEX_reference-manual-ykushcmd.json
+
+#YKUSH
+node reference_page_create_replace.js /home/yepkit/web/nodejs/apps/learn.yepkit.com/htmls/reference/ykushcmd/METADATA_ykushcmd-reference-ykush.json /home/yepkit/web/nodejs/apps/learn.yepkit.com/htmls/reference/ykushcmd/ykushcmd-reference-ykush.html
+
+
+#YKUSHXS
+node reference_page_create_replace.js /home/yepkit/web/nodejs/apps/learn.yepkit.com/htmls/reference/ykushcmd/METADATA_ykushcmd-reference-ykushxs.json /home/yepkit/web/nodejs/apps/learn.yepkit.com/htmls/reference/ykushcmd/ykushcmd-reference-ykushxs.html
+
+#YKUSH3
+node reference_page_create_replace.js /home/yepkit/web/nodejs/apps/learn.yepkit.com/htmls/reference/ykushcmd/METADATA_ykushcmd-reference-ykush3.json /home/yepkit/web/nodejs/apps/learn.yepkit.com/htmls/reference/ykushcmd/ykushcmd-reference-ykush3.html

+ 435 - 0
doc/reference-manual-ykushcmd/ykushcmd-reference-manual-ykush3.html

@@ -0,0 +1,435 @@
+<div class="reference_software_manual_version">
+	This manual page refers to software version <b>v1.2.0</b>.
+</div>
+
+<div class="reference_software_manual_index">
+	<ul>
+		<li><a href="#command_list">Command list</a></li>
+		<li><a href="#ykush3_man_important_links">Important links</a></li>
+		
+	</ul>
+</div>
+
+<div class="reference_software_manual_body">
+
+	<!-- 
+		COMMAND LIST 
+	-->
+	<h1 id="command_list">Command list</h1>
+	<div>
+		<ul>
+			<li><a href="#downstream_port_commands">Downstream port commands</a></li>
+			<li><a href="#5V_output_port_commands">5V output switched port control commands</a></li>
+			<li><a href="#gpio_ctrl_config_commands">GPIO control configuration commands</a></li>
+			<li><a href="#gpio_read_write_commands">GPIO Read/Write commands</a></li>
+			<li><a href="#ykush3_downstream_port_config_commands">Downstream ports configuration commands</a></li>
+			<li><a href="#ykush3_i2c_commands">I2C interface commands</a></li>
+			<li><a href="#ykush3_uart_commands">UART interface commands</a></li>
+			<li><a href="#ykush3_reset_commands">Reset command</a></li>
+			<li><a href="#ykush3_versioning_commands">Versioning commands</a></li>
+		</ul>
+	</div>
+	<div>
+		<p>Legend:</p>
+		<p>
+			&lt;&gt; Variable<br> 
+			[] Optional parameter<br>
+			&gt;  Command line
+		</p>
+	</div>
+	<div>
+		<!-- 1. Downstream port commands -->
+		<h2 id="downstream_port_commands">Downstream port commands</h2>
+		
+		<p>The structure of the downstream port commands is as follows.</p>
+
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -&lt;action&gt; &lt;port&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>Serial number of a board. This is an optional parameter useful for when multiple boards are attached to the same host.</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					u &rarr; Turn ON/UP the downstream<br>
+					d &rarr; Turn OFF/DOWN the downstream<br>
+					g &rarr; Get downstream port status<br>
+					l &rarr; List boards attached<br>
+				</td>
+			</tr>
+			<tr>
+				<td>port</td>
+				<td>1, 2 or 3.</td>
+			</tr>
+		</table>
+
+
+		<p>Some examples:</p>
+
+		<p>Turn OFF the downstream port 1 (if only one YKUSH3 board is attached).</p>
+
+		<p class="command_line">ykushcmd ykush3 -d 1<p>
+
+		<p>Turn OFF the downstream port 1 of the board with serial number YKB00001.</p>
+
+		<p class="command_line">ykushcmd ykush3 -s YKB00001 -d 1</p>
+
+		<p>Get status of downstream port 2</p>
+
+		<p class="command_line">ykushcmd ykush3 -g 2<p>
+
+		<p>List attached YKUSH3 boards</p>
+
+		<p class="command_line">ykushcmd ykush3 -l</p>
+		
+		
+		
+		<!-- 2. 5V output switched port control commands -->
+		<h2 id="5V_output_port_commands">5V output switched port control commands</h2>
+
+		<p>The structure of commands:</p>
+
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -&lt;action&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. 
+					This is an optional parameter useful for when multiple boards are attached to the same host.
+				</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					on &rarr; Turn ON.<br>
+					off &rarr; Turn OFF.
+				</td>
+			</tr>
+		</table>
+
+		<p>Some examples:</p>
+
+		<p>Turn OFF the 5V Out port (if only one YKUSH3 board is attached).</p>
+
+		<p class="command_line">ykushcmd ykush3 -off</p>
+
+		<p>Turn ON the 5V Out port of the board with serial number YKB00001.</p>
+
+		<p class="command_line">ykushcmd ykush3 -s YKB00001 -on</p>
+
+		
+		
+
+		<!-- GPIO control configuration commands -->
+		<h2 id="gpio_ctrl_config_commands">GPIO control configuration commands</h2>
+		<p>
+			Commands to enable/disable the ability to control the downstream ports using the inputs of the board GPIO pins.
+		</p>
+
+		<p>Structure of commands:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] --gpio &lt;action&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. This is an optional parameter
+					useful for when multiple boards are attached to the 
+					same host.
+				</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					enable &rarr; Enable the GPIO control of the downstream ports.<br>
+					disable &rarr; Disable the GPIO control of the downstream ports.
+				</td>
+			</tr>			
+		</table>
+
+		
+		
+		
+		
+		
+		<!-- GPIO Read/Write commands -->
+		<h2 id="gpio_read_write_commands">GPIO Read/Write commands</h2>
+		<p>
+			Commands to read/write the logical value of the GPIO pins.
+		</p>
+		<p>Structure of commands:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -&lt;action&gt; &lt;gpio&gt; &lt;value&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. This is an optional parameter
+					useful for when multiple boards are attached to the 
+					same host.
+				</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					w &rarr; Write to GPIO.<br>
+					r &rarr; Read from GPIO.
+				</td>
+			</tr>
+			<tr>
+				<td>gpio</td>
+				<td>
+					1 &rarr; GPIO 1.<br>
+					2 &rarr; GPIO 2.<br>
+					3 &rarr; GPIO 3.<br>
+				</td>
+			</tr>
+			<tr>
+				<td>value</td>
+				<td>
+					1 &rarr; Set GPIO to High.<br>
+					0 &rarr; Set GPIO to Low.
+				</td>
+			</tr>
+		</table>
+		
+		<p>Some examples:</p>
+
+		<p>Set GPIO 2 to high (1).</p>
+
+		<p class="command_line">ykushcmd ykush3 -w 2 1<p>
+
+		<p>Read the GPIO 2.<p>
+
+		<p class="command_line">ykushcmd ykush3 -r 2<p>
+                      
+		<p>NOTE: For Windows operating systems add the .exe extension when calling the ykushcmd command.</p>
+		
+		
+		
+		
+		
+		<!-- 4. Downstream ports configuration commands -->
+		<h2 id="ykush3_downstream_port_config_commands">Downstream ports configuration commands</h2>
+		<p>
+			Sets the default state of the downstream ports on power-on.
+		</p>
+		<p>Structure of commands:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -c &lt;port&gt; &lt;value&gt;</p>
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. This is an optional parameter
+					useful for when multiple boards are attached to the 
+					same host.
+				</td>
+			</tr>
+			<tr>
+				<td>port</td>
+				<td>1, 2 or 3.</td>
+			</tr>
+			<tr>
+				<td>value</td>
+				<td>
+					1 &rarr; ON state.
+					0 &rarr; OFF state.
+				</td>
+			</tr>
+		</table>
+		
+		<p>Some examples:</p>
+
+		<p>Set default state of downstream port 2 at power-on to ON.</p>
+		<p class="command_line">ykushcmd ykush3 -c 2 1<p>
+
+		<p>Set default state of downstream port 2 at power-on to OFF.</p>
+		<p class="command_line">ykushcmd ykush3 -c 2 0<p>
+
+		
+		
+		
+		
+		<!-- I2C control interface commands -->
+		<h2 id="ykush3_i2c_commands">I2C interface commands</h2>
+		<p>
+			YKUSH3 boards have an I2C interface alowing them to be connected to a
+			I2C bus and communicate to other devices in that bus.
+			The board can be configured in I2C slave mode, for other I2C devices to be
+			able to control the switching of the downstream ports, or in master mode
+			to be able to control other I2C devices.
+		</p>
+		<p>
+			To configure the board to operate I2C in slave mode and be controlable
+			by a master I2C device the user must enable the 
+			<i>i2C control interface</i> feature.
+		</p>
+		<p>
+			When the board is configure with I2C in master mode it provides a
+			USB to I2C gateway funcionality.
+			With this USB to I2C gateway functionality a user can communicate with
+			a slave I2C device, connected in the same I2C bus than YKUSH3 board,
+			from the command line of the PC using <i>ykushcmd</i> application.
+		</p>
+
+		<h3>Command usage</h3>
+		<p class="command_line">
+			ykushcmd ykush3 [OPTION]... 
+		</p>
+		<p>The following options are available:</p>
+		<table>
+			<tr>
+				<td>--i2c-enable-control</td>
+				<td>
+					Enables I2C as a control interface.
+					This will configure I2C in slave mode.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-disable-control</td>
+				<td>
+					Disables I2C as a control interface.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-enable-gateway</td>
+				<td>
+					Enables USB to I2C gateway functionality.
+					This will configure I2C in master mode.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-disable-gateway</td>
+				<td>
+					Disables USB to I2C gateway functionality.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-set-address &lt;address&gt;</td>
+				<td>
+					Set the board I2C address. 
+					The <i>address</i> should be in hexadecimal representation
+					with a <b>0x</b> prefix.
+					Example: 0x1F for 7-bit address 0011111.
+					This address is only used when the board is configured
+					with I2C in slave mode.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-write &lt;dev_address&gt; &lt;num_bytes&gt; &lt;byte1&gt;...</td>
+				<td>
+					Writes <i>num_bytes</i> (byte1...) to the I2C
+					slave device with address <i>dev_address</i>.
+					<i>dev_address</i> is in hexadecimal representation 
+					with a <b>0x</b> prefix.
+					<i>num_bytes</i> is in decimal representation.
+					<i>byte1...byteN</i> is in hexadecimal representation 
+					with a <b>0x</b> prefix. 
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-read &lt;dev_address&gt; &lt;num_bytes&gt;</td>
+				<td>
+					Reads <i>num_bytes</i>from the I2C
+					slave device with address <i>dev_address</i>.  
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-usb-serial &lt;serial_number&gt;</td>
+				<td>
+					Serial number of the YKUSH3 board. 
+					This is an optional parameter useful for when multiple 
+					YKUSH3 boards are attached to the same host. 
+				</td>
+			</tr>
+		</table>
+
+		
+		<h3>Examples</h3>
+
+		<p>Enable I2C control interface:</p>
+		<p class="command_line">ykushcmd ykush3 --i2c-enable-control<p>
+
+		<p>Set the board I2C address to 0x1A:</p>
+		<p class="command_line">ykushcmd ykush3 --i2c-set-address 0x1A<p>
+		
+		<p>Write bytes 0x12 0xAA 0x2F to I2C device with address 0x07:</p>
+		<p class="command_line">ykushcmd ykush3 --i2c-write 0x07 3 0x12 0xAA 0x2F<p>
+		
+		
+		
+		
+		<!-- Reset command -->
+		<h2 id="ykush3_reset_commands">Reset command</h2>
+		<p>
+			Triggers a reset of the board.
+		</p>
+		<p>Structure of command:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] --reset</p>
+		
+		<p>Examples:</p>
+
+		<p>Reset the attached board.</p>
+		<p class="command_line">ykushcmd ykush3 --reset<p>
+		
+		<p>Reset the attached board with serial number YK00001.</p>
+		<p class="command_line">ykushcmd ykush3 -s YK00001 --reset<p>
+		
+		
+		
+		
+		<!-- Versioning commands -->
+		<h2 id="ykush3_versioning_commands">Versioning commands</h2>
+		<p>
+			Get version of the firmware loaded in the board.
+		</p>
+		<h3>Command usage</h3>
+		<p class="command_line">
+			ykushcmd ykush3 [OPTION]
+		</p>
+		<p>The following options are available:</p>
+		<table>
+			<tr>
+				<td>--version-bootloader</td>
+				<td>Get bootloader version from board.</td>
+			</tr>
+			<tr>
+				<td>--version-firmware</td>
+				<td>Get firmware version from board.</td>
+			</tr>
+		</table>
+
+		<h3>Examples</h3>
+
+		<p>Get bootloader version:</p>
+		<p class="command_line">ykushcmd ykush3 --version-bootloader<p>
+		
+		<p>Get firmware version:</p>
+		<p class="command_line">ykushcmd ykush3 --version-firmware<p>
+
+	</div>
+	
+	
+	<!--
+		#ykush3_man_important_links
+	-->
+	<h1 id="ykush3_man_important_links">Important links</h1>
+	<div>
+		<ul>
+			<li><a class="inlineLink" href="https://www.yepkit.com/product/300110/YKUSH3" target="_blank">YKUSH3 product page</a></li>
+			<li><a class="inlineLink" href="https://www.yepkit.com/learn/tutorial/setup_guide/ykush3-i2c-control-interface" target="_blank">How to control the YKUSH3 boards using the I2C interface</a></li>
+		</ul>
+	</div>
+	
+	
+	
+</div>
+

+ 173 - 0
doc/reference-manual-ykushcmd/ykushcmd-reference-ykush.html

@@ -0,0 +1,173 @@
+<h1>YKUSH Board Commands</h1>
+
+<div class="reference_page_toc">
+        <ul>
+                <li><a href="#command_overview">Command overview</a></li>
+                <li><a href="#list_attached_example">List attached boards</a></li>
+                <li><a href="#switch_command_example">Downstream port On/Off switching</a></li>
+                <li><a href="#switch_state_command_example">Port switching state</a></li>      
+        </ul>
+</div>
+
+
+
+
+<h2 id="command_overview">Command overview</h2>
+<p>YKUSH board commands have the following structure.</p>
+<p class="command_line">ykushcmd ykush [-s serial_number] [OPTION]</p>
+<p>Where:</p>
+<table cellpadding="10">
+        <tr>
+                <td width="30%" valign="top">-s serial_number</td>
+                <td>
+                        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.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-l</td>
+                <td>
+                        List attached YKUSH boards.
+                        The serial number of each board attached to the host will be displayed.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-d 1|2|3|a</td>
+                <td>
+                        Power Down/Off downstream port with the number provided.
+                        If <i>a</i> is provided as the port number then all ports will be switched.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-u 1|2|3|a</td>
+                <td>
+                        Power Up/On downstream port with the number provided.
+                        If <i>a</i> is provided as the port number then all ports will be switched.
+                </td>
+        </tr>
+        <tr>
+                <td>-g 1|2|3</td>
+                <td>
+                        Get state of downstream port.
+                </td>
+        </tr>
+</table>
+
+
+
+<h2 id="list_attached_example">List attached boards</h2>
+<p>
+        The <b>[-l]</b> option is used to list all attached YKUSH boards.
+        All YKUSH board have unique serial numbers which are displayed when this option is used.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+                
+
+
+<h2 id="switch_command_example">Downstream port On/Off switching</h2>
+<p>
+        When only one YKUSH board is attached to the host the <b>[-s serial_number]</b> option is not required.
+        Bellow are some examples.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+
+<p>
+        If more than one YKUSH board is attached to the host the <b>[-s serial_number]</b> option should be used.
+        Bellow are some examples.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+
+
+<h2 id="switch_state_command_example">Port switching state</h2>
+<p>
+        The current switching state of each downstream port can be fetched from the YKUSH board using the <b>[-g 1|2|3]</b> option.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>

+ 243 - 0
doc/reference-manual-ykushcmd/ykushcmd-reference-ykush3.html

@@ -0,0 +1,243 @@
+<h1>YKUSH3 Board Commands</h1>
+
+<div class="reference_page_toc">
+        <ul>
+                <li><a href="#command_overview">Command overview</a></li>
+                <li><a href="#list_attached_example">List attached boards</a></li>
+                <li><a href="#switch_command_example">Downstream port On/Off switching</a></li>
+                <li><a href="#switch_state_command_example">Port switching state</a></li>  
+                <li><a href="#gpio_read_write_command_example">GPIO read/write</a></li>
+                <li><a href="#reset_command_example">Reset/reboot board</a></li>    
+        </ul>
+</div>
+
+
+
+<h2 id="command_overview">Command overview</h2>
+<p>YKUSH3 board commands have the following structure.</p>
+<p class="command_line">ykushcmd ykush3 [-s serial_number] [OPTION]</p>
+<p>Where:</p>
+<table cellpadding="10">
+        <tr>
+                <td width="30%" valign="top">-s serial_number</td>
+                <td>
+                        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.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-l</td>
+                <td>
+                        List attached YKUSH3 boards.
+                        The serial number of each board attached to the host will be displayed.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-d 1|2|3|a</td>
+                <td>
+                        Power Down/Off downstream port with the number provided.
+                        If <i>a</i> is provided as the port number then all ports will be switched.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-u 1|2|3|a</td>
+                <td>
+                        Power Up/On downstream port with the number provided.
+                        If <i>a</i> is provided as the port number then all ports will be switched.
+                </td>
+        </tr>
+        <tr>
+                <td>-g 1|2|3</td>
+                <td>
+                        Get port state.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-on</td>
+                <td>
+                        Switch On the 5V output power port.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-off</td>
+                <td>
+                        Switch Off the 5V output power port.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-r 1|2|3</td>
+                <td>
+                        Read GPIO with the number provided (1, 2 or 3).
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">-w 1|2|3 0|1</td>
+                <td>
+                        Write to the GPIO with the number provided (1, 2 or 3).
+                        Writing a value of <b>1</b> or <b>0</b> will drive the GPIO to logical <b>high</b> or <b>low</b>, respectively.
+                </td>
+        </tr>
+        <tr>
+                <td valign="top">--reset</td>
+                <td>
+                        Resets (reboot) the YKUSH3 board.
+                </td>
+        </tr>
+</table>
+
+
+
+<h2 id="list_attached_example">List attached boards</h2>
+<p>
+        The <b>[-l]</b> option is used to list all attached YKUSH3 boards.
+        All YKUSH board have unique serial numbers which are displayed when this option is used.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+                
+
+
+<h2 id="switch_command_example">Downstream port On/Off switching</h2>
+<p>
+        When only one YKUSH3 board is attached to the host the <b>[-s serial_number]</b> option is not required.
+        Bellow are some examples.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+
+<p>
+        If more than one YKUSH3 board is attached to the host the <b>[-s serial_number]</b> option should be used.
+        Bellow are some examples.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+
+
+<h2 id="switch_state_command_example">Port switching state</h2>
+<p>
+        The current switching state of each downstream port can be fetched from the YKUSH3 board using the <b>[-g 1|2|3]</b> option.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+
+
+
+<h2 id="gpio_read_write_command_example">GPIO read/write</h2>
+<p>
+        The <b>[-r|-w]</b> option is used to read from or write to a GPIO.
+</p>
+<pre>
+<code class="language-bash">
+#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
+</code>
+</pre>
+
+
+<h2 id="reset_command_example">Reset/reboot board</h2>
+<p>
+        The <b>[--reset]</b> option is used to reset (reboot) the board.
+</p>
+<pre>
+<code class="language-bash">
+#Example of resetting YKUSH3
+$ ykushcmd ykush3 --reset
+</code>
+</pre>

+ 145 - 0
doc/reference-manual-ykushcmd/ykushcmd-reference-ykushxs.html

@@ -0,0 +1,145 @@
+<h1>YKUSHXS Board Commands</h1>
+
+<div class="reference_page_toc">
+        <ul>
+                <li><a href="#command_overview">Command overview</a></li>
+                <li><a href="#list_attached_example">List attached boards</a></li>
+                <li><a href="#switch_command_example">Downstream port On/Off switching</a></li>
+                <li><a href="#switch_state_command_example">Port switching state</a></li>      
+        </ul>
+</div>
+
+
+
+
+<h2 id="command_overview">Command overview</h2>
+<p>YKUSHXS board commands have the following structure.</p>
+<p class="command_line">ykushcmd ykushxs [-s serial_number] [OPTION]</p>
+<p>Where:</p>
+<table cellpadding="10">
+        <tr>
+                <td width="30%" valign="top">-s serial_number</td>
+                <td>
+                        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.
+                </td>
+        </tr>
+
+        <tr>
+                <td valign="top">-l</td>
+                <td>
+                        List attached YKUSHXS boards.
+                        The serial number of each board attached to the host will be displayed.
+                </td>
+        </tr>
+        <tr>
+                <td>-d</td>
+                <td>
+                        Power Down/Off the downstream port.
+                </td>
+        </tr>
+        <tr>
+                <td>-u</td>
+                <td>
+                        Power Up/On the downstream port.
+                </td>
+        </tr>
+        <tr>
+                <td>-g</td>
+                <td>
+                        Get downstream port state.
+                </td>
+        </tr>
+</table>
+
+
+
+<h2 id="list_attached_example">List attached boards</h2>
+<p>
+        The <b>[-l]</b> option is used to list all attached YKUSHXS boards.
+        All YKUSH board have unique serial numbers which are displayed when this option is used.
+</p>
+<pre>
+<code class="language-bash">
+#list the serial number for each of the attached YKUSHXS boards
+$ ykushcmd ykushxs -l
+
+Attached YKUSHXS Boards:
+1. Board found with serial number: YK17125
+2. Board found with serial number: YK21493
+</code>
+</pre>
+                
+
+
+<h2 id="switch_command_example">Downstream port On/Off switching</h2>
+<p>
+        When only one YKUSHXS board is attached to the host the <b>[-s serial_number]</b> option is not required.
+        Bellow are some examples.
+</p>
+<pre>
+<code class="language-bash">
+#power-down the downstream port
+$ ykushcmd ykushxs -d
+
+#power-up the downstream port 
+$ ykushcmd ykushxs -u
+</code>
+</pre>
+
+<p>
+        If more than one YKUSHXS board is attached to the host the <b>[-s serial_number]</b> option should be used.
+        Bellow are some examples.
+</p>
+<pre>
+<code class="language-bash">
+#list the serial number for each of the attached YKUSHXS boards
+$ ykushcmd ykushxs -l
+
+Attached YKUSHXS Boards:
+1. Board found with serial number: YK17125
+2. Board found with serial number: YK21493
+
+#power-down the downstream port of the board with serial number YK17125
+$ ykushcmd ykushxs -s YK17125 -d
+</code>
+</pre>
+
+
+<h2 id="switch_state_command_example">Port switching state</h2>
+<p>
+        The current switching state of each downstream port can be fetched from the YKUSH board using the <b>[-g 1|2|3]</b> option.
+</p>
+<pre>
+<code class="language-bash">
+#State of the downstream port
+$ ykushcmd ykushxs -g
+
+Downstream port is ON
+
+#power-down the downstream port
+$ ykushcmd ykushxs -d
+
+#State of downstream port
+$ ykushcmd ykushxs -g
+
+Downstream port is OFF
+
+#list the serial number for each of the attached YKUSHXS boards
+$ ykushcmd ykushxs -l
+
+Attached YKUSHXS Boards:
+1. Board found with serial number: YK17125
+2. Board found with serial number: YK21493
+
+#State of the downstream port for the board with serial number YK17125
+$ ykushcmd ykushxs -s YK17125 -g
+
+Downstream port is OFF
+
+#power-up the downstream port of the board with serial number YK17125
+$ ykushcmd ykushxs -s YK17125 -u
+</code>
+</pre>

+ 136 - 0
doc/ykush3_help.txt

@@ -0,0 +1,136 @@
+--------------------------------------------------------------------------
+
+            YKUSH 3 Command Appplication Help
+
+--------------------------------------------------------------------------
+
+Legend:
+<> Variable 
+[] Optional parameter
+>  Command line
+
+
+
+
+1. Downstream port commands
+---------------------------
+
+The structure of the downstream port commands is as follows.
+
+ykushcmd ykush3 [-s <serial_number>] -<action> <port>
+
+Where:
+
+serial_number               Serial number of a board. This is an optional parameter
+                            useful for when multiple boards are attached to the 
+                            same host.
+                            
+action                      u -> Turn ON/UP the downstream.
+                            d -> Turn OFF/DOWN the downstream.
+                            g -> Get downstream port status.
+                            l -> List boards attached.
+                            
+port                        1, 2 or 3.
+
+
+
+Some examples:
+
+Turn OFF the downstream port 1 (if only one YKUSH3 board is attached).
+
+> ykushcmd ykush3 -d 1
+
+Turn OFF the downstream port 1 of the board with serial number YKB00001.
+
+> ykushcmd ykush3 -s YKB00001 -d 1
+
+Get status of downstream port 2
+
+> ykushcmd ykush3 -g 2
+
+List attached YKUSH3 boards
+
+> ykushcmd ykush3 -l
+
+
+
+
+
+2. 5V output switched port control commands
+-------------------------------------------
+
+The structure of commands.
+
+ykushcmd ykush3 [-s <serial_number>] -<action>
+
+Where:
+
+serial_number               Serial number of a board. This is an optional parameter
+                            useful for when multiple boards are attached to the 
+                            same host.
+                            
+action                      on -> Turn ON.
+                            off -> Turn OFF.
+                            
+
+
+Some examples:
+
+Turn OFF the 5V Out port (if only one YKUSH3 board is attached).
+
+> ykushcmd ykush3 -off
+
+Turn ON the 5V Out port of the board with serial number YKB00001.
+
+> ykushcmd ykush3 -s YKB00001 -on
+
+
+
+
+3. IO control commands
+----------------------
+
+Structure of commands.
+
+ykushcmd ykush3 [-s <serial_numer>] -<action> <port> [<value>]
+
+Where:
+
+serial_number               Serial number of a board. This is an optional parameter
+                            useful for when multiple boards are attached to the 
+                            same host.
+                            
+action                      w -> Write.
+                            r -> Turn OFF. When Read action the command will return
+                            the read value (1/0). Also in this option, the
+                            <value> parameter is not required.
+            
+port                        1, 2 or 3.
+                            
+value                       1 -> Set the I/O to digital High Level
+                            0 -> Set the I/O to digital Low Level
+                            
+
+
+Some examples:
+
+Set GPIO 2 to high (1).
+
+> ykushcmd ykush3 -w 2 1
+
+Read the GPIO 2.
+
+> ykushcmd ykush3 -r 2
+
+
+                                        
+NOTE: For Windows operating systems add the .exe extension when calling the ykushcmd command.
+
+
+
+
+
+
+
+
+

+ 49 - 0
doc/ykushxs_help.txt

@@ -0,0 +1,49 @@
+--------------------------------------------------------------------------
+
+            YKUSH XS Command Appplication Help
+
+--------------------------------------------------------------------------
+
+
+Available Commands:
+-------------------
+
+ykushcmd ykushxs -d                     Turns DOWN the downstream port
+
+
+ykushcmd ykushxs -u                     Turns UP the downstream port
+
+
+ykushcmd ykushxs -g                     Obtains the switching status of
+                                        the downstream port
+                                        
+
+ykushcmd ykushxs -l                     Lists all currently attached
+                                        YKUSH XS boards
+                                        
+
+ykushcmd ykushxs -s serial_number -d    Turns DOWN the downstream port for
+                                        the board with the specified
+                                        serial number
+                                        
+
+ykushcmd ykushxs -s serial_number -u    Turns UP the downstream port for
+                                        the board with the specified
+                                        serial number
+                                        
+
+ykushcmd ykushxs -s serial_number -g    Obtains the switching status of
+                                        port for the board with the
+                                        specified serial number
+
+                                        
+NOTE: For Windows operating systems add the .exe extension when calling the ykushcmd command. For example for disconnecting the downstream port the command is as follows.
+
+ykushcmd.exe ykushxs -d
+
+
+
+
+
+
+

+ 0 - 5
install.sh

@@ -3,10 +3,5 @@
 echo installing ykush command...
 sudo cp -f bin/ykushcmd /usr/bin
 
-echo installing shared libraries...
-sudo cp -f ykushcmd/linux/libhidapi-hidraw.so /usr/lib/libhidapi-hidraw.so
-sudo cp -f ykushcmd/linux/libhidapi-hidraw.so /usr/lib/libhidapi-hidraw.so.0
 
-sudo cp -f ykushcmd/linux/libhidapi-libusb.so /usr/lib/libhidapi-libusb.so
-sudo cp -f ykushcmd/linux/libhidapi-libusb.so /usr/lib/libhidapi-libusb.so.0
 

+ 435 - 0
learn/html/ykushcmd-reference-manual-ykush3.html

@@ -0,0 +1,435 @@
+<div class="reference_software_manual_version">
+	This manual page refers to software version <b>v1.2.0</b>.
+</div>
+
+<div class="reference_software_manual_index">
+	<ul>
+		<li><a href="#command_list">Command list</a></li>
+		<li><a href="#ykush3_man_important_links">Important links</a></li>
+		
+	</ul>
+</div>
+
+<div class="reference_software_manual_body">
+
+	<!-- 
+		COMMAND LIST 
+	-->
+	<h1 id="command_list">Command list</h1>
+	<div>
+		<ul>
+			<li><a href="#downstream_port_commands">Downstream port commands</a></li>
+			<li><a href="#5V_output_port_commands">5V output switched port control commands</a></li>
+			<li><a href="#gpio_ctrl_config_commands">GPIO control configuration commands</a></li>
+			<li><a href="#gpio_read_write_commands">GPIO Read/Write commands</a></li>
+			<li><a href="#ykush3_downstream_port_config_commands">Downstream ports configuration commands</a></li>
+			<li><a href="#ykush3_i2c_commands">I2C interface commands</a></li>
+			<li><a href="#ykush3_uart_commands">UART interface commands</a></li>
+			<li><a href="#ykush3_reset_commands">Reset command</a></li>
+			<li><a href="#ykush3_versioning_commands">Versioning commands</a></li>
+		</ul>
+	</div>
+	<div>
+		<p>Legend:</p>
+		<p>
+			&lt;&gt; Variable<br> 
+			[] Optional parameter<br>
+			&gt;  Command line
+		</p>
+	</div>
+	<div>
+		<!-- 1. Downstream port commands -->
+		<h2 id="downstream_port_commands">Downstream port commands</h2>
+		
+		<p>The structure of the downstream port commands is as follows.</p>
+
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -&lt;action&gt; &lt;port&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>Serial number of a board. This is an optional parameter useful for when multiple boards are attached to the same host.</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					u &rarr; Turn ON/UP the downstream<br>
+					d &rarr; Turn OFF/DOWN the downstream<br>
+					g &rarr; Get downstream port status<br>
+					l &rarr; List boards attached<br>
+				</td>
+			</tr>
+			<tr>
+				<td>port</td>
+				<td>1, 2 or 3.</td>
+			</tr>
+		</table>
+
+
+		<p>Some examples:</p>
+
+		<p>Turn OFF the downstream port 1 (if only one YKUSH3 board is attached).</p>
+
+		<p class="command_line">ykushcmd ykush3 -d 1<p>
+
+		<p>Turn OFF the downstream port 1 of the board with serial number YKB00001.</p>
+
+		<p class="command_line">ykushcmd ykush3 -s YKB00001 -d 1</p>
+
+		<p>Get status of downstream port 2</p>
+
+		<p class="command_line">ykushcmd ykush3 -g 2<p>
+
+		<p>List attached YKUSH3 boards</p>
+
+		<p class="command_line">ykushcmd ykush3 -l</p>
+		
+		
+		
+		<!-- 2. 5V output switched port control commands -->
+		<h2 id="5V_output_port_commands">5V output switched port control commands</h2>
+
+		<p>The structure of commands:</p>
+
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -&lt;action&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. 
+					This is an optional parameter useful for when multiple boards are attached to the same host.
+				</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					on &rarr; Turn ON.<br>
+					off &rarr; Turn OFF.
+				</td>
+			</tr>
+		</table>
+
+		<p>Some examples:</p>
+
+		<p>Turn OFF the 5V Out port (if only one YKUSH3 board is attached).</p>
+
+		<p class="command_line">ykushcmd ykush3 -off</p>
+
+		<p>Turn ON the 5V Out port of the board with serial number YKB00001.</p>
+
+		<p class="command_line">ykushcmd ykush3 -s YKB00001 -on</p>
+
+		
+		
+
+		<!-- GPIO control configuration commands -->
+		<h2 id="gpio_ctrl_config_commands">GPIO control configuration commands</h2>
+		<p>
+			Commands to enable/disable the ability to control the downstream ports using the inputs of the board GPIO pins.
+		</p>
+
+		<p>Structure of commands:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] --gpio &lt;action&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. This is an optional parameter
+					useful for when multiple boards are attached to the 
+					same host.
+				</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					enable &rarr; Enable the GPIO control of the downstream ports.<br>
+					disable &rarr; Disable the GPIO control of the downstream ports.
+				</td>
+			</tr>			
+		</table>
+
+		
+		
+		
+		
+		
+		<!-- GPIO Read/Write commands -->
+		<h2 id="gpio_read_write_commands">GPIO Read/Write commands</h2>
+		<p>
+			Commands to read/write the logical value of the GPIO pins.
+		</p>
+		<p>Structure of commands:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -&lt;action&gt; &lt;gpio&gt; &lt;value&gt;</p>
+
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. This is an optional parameter
+					useful for when multiple boards are attached to the 
+					same host.
+				</td>
+			</tr>
+			<tr>
+				<td>action</td>
+				<td>
+					w &rarr; Write to GPIO.<br>
+					r &rarr; Read from GPIO.
+				</td>
+			</tr>
+			<tr>
+				<td>gpio</td>
+				<td>
+					1 &rarr; GPIO 1.<br>
+					2 &rarr; GPIO 2.<br>
+					3 &rarr; GPIO 3.<br>
+				</td>
+			</tr>
+			<tr>
+				<td>value</td>
+				<td>
+					1 &rarr; Set GPIO to High.<br>
+					0 &rarr; Set GPIO to Low.
+				</td>
+			</tr>
+		</table>
+		
+		<p>Some examples:</p>
+
+		<p>Set GPIO 2 to high (1).</p>
+
+		<p class="command_line">ykushcmd ykush3 -w 2 1<p>
+
+		<p>Read the GPIO 2.<p>
+
+		<p class="command_line">ykushcmd ykush3 -r 2<p>
+                      
+		<p>NOTE: For Windows operating systems add the .exe extension when calling the ykushcmd command.</p>
+		
+		
+		
+		
+		
+		<!-- 4. Downstream ports configuration commands -->
+		<h2 id="ykush3_downstream_port_config_commands">Downstream ports configuration commands</h2>
+		<p>
+			Sets the default state of the downstream ports on power-on.
+		</p>
+		<p>Structure of commands:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] -c &lt;port&gt; &lt;value&gt;</p>
+		<p>Where:</p>
+		<table>
+			<tr>
+				<td>serial_number</td>
+				<td>
+					Serial number of a board. This is an optional parameter
+					useful for when multiple boards are attached to the 
+					same host.
+				</td>
+			</tr>
+			<tr>
+				<td>port</td>
+				<td>1, 2 or 3.</td>
+			</tr>
+			<tr>
+				<td>value</td>
+				<td>
+					1 &rarr; ON state.
+					0 &rarr; OFF state.
+				</td>
+			</tr>
+		</table>
+		
+		<p>Some examples:</p>
+
+		<p>Set default state of downstream port 2 at power-on to ON.</p>
+		<p class="command_line">ykushcmd ykush3 -c 2 1<p>
+
+		<p>Set default state of downstream port 2 at power-on to OFF.</p>
+		<p class="command_line">ykushcmd ykush3 -c 2 0<p>
+
+		
+		
+		
+		
+		<!-- I2C control interface commands -->
+		<h2 id="ykush3_i2c_commands">I2C interface commands</h2>
+		<p>
+			YKUSH3 boards have an I2C interface alowing them to be connected to a
+			I2C bus and communicate to other devices in that bus.
+			The board can be configured in I2C slave mode, for other I2C devices to be
+			able to control the switching of the downstream ports, or in master mode
+			to be able to control other I2C devices.
+		</p>
+		<p>
+			To configure the board to operate I2C in slave mode and be controlable
+			by a master I2C device the user must enable the 
+			<i>i2C control interface</i> feature.
+		</p>
+		<p>
+			When the board is configure with I2C in master mode it provides a
+			USB to I2C gateway funcionality.
+			With this USB to I2C gateway functionality a user can communicate with
+			a slave I2C device, connected in the same I2C bus than YKUSH3 board,
+			from the command line of the PC using <i>ykushcmd</i> application.
+		</p>
+
+		<h3>Command usage</h3>
+		<p class="command_line">
+			ykushcmd ykush3 [OPTION]... 
+		</p>
+		<p>The following options are available:</p>
+		<table>
+			<tr>
+				<td>--i2c-enable-control</td>
+				<td>
+					Enables I2C as a control interface.
+					This will configure I2C in slave mode.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-disable-control</td>
+				<td>
+					Disables I2C as a control interface.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-enable-gateway</td>
+				<td>
+					Enables USB to I2C gateway functionality.
+					This will configure I2C in master mode.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-disable-gateway</td>
+				<td>
+					Disables USB to I2C gateway functionality.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-set-address &lt;address&gt;</td>
+				<td>
+					Set the board I2C address. 
+					The <i>address</i> should be in hexadecimal representation
+					with a <b>0x</b> prefix.
+					Example: 0x1F for 7-bit address 0011111.
+					This address is only used when the board is configured
+					with I2C in slave mode.
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-write &lt;dev_address&gt; &lt;num_bytes&gt; &lt;byte1&gt;...</td>
+				<td>
+					Writes <i>num_bytes</i> (byte1...) to the I2C
+					slave device with address <i>dev_address</i>.
+					<i>dev_address</i> is in hexadecimal representation 
+					with a <b>0x</b> prefix.
+					<i>num_bytes</i> is in decimal representation.
+					<i>byte1...byteN</i> is in hexadecimal representation 
+					with a <b>0x</b> prefix. 
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-read &lt;dev_address&gt; &lt;num_bytes&gt;</td>
+				<td>
+					Reads <i>num_bytes</i>from the I2C
+					slave device with address <i>dev_address</i>.  
+				</td>
+			</tr>
+			<tr>
+				<td>--i2c-usb-serial &lt;serial_number&gt;</td>
+				<td>
+					Serial number of the YKUSH3 board. 
+					This is an optional parameter useful for when multiple 
+					YKUSH3 boards are attached to the same host. 
+				</td>
+			</tr>
+		</table>
+
+		
+		<h3>Examples</h3>
+
+		<p>Enable I2C control interface:</p>
+		<p class="command_line">ykushcmd ykush3 --i2c-enable-control<p>
+
+		<p>Set the board I2C address to 0x1A:</p>
+		<p class="command_line">ykushcmd ykush3 --i2c-set-address 0x1A<p>
+		
+		<p>Write bytes 0x12 0xAA 0x2F to I2C device with address 0x07:</p>
+		<p class="command_line">ykushcmd ykush3 --i2c-write 0x07 3 0x12 0xAA 0x2F<p>
+		
+		
+		
+		
+		<!-- Reset command -->
+		<h2 id="ykush3_reset_commands">Reset command</h2>
+		<p>
+			Triggers a reset of the board.
+		</p>
+		<p>Structure of command:</p>
+		<p class="command_line">ykushcmd ykush3 [-s &lt;serial_number&gt;] --reset</p>
+		
+		<p>Examples:</p>
+
+		<p>Reset the attached board.</p>
+		<p class="command_line">ykushcmd ykush3 --reset<p>
+		
+		<p>Reset the attached board with serial number YK00001.</p>
+		<p class="command_line">ykushcmd ykush3 -s YK00001 --reset<p>
+		
+		
+		
+		
+		<!-- Versioning commands -->
+		<h2 id="ykush3_versioning_commands">Versioning commands</h2>
+		<p>
+			Get version of the firmware loaded in the board.
+		</p>
+		<h3>Command usage</h3>
+		<p class="command_line">
+			ykushcmd ykush3 [OPTION]
+		</p>
+		<p>The following options are available:</p>
+		<table>
+			<tr>
+				<td>--version-bootloader</td>
+				<td>Get bootloader version from board.</td>
+			</tr>
+			<tr>
+				<td>--version-firmware</td>
+				<td>Get firmware version from board.</td>
+			</tr>
+		</table>
+
+		<h3>Examples</h3>
+
+		<p>Get bootloader version:</p>
+		<p class="command_line">ykushcmd ykush3 --version-bootloader<p>
+		
+		<p>Get firmware version:</p>
+		<p class="command_line">ykushcmd ykush3 --version-firmware<p>
+
+	</div>
+	
+	
+	<!--
+		#ykush3_man_important_links
+	-->
+	<h1 id="ykush3_man_important_links">Important links</h1>
+	<div>
+		<ul>
+			<li><a class="inlineLink" href="https://www.yepkit.com/product/300110/YKUSH3" target="_blank">YKUSH3 product page</a></li>
+			<li><a class="inlineLink" href="https://www.yepkit.com/learn/tutorial/setup_guide/ykush3-i2c-control-interface" target="_blank">How to control the YKUSH3 boards using the I2C interface</a></li>
+		</ul>
+	</div>
+	
+	
+	
+</div>
+

+ 116 - 0
src/commandParser.cpp

@@ -0,0 +1,116 @@
+/****************************************************************************
+ FileName:      commandParser.cpp
+ Dependencies:  See INCLUDES section
+ Compiler:      Visual Studio Community 2015
+ Company:       Yepkit, Lda.
+
+ Software License Agreement:
+
+ Copyright (c) 2015 Yepkit Lda
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+
+*****************************************************************************
+ File Description:
+
+    Change History:
+        Rev     Date            Description
+        ----    -----------     -----------------------------------------
+        1.0     2015-09-11      First Release
+
+
+ ****************************************************************************
+ *  Summary:
+ *      Main program function
+ *
+ *
+ *
+*****************************************************************************/
+
+
+// INCLUDES ---------------------------------------------------------------
+
+#include <cstdlib>
+#include <iostream>
+#include <stdio.h>
+
+#include "stdafx.h"
+#include "commandParser.h"
+#include <ykush.h>
+#include <ykushxs.h>
+#include <ykush_help.h>
+#include <ykush2.h>
+#include <ykush3.h>
+#include <string>
+
+
+extern unsigned int PRODUCT_ID;
+
+enum Board {
+	YKUSH,
+	YKUSHXS,
+	YKUSH2,
+	YKUSH3,
+};
+
+
+int commandParser(int argc, char** argv) 
+{	
+    	Help help(argv[0]);
+	std::string str_ykush ("ykush");
+	std::string str_ykush3 ("ykush3");
+	std::string str_ykush2 ("ykush2");
+	std::string str_ykushxs ("ykushxs");
+
+  	if ( argc <= 1) {
+        	help.print_all();
+		return 0;
+    	}
+
+	//Parse input options and define action
+	if( argc >= 2) {
+		if ( str_ykushxs.compare( argv[1]) == 0 ) {
+			//YKUSHXS
+			return ykushxs_cmd_parser(argc, argv);
+		} else if ( str_ykush2.compare( argv[1]) == 0 ) {
+			//YKUSH2
+			ykush2_cmd_parser(argc, argv);	//Not active yet.
+			return 0;
+		} else if ( str_ykush3.compare( argv[1]) == 0) {
+			//YKUSH3
+			return ykush3_cmd_parser(argc, argv);
+		} else if ( str_ykush.compare( argv[1]) == 0 ) {
+			//YKUSH
+			if ( argc >= 3 )
+				return ykush_cmd_parser(argc - 1 , &argv[1]);
+			else
+				help.print_all();
+			
+			return -1;
+		} else {
+			//YKUSH
+			return ykush_cmd_parser(argc, argv);
+		}
+	}
+	
+	return 0;
+}
+
+
+

+ 0 - 0
ykushcmd/commandParser.h


+ 160 - 0
src/help/ykush_help.cpp

@@ -0,0 +1,160 @@
+/*******************************************************************************
+Copyright 2019 Yepkit Lda (www.yepkit.com)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*******************************************************************************/
+
+#include "ykush_help.h"
+#include <iostream>
+
+#include <stdio.h>
+
+
+Help::Help(char *exec_name)
+{
+	app_name = exec_name;
+}
+
+void Help::print_version(void) 
+{
+	std::cout << "YKUSHCMD Version 1.2.5\n";
+}
+
+void Help::print_usage(void)
+{
+        std::cout << "Usage:\t" << app_name << " [board_name] [-s serial_number] [OPTION]...\n";
+	std::cout << "Control Yepkit YKUSH family boards.\n";
+}
+
+void Help::print_board_names(void)
+{
+	std::cout << "\nThe board_name specifies the board model being addressed.";
+	std::cout << "If no board_name is provided the board is assumed to be a YKUSH board (board_name = ykush).\n";
+	std::cout << "Board names:\n";
+	std::cout << " ykush\t\tYKUSH board.\n";
+	std::cout << " ykush3\t\tYKUSH3 board.\n";
+	std::cout << " ykushxs\tYKUSHXS board.\n";
+	std::cout << "The [board_name] must be provided for commands addressed for a specific board.\n";
+	std::cout << "For general or common commands, applicable to all board models, the [board_name] is to ommited from the command.\n";
+}
+
+void Help::print_common_options(void)
+{
+
+
+
+}
+
+void Help::print_ykush(void)
+{
+	std::cout << "\nYKUSH board options:\n";
+
+	std::cout << "-d 1|2|3|a                Power Down/Off downstream port with the number privided.\n";
+	std::cout << "                          If [a] is provided as the port number then all ports will be switched.\n";
+
+	std::cout << "-u 1|2|3|a                Power Up/On downstream port number downstream_number\n";
+
+	std::cout << "-s serial_number          Board serial number to wich the command is addressed.\n";
+	std::cout << "                          When multiple YKUSH boards are connected to a host, this option should be used\n";
+	std::cout << "                          to specify the board. If more than one board is connected and this option is not\n";
+	std::cout << "                          provided the command will be sent to the first board in the USB enumeration list.\n";
+
+	std::cout << "-l                        Lists the serial numbers of the YKUSH boards attached to the host.\n";
+
+	std::cout << "-g 1|2|3                  Switching state of a downstream port.\n";
+
+	std::cout << "-h                        Display help for YKUSH board specific commands.\n";
+}
+
+void Help::print_ykush2(void)
+{
+
+}
+
+void Help::print_ykush3(void)
+{
+	std::cout << "\nYKUSH3 board options:\n";
+
+	std::cout << "-d 1|2|3|a                Power Down/Off downstream port with the number privided.\n";
+	std::cout << "                          If [a] is provided as the port number then all ports will be switched.\n";
+
+	std::cout << "-u 1|2|3|a                Power Up/On downstream port number downstream_number\n";
+
+	std::cout << "-s serial_number          Board serial number to wich the command is addressed.\n";
+	std::cout << "                          When multiple YKUSH boards are connected to a host, this option should be used\n";
+	std::cout << "                          to specify the board. If more than one board is connected and this option is not\n";
+	std::cout << "                          provided the command will be sent to the first board in the USB enumeration list.\n";
+
+	std::cout << "-l                        Lists the serial numbers of the YKUSH boards attached to the host.\n";
+
+        std::cout << "-g 1|2|3                  Switching state of a downstream port.\n";
+        
+        std::cout << "-c <port-number> <config-value>       Configure the default state of a downstream port\n";
+        std::cout << "                                      (port-number=1|2|3|e) at power-on. The port number <e> refers to exteranl 5V port.\n";
+        std::cout << "                                      The default states are off (config-value=0), on (config-value=1)\n";
+        std::cout << "                                      and persistent (config-value=2).\n";
+
+	std::cout << "-on                       Switch On the 5V output power port.\n";
+	std::cout << "-off                      Switch Off the 5V output power port.\n";
+
+	std::cout << "-r 1|2|3                  Read GPIO with the number provided (1, 2 or 3).\n";
+	std::cout << "-w 1|2|3 0|1              Write to the GPIO with the number provided (1, 2 or 3).\n";
+	std::cout << "                          Writing a value of 1 or 0 will drive the GPIO to logical high or low, respectively.\n";
+
+        std::cout << "--gpio enable|disable     Enable / Disable GPIO control interface. Will become active on next reset/power-on.\n\n";
+
+	std::cout << "--reset                   Resets (reboot) the YKUSH3 board.\n";
+
+	std::cout << "-h                        Display help for YKUSH board specific commands.\n";
+
+        std::cout << "--bootloader-version      Board bootloader version.\n";
+        std::cout << "--firmware-version        Board firmware version.\n";
+        
+	std::cout << "--boot                    Enter bootloader mode for firmware update.\n";
+}
+
+void Help::print_ykushxs(void)
+{
+	std::cout << "\nYKUSHXS board options:\n";
+
+	std::cout << "-d                        Power Down/Off the downstream port.\n";
+
+	std::cout << "-u                        Power Up/On the downstream port\n";
+
+	std::cout << "-s serial_number          Board serial number to wich the command is addressed.\n";
+	std::cout << "                          When multiple YKUSHXS boards are connected to a host, this option should be used\n";
+	std::cout << "                          to specify the board. If more than one board is connected and this option is not\n";
+	std::cout << "                          provided the command will be sent to the first board in the USB enumeration list.\n";
+
+	std::cout << "-l                        Lists the serial numbers of the YKUSHXS boards attached to the host.\n";
+
+	std::cout << "-g                        Switching state of a downstream port.\n";
+
+	std::cout << "-h                        Display help for YKUSHXS board specific commands.\n";
+}
+
+
+void Help::print_all(void)
+{
+	print_version();
+	print_usage();
+	print_board_names();
+	print_ykush();
+	print_ykush2();
+	print_ykush3();
+	print_ykushxs();
+}
+
+
+
+

+ 49 - 0
src/help/ykush_help.h

@@ -0,0 +1,49 @@
+/*******************************************************************************
+Copyright 2017 Yepkit Lda (www.yepkit.com)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*******************************************************************************/
+
+
+
+#ifndef _YKUSHCMD_HELP_H_
+#define _YKUSHCMD_HELP_H_
+
+
+class Help
+{
+	public:
+
+		Help(char *exec_name);
+
+		void print_version(void);
+		void print_usage(void);
+		void print_board_names(void);
+		void print_common_options(void);
+		void print_ykush(void);
+		void print_ykush2(void);
+		void print_ykush3(void);
+		void print_ykushxs(void);
+		void print_all(void);
+
+	private:
+
+		char *app_name;
+};
+
+
+
+
+
+
+#endif

+ 0 - 0
ykushcmd/objs/placeholder


+ 0 - 0
ykushcmd/platformdefs.h


+ 0 - 0
ykushcmd/stdafx.cpp


+ 0 - 0
ykushcmd/stdafx.h


+ 0 - 0
ykushcmd/targetver.h


+ 67 - 0
src/tests/test_usbhid.cpp

@@ -0,0 +1,67 @@
+#include <usbhid.h>
+#include <iostream>
+#include <string>
+
+int main(int argc, char* argv[])
+{
+        UsbHid *usbhid = new UsbHid();
+        unsigned int pid = 0xF2F7;
+        unsigned int vid = 0x04D8;
+        libusb_device_handle *handle;
+        int i = 0;
+        std::string str2 = "YK21493";
+        unsigned char hid_report_out[65];
+        unsigned char hid_report_in[65];
+        char serialInput[] = "YK21493";
+        int res;
+    	
+        struct hid_device_info *devs, *cur_dev;
+		
+        std::cout << "Get attach devices serial numbers test...\n";
+	devs = usbhid->enumerate(vid, pid);
+	if (devs == NULL) 
+	{
+		if (handle == NULL)
+		{
+		// No HID devices found
+		return 0;
+		}
+	}
+
+	cur_dev = devs;
+	while (cur_dev) 
+	{
+                std::cout << cur_dev->serial_number_ascii << "\n";
+
+                std::string str1;
+                str1 = cur_dev->serial_number_ascii;
+                if ( str1.compare(str2) == 0 ) {
+                        std::cout << "MATCH\n";
+                }
+		//printf("\n%ls\n", cur_dev->serial_number);
+		cur_dev = cur_dev->next;
+		i++;
+	}
+
+        usbhid->free_enumeration(devs);
+
+
+
+        std::cout << "Send command test...\n";
+        //abrir device
+        res = usbhid->open(vid, pid, serialInput);
+        if (res < 0) {
+                 std::cout << "Unable to open device";
+                 return 0;