Fix bug - sometime ssh forwarding connection cannot establish when cpu is in hight...
[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 - On local machine
11     - run `pip install paho-mqtt`
12
13 ## Usage
14
15 ### list all connected device
16
17 `./sztool list`
18
19 The output, 
20
21 ```
22 debian@[~/project/remote-ssh]>> ./sztool list                                                                                                                                                                                 
23 Mac:  080027a6f8dc
24 Connected with result code 0
25 Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'list', 'data': 'OK'}
26 list
27 2acdeb93b285 OK
28 timeout
29 ```
30
31 ### Connect to the device
32
33 1. Run `./sztool connect 2acdeb93b285`
34
35 The output
36
37
38 ```
39 debian@[~/project/remote-ssh]>> ./sztool list                                                                                                                                                                                  
40 Mac:  080027a6f8dc
41
42 Found 3 connected devices:
43 Connected with result code 0
44
45  Device ID              Data
46 ------------------------------
47 00044b8d6310            OK
48 502b73d42c31            OK
49 b0f1ec7a62ce            OK
50 ```
51
52 ```
53 debian@[~/project/remote-ssh]>> ./sztool connect 2acdeb93b285                                                                                                                                                                 
54 Mac:  080027a6f8dc
55 Connected with result code 0
56 Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'ssh', 'data': 32176}
57 ssh
58 run "ssh debug@autossh.suanzi.ai -p 32176" to connect to device (2acdeb93b285)
59 ```
60
61 2. Run `ssh debug@autossh.suanzi.ai -p 32176`, to ssh to remote device, password is 'suanzikeji', create in file `add-user.sh`
62
63 ## Note
64 - After the port is generated, the ssh session alive time is 5 min (defined by ALIVE_TIME in suanzi-support). 
65 It means after you get the forwarding port, but not run ssh to connect in 5 minutes. this ssh session will terminate.