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