Update README.md
authorPeng Li <seudut@gmail.com>
Mon, 25 Jun 2018 11:43:34 +0000 (19:43 +0800)
committerPeng Li <seudut@gmail.com>
Mon, 25 Jun 2018 11:43:34 +0000 (19:43 +0800)
README.md

index 6618ee1..e14e5cd 100644 (file)
--- a/README.md
+++ b/README.md
@@ -8,27 +8,39 @@
     - run `./install.sh` to install the daemon and service file
 
 ## Usage
-To connect to remote embedded device, your should know the device's MAC address.
 
-1. run `./sztool -i 2acdeb93b285`
+### list all connected device
 
-where `2acdeb93b285` is the MAC address of rpdzkj board, which you want to
-connect. 
+`./sztool list`
 
-2. If it succeed, it will return the forwarding port on `autossh.suanzi.ai`
+The output, 
 
-here is a sample
 ```
-debian@[~/project/remote-ssh]>> ./sztool -i 2acdeb93b285
+debian@[~/project/remote-ssh]>> ./sztool list                                                                                                                                                                                 
+Mac:  080027a6f8dc
 Connected with result code 0
-2acdeb93b285-response 32171
-port is 32171
-run ssh debug@autossh.suanzi.ai -p 32171 to connect to  2acdeb93b285 device
+Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'list', 'data': 'OK'}
+list
+2acdeb93b285 OK
+timeout
 ```
 
-3. run `ssh debug@autossh.suanzi.ai -p 32171`, then you can ssh to remote
-   device. The password is 'suanzikeji', create in file `add-user.sh`
+### Connect to the device
 
+1. Run `./sztool connect 2acdeb93b285`
+
+The output
+
+```
+debian@[~/project/remote-ssh]>> ./sztool connect 2acdeb93b285                                                                                                                                                                 
+Mac:  080027a6f8dc
+Connected with result code 0
+Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'ssh', 'data': 32176}
+ssh
+run "ssh debug@autossh.suanzi.ai -p 32176" to connect to device (2acdeb93b285)
+```
+
+2. Run `ssh debug@autossh.suanzi.ai -p 32176`, to ssh to remote device, password is 'suanzikeji', create in file `add-user.sh`
 
 ## Note
 - After the port is generated, the ssh session alive time is 5 min (defined by ALIVE_TIME in suanzi-support).