format the output
[remote-debug.git] / README.md
1
2 1. suanzi-support: a MQTT client, is a daemon running on remote embedded devices for remote debugging through ssh
3 2. sztool : a local tool, help to get the forwarding port to be used to connect to remote device
4
5 ## Install
6 - On embedded device
7     - run `./add-user.sh` to create a user, used for remote ssh, named debug, and its password is suanzikeji 
8     - run `./install.sh` to install the daemon and service file
9
10 ## Usage
11
12 ### list all connected device
13
14 `./sztool list`
15
16 The output, 
17
18 ```
19 debian@[~/project/remote-ssh]>> ./sztool list                                                                                                                                                                                 
20 Mac:  080027a6f8dc
21 Connected with result code 0
22 Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'list', 'data': 'OK'}
23 list
24 2acdeb93b285 OK
25 timeout
26 ```
27
28 ### Connect to the device
29
30 1. Run `./sztool connect 2acdeb93b285`
31
32 The output
33
34 ```
35 debian@[~/project/remote-ssh]>> ./sztool connect 2acdeb93b285                                                                                                                                                                 
36 Mac:  080027a6f8dc
37 Connected with result code 0
38 Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'ssh', 'data': 32176}
39 ssh
40 run "ssh debug@autossh.suanzi.ai -p 32176" to connect to device (2acdeb93b285)
41 ```
42
43 2. Run `ssh debug@autossh.suanzi.ai -p 32176`, to ssh to remote device, password is 'suanzikeji', create in file `add-user.sh`
44
45 ## Note
46 - After the port is generated, the ssh session alive time is 5 min (defined by ALIVE_TIME in suanzi-support). 
47 It means after you get the forwarding port, but not run ssh to connect in 5 minutes. this ssh session will terminate.