aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: ee9d061a46e1efe7081b411d06a6bd4b0159a4f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Archived. **Has license issues**. Read local and remote decoded CAN messages I want, append to a file, plot to a GUI with some controls. Need to be used with [mycan](https://git.flylightning.xyz/mycan/).

The software is licensed under GPL-3.0-or-later. But list.c and list.h contain source code I edited from book "C Primer Plus" Chapter17 practice problem 2 which contain codes from its example codes, and the author of "C Primer Plus" does not have a license for list.c and list.h, so the author of "C Primer Plus" has the copyright on list.c and list.h, so list.c and list.h can be considered non-free close souce proprietary code. **So there's a license issue because I use both non-free and free copyleft license codes together.**

build, install, and run
```sh
make
sudo make install
remote_plot
```

usage
```sh
# use default ssh destination and plot remote data
remote_plot
# use another ssh destination
remote_plot -d username@10.0.0.7
# plot local data
remote_plot -l
```

Raspberry pi (Debian 12 bookworm) needed pkgs:
- plplot-driver-cairo
- libgtk-4-dev
- libssh-dev
- libplplot-dev

Arch Linux needed pkgs:
- libssh
- gtk4
- aur/plplot

Infrastructure configs, some maybe included in pi_config dir
- I prefer manage infrastructure configs using my [cfg](https://git.flylightning.xyz/fsh/tree/sh/cfg) script, but that script is my personal project and I don't want to force people to use that, so I include those config files in this repo and I did not manage it with my cfg script on raspberry pi.
- raspberry pi
    - ~/.config/labwc/autostart autostart remote_plot locally
        - <https://wiki.archlinux.org/title/Labwc#Autostart>
    - /etc/wireguard/wg0.conf wireguard config
    - /etc/NetworkManager/system-connections/wg0.nmconnection, networkmanager wireguard config imported from wireguard config
    - /etc/modules-load.d/wireguard.conf autostart load wireguard kernel module, see <https://wiki.archlinux.org/title/Kernel_module#systemd>
    - /etc/nftables.conf nftables firewall configs
    - ~/.ssh/know_hosts remote plot default use ssh public key authentication so you need to add your ssh public key to this file or via something like `ssh-copy-id Spartan_Racing_Charger@10.0.0.9`
- server and laptop:
    - wireguard related configs
        - files in /etc/wireguard, see below
        - files in /etc/NetworkManager/system-connections
    - /etc/nftables.conf nftables firewall configs
        - server: <https://git.flylightning.xyz/config_local_arch/tree/etc/nftables.conf?h=ca>
        - laptop: <https://git.flylightning.xyz/config_local_arch/tree/etc/nftables.conf?h=master>
- Reboot or restart/reload the services maybe needed for some configurations to work.

wireguard laptop configuration
```
# https://wiki.archlinux.org/title/WireGuard
# https://github.com/teddysun/across/blob/master/wireguard.sh
[Interface]
Address = 10.0.0.1/24, fdc9:281f:04d7:9ee9::1/64
PrivateKey = <secret>

[Peer]
PublicKey = <secret>
PresharedKey = <secret>
Endpoint = ca.flylightning.xyz:49432
AllowedIPs = 10.0.0.5/32, fdc9:281f:04d7:9ee9::5/128, 10.0.0.9/32, fdc9:281f:04d7:9ee9::9/128
PersistentKeepalive = 25
```

wireguard server configuration
```
[Interface]
Address = 10.0.0.5/24, fdc9:281f:04d7:9ee9::5/64
ListenPort = 49432
PrivateKey = <secret>

[Peer]
PublicKey = <secret>
PresharedKey = <secret>
AllowedIPs = 10.0.0.1/32, fdc9:281f:04d7:9ee9::1/128

[Peer]
PublicKey = <secret>
PresharedKey = <secret>
AllowedIPs = 10.0.0.9/32, fdc9:281f:04d7:9ee9::9/128
```

wireguard raspberry pi configuration (/etc/wireguard/wg0.conf)
```
[Interface]
Address = 10.0.0.9/24, fdc9:281f:04d7:9ee9::9/64
PrivateKey = <secret>

[Peer]
PublicKey = <secret>
PresharedKey = <secret>
Endpoint = ca.flylightning.xyz:49432
AllowedIPs = 10.0.0.5/32, fdc9:281f:04d7:9ee9::5/128, 10.0.0.1/32, fdc9:281f:04d7:9ee9::1/128
PersistentKeepalive = 25
```

remote_plot future improvements
- **Rewrite linked list list.c and list.h code or use a library so there's no license issues**
- Line plot
- Use a slider for time
- Time in current timezone
- Show data number on plot
- Webui with rest API
- Save little to RAM, read from file mostly
- Server side record data
- Better network hole punching
- Better UI
- Specify to plot last how many last seconds
- Async read remote data
- Plot average data in a time period to use less CPU
- Scroll-able plots
- Show cell name for max min data
- Better way to manage infrastructure code
- More touch screen friendly
- More platform independent
- Show min/avg/max in a table
- Better error checks and handling

On raspberry pi, I saved some temporary files I used to work on like git repos in  ~/test. Those files can be cleaned if you want.