jetson-stats 2.0.0__tar.gz → 2.0.0.dev4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/LICENSE +0 -0
  2. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/MANIFEST.in +0 -0
  3. {jetson-stats-2.0.0/jetson_stats.egg-info → jetson-stats-2.0.0.dev4}/PKG-INFO +16 -28
  4. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/README.md +15 -27
  5. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/docs/Makefile +0 -0
  6. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/docs/make.bat +0 -0
  7. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/docs/source/conf.py +0 -0
  8. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/docs/source/index.rst +0 -0
  9. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/docs/source/jtop.rst +0 -0
  10. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/docs/source/modules.rst +0 -0
  11. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/examples/jtop_callback.py +0 -0
  12. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/examples/jtop_server.py +0 -0
  13. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/examples/log_data.py +0 -0
  14. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/examples/quick_read.py +0 -0
  15. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4/jetson_stats.egg-info}/PKG-INFO +16 -28
  16. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jetson_stats.egg-info/SOURCES.txt +0 -0
  17. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jetson_stats.egg-info/dependency_links.txt +0 -0
  18. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jetson_stats.egg-info/entry_points.txt +0 -0
  19. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jetson_stats.egg-info/not-zip-safe +0 -0
  20. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jetson_stats.egg-info/top_level.txt +0 -0
  21. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/__init__.py +1 -1
  22. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/__main__.py +1 -3
  23. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/__init__.py +0 -0
  24. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/common.py +0 -0
  25. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/fan.py +0 -0
  26. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/jetson_clocks.py +4 -5
  27. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/nvpmodel.py +0 -0
  28. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/swap.py +0 -7
  29. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/tegra_parse.py +0 -0
  30. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/core/tegrastats.py +0 -0
  31. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/__init__.py +0 -0
  32. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/jtopgui.py +0 -0
  33. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/jtopguilib.py +0 -0
  34. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/jtopguimenu.py +8 -10
  35. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/pall.py +1 -1
  36. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/pcontrol.py +0 -0
  37. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/pgpu.py +0 -0
  38. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/pinfo.py +2 -2
  39. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/gui/pmem.py +0 -0
  40. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/jetson_variables +1 -2
  41. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/jtop/jtop.py +2 -5
  42. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/scripts/jetson_config +78 -307
  43. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/scripts/jetson_docker +0 -0
  44. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/scripts/jetson_release +0 -0
  45. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/scripts/jetson_swap +0 -0
  46. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/services/jetson_env.sh +1 -1
  47. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/services/jetson_performance.service +0 -0
  48. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/services/jetson_performance.sh +0 -0
  49. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/services/jetson_stats_boot.service +0 -0
  50. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/services/jetson_stats_boot.sh +0 -0
  51. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/setup.cfg +0 -0
  52. {jetson-stats-2.0.0 → jetson-stats-2.0.0.dev4}/setup.py +6 -15
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jetson-stats
3
- Version: 2.0.0
3
+ Version: 2.0.0.dev4
4
4
  Summary: Interactive system-monitor and process viewer for all NVIDIA Jetson [Nano, AGX Xavier, TX1, TX2]
5
5
  Home-page: https://github.com/rbonghi/jetson_stats
6
6
  Author: Raffaello Bonghi
@@ -18,7 +18,6 @@ Description: # Jetson stats
18
18
 
19
19
  **jetson-stats** is a package to **monitoring** and **control** your [NVIDIA Jetson][NVIDIA Jetson] [Nano, Xavier, TX2i, TX2, TX1] embedded board. When you install jetson-stats are included:
20
20
  * [jtop](#jtop)
21
- * [jetson_config](#jetson_config)
22
21
  * [jetson_release](#jetson_release)
23
22
  * [jetson_variables](#jetson_variables)
24
23
 
@@ -27,13 +26,19 @@ Description: # Jetson stats
27
26
  ## Install
28
27
 
29
28
  ```elm
30
- sudo -H pip install -U jetson-stats
29
+ sudo -H pip install jetson-stats
31
30
  ```
32
31
  **🚀 That's it! 🚀**
33
32
 
34
- _PS: Don't forget to **reboot** your board_
33
+ There are not require other information to use your jetson stats
34
+
35
+ ## Update the jetson-stats version
36
+
37
+ Now update your system monitor is easier then before.
35
38
 
36
- **You can run jtop in your python script [read here][library]**
39
+ ```elm
40
+ sudo -H pip install -U jetson-stats
41
+ ```
37
42
 
38
43
  ## [**jtop**][jtop]
39
44
  It is a system monitoring utility that runs on the terminal and see and **control** realtime the status of your [NVIDIA Jetson][NVIDIA Jetson]. CPU, RAM, GPU status and frequency and other...
@@ -60,33 +65,18 @@ Description: # Jetson stats
60
65
  --restore Reset Jetson configuration
61
66
  -v, --version show program's version number and exit
62
67
  ```
63
- ### Pages
64
- **jtop** have four different pages to control your NVIDIA Jetson:
65
- 1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other
66
- 2. **GPU** A real time GPU history about your NVIDIA Jetson
67
- 2. **MEM** A real time Memory chart and swap monitor
68
- 3. **CTRL** Enable/Disable **jetson_clocks**, **nvpmodel** or **fan** directly from here
69
- 4. **INFO** All information about libraries, CUDA, Serial Number, interfaces, ...
70
68
  ### Controls
71
69
  To control the your NVIDIA Jetson are available this keyboard commands:
72
-
73
- In page **3 MEM**:
74
- * **c** Clear cache
75
- * **h** Enable/Disable extra swap
76
- * **+** and **-** Increase and decrease swap size
77
-
78
- In page **4 CTRL**:
79
70
  * **a** Start/Stop jetson_clocks service (Note: jetson_clocks start only after 60s from up time)
80
71
  * **e** Enable/Disable jetson_clocks on board boot
81
72
  * **+** and **-** Increase and decrease the NVPmodel
82
- * **f** Manual/jetson_clocks mode for your fan
83
73
  * **p** and **m** Increase and decrease the Fan speed
84
-
85
- ## [**jetson_config**][jetson_config]
86
-
87
- Check _jetson-stats_ **health**, enable/disable **desktop**, enable/disable **jetson_clocks**, improve the performance of your **wifi** are available only in one click using **jetson_config**
88
-
89
- ![jetson_config](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_config.png)
74
+ ### Pages
75
+ **jtop** have four different pages to control your NVIDIA Jetson:
76
+ 1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other
77
+ 2. **GPU** A real time GPU history about your NVIDIA Jetson
78
+ 3. **CTRL** You can control the status of you
79
+ 4. **INFO** Are collected all information about libraries, CUDA, Serial Number, interfaces, ...
90
80
  ## [**jetson_release**][jetson_release]
91
81
  The command show the status and all information about your [NVIDIA Jetson][NVIDIA Jetson]
92
82
 
@@ -96,9 +86,7 @@ Description: # Jetson stats
96
86
 
97
87
  ![jtop](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_env.png)
98
88
 
99
- [library]: https://github.com/rbonghi/jetson_stats/wiki/library
100
89
  [jtop]: https://github.com/rbonghi/jetson_stats/wiki/jtop
101
- [jetson_config]: https://github.com/rbonghi/jetson_stats/wiki/jetson_config
102
90
  [jetson_variables]: https://github.com/rbonghi/jetson_stats/wiki/jetson_variables
103
91
  [jetson_release]: https://github.com/rbonghi/jetson_stats/wiki/jetson_release
104
92
  [jetson_performance]: https://github.com/rbonghi/jetson_stats/wiki/jetson_performance
@@ -5,7 +5,6 @@
5
5
 
6
6
  **jetson-stats** is a package to **monitoring** and **control** your [NVIDIA Jetson][NVIDIA Jetson] [Nano, Xavier, TX2i, TX2, TX1] embedded board. When you install jetson-stats are included:
7
7
  * [jtop](#jtop)
8
- * [jetson_config](#jetson_config)
9
8
  * [jetson_release](#jetson_release)
10
9
  * [jetson_variables](#jetson_variables)
11
10
 
@@ -14,13 +13,19 @@ Read the [Wiki](https://github.com/rbonghi/jetson_stat/wiki) for more detailed i
14
13
  ## Install
15
14
 
16
15
  ```elm
17
- sudo -H pip install -U jetson-stats
16
+ sudo -H pip install jetson-stats
18
17
  ```
19
18
  **🚀 That's it! 🚀**
20
19
 
21
- _PS: Don't forget to **reboot** your board_
20
+ There are not require other information to use your jetson stats
21
+
22
+ ## Update the jetson-stats version
23
+
24
+ Now update your system monitor is easier then before.
22
25
 
23
- **You can run jtop in your python script [read here][library]**
26
+ ```elm
27
+ sudo -H pip install -U jetson-stats
28
+ ```
24
29
 
25
30
  ## [**jtop**][jtop]
26
31
  It is a system monitoring utility that runs on the terminal and see and **control** realtime the status of your [NVIDIA Jetson][NVIDIA Jetson]. CPU, RAM, GPU status and frequency and other...
@@ -47,33 +52,18 @@ optional arguments:
47
52
  --restore Reset Jetson configuration
48
53
  -v, --version show program's version number and exit
49
54
  ```
50
- ### Pages
51
- **jtop** have four different pages to control your NVIDIA Jetson:
52
- 1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other
53
- 2. **GPU** A real time GPU history about your NVIDIA Jetson
54
- 2. **MEM** A real time Memory chart and swap monitor
55
- 3. **CTRL** Enable/Disable **jetson_clocks**, **nvpmodel** or **fan** directly from here
56
- 4. **INFO** All information about libraries, CUDA, Serial Number, interfaces, ...
57
55
  ### Controls
58
56
  To control the your NVIDIA Jetson are available this keyboard commands:
59
-
60
- In page **3 MEM**:
61
- * **c** Clear cache
62
- * **h** Enable/Disable extra swap
63
- * **+** and **-** Increase and decrease swap size
64
-
65
- In page **4 CTRL**:
66
57
  * **a** Start/Stop jetson_clocks service (Note: jetson_clocks start only after 60s from up time)
67
58
  * **e** Enable/Disable jetson_clocks on board boot
68
59
  * **+** and **-** Increase and decrease the NVPmodel
69
- * **f** Manual/jetson_clocks mode for your fan
70
60
  * **p** and **m** Increase and decrease the Fan speed
71
-
72
- ## [**jetson_config**][jetson_config]
73
-
74
- Check _jetson-stats_ **health**, enable/disable **desktop**, enable/disable **jetson_clocks**, improve the performance of your **wifi** are available only in one click using **jetson_config**
75
-
76
- ![jetson_config](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_config.png)
61
+ ### Pages
62
+ **jtop** have four different pages to control your NVIDIA Jetson:
63
+ 1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other
64
+ 2. **GPU** A real time GPU history about your NVIDIA Jetson
65
+ 3. **CTRL** You can control the status of you
66
+ 4. **INFO** Are collected all information about libraries, CUDA, Serial Number, interfaces, ...
77
67
  ## [**jetson_release**][jetson_release]
78
68
  The command show the status and all information about your [NVIDIA Jetson][NVIDIA Jetson]
79
69
 
@@ -83,9 +73,7 @@ This script generate the easy environment variables to know which is your Hardwa
83
73
 
84
74
  ![jtop](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_env.png)
85
75
 
86
- [library]: https://github.com/rbonghi/jetson_stats/wiki/library
87
76
  [jtop]: https://github.com/rbonghi/jetson_stats/wiki/jtop
88
- [jetson_config]: https://github.com/rbonghi/jetson_stats/wiki/jetson_config
89
77
  [jetson_variables]: https://github.com/rbonghi/jetson_stats/wiki/jetson_variables
90
78
  [jetson_release]: https://github.com/rbonghi/jetson_stats/wiki/jetson_release
91
79
  [jetson_performance]: https://github.com/rbonghi/jetson_stats/wiki/jetson_performance
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jetson-stats
3
- Version: 2.0.0
3
+ Version: 2.0.0.dev4
4
4
  Summary: Interactive system-monitor and process viewer for all NVIDIA Jetson [Nano, AGX Xavier, TX1, TX2]
5
5
  Home-page: https://github.com/rbonghi/jetson_stats
6
6
  Author: Raffaello Bonghi
@@ -18,7 +18,6 @@ Description: # Jetson stats
18
18
 
19
19
  **jetson-stats** is a package to **monitoring** and **control** your [NVIDIA Jetson][NVIDIA Jetson] [Nano, Xavier, TX2i, TX2, TX1] embedded board. When you install jetson-stats are included:
20
20
  * [jtop](#jtop)
21
- * [jetson_config](#jetson_config)
22
21
  * [jetson_release](#jetson_release)
23
22
  * [jetson_variables](#jetson_variables)
24
23
 
@@ -27,13 +26,19 @@ Description: # Jetson stats
27
26
  ## Install
28
27
 
29
28
  ```elm
30
- sudo -H pip install -U jetson-stats
29
+ sudo -H pip install jetson-stats
31
30
  ```
32
31
  **🚀 That's it! 🚀**
33
32
 
34
- _PS: Don't forget to **reboot** your board_
33
+ There are not require other information to use your jetson stats
34
+
35
+ ## Update the jetson-stats version
36
+
37
+ Now update your system monitor is easier then before.
35
38
 
36
- **You can run jtop in your python script [read here][library]**
39
+ ```elm
40
+ sudo -H pip install -U jetson-stats
41
+ ```
37
42
 
38
43
  ## [**jtop**][jtop]
39
44
  It is a system monitoring utility that runs on the terminal and see and **control** realtime the status of your [NVIDIA Jetson][NVIDIA Jetson]. CPU, RAM, GPU status and frequency and other...
@@ -60,33 +65,18 @@ Description: # Jetson stats
60
65
  --restore Reset Jetson configuration
61
66
  -v, --version show program's version number and exit
62
67
  ```
63
- ### Pages
64
- **jtop** have four different pages to control your NVIDIA Jetson:
65
- 1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other
66
- 2. **GPU** A real time GPU history about your NVIDIA Jetson
67
- 2. **MEM** A real time Memory chart and swap monitor
68
- 3. **CTRL** Enable/Disable **jetson_clocks**, **nvpmodel** or **fan** directly from here
69
- 4. **INFO** All information about libraries, CUDA, Serial Number, interfaces, ...
70
68
  ### Controls
71
69
  To control the your NVIDIA Jetson are available this keyboard commands:
72
-
73
- In page **3 MEM**:
74
- * **c** Clear cache
75
- * **h** Enable/Disable extra swap
76
- * **+** and **-** Increase and decrease swap size
77
-
78
- In page **4 CTRL**:
79
70
  * **a** Start/Stop jetson_clocks service (Note: jetson_clocks start only after 60s from up time)
80
71
  * **e** Enable/Disable jetson_clocks on board boot
81
72
  * **+** and **-** Increase and decrease the NVPmodel
82
- * **f** Manual/jetson_clocks mode for your fan
83
73
  * **p** and **m** Increase and decrease the Fan speed
84
-
85
- ## [**jetson_config**][jetson_config]
86
-
87
- Check _jetson-stats_ **health**, enable/disable **desktop**, enable/disable **jetson_clocks**, improve the performance of your **wifi** are available only in one click using **jetson_config**
88
-
89
- ![jetson_config](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_config.png)
74
+ ### Pages
75
+ **jtop** have four different pages to control your NVIDIA Jetson:
76
+ 1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other
77
+ 2. **GPU** A real time GPU history about your NVIDIA Jetson
78
+ 3. **CTRL** You can control the status of you
79
+ 4. **INFO** Are collected all information about libraries, CUDA, Serial Number, interfaces, ...
90
80
  ## [**jetson_release**][jetson_release]
91
81
  The command show the status and all information about your [NVIDIA Jetson][NVIDIA Jetson]
92
82
 
@@ -96,9 +86,7 @@ Description: # Jetson stats
96
86
 
97
87
  ![jtop](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_env.png)
98
88
 
99
- [library]: https://github.com/rbonghi/jetson_stats/wiki/library
100
89
  [jtop]: https://github.com/rbonghi/jetson_stats/wiki/jtop
101
- [jetson_config]: https://github.com/rbonghi/jetson_stats/wiki/jetson_config
102
90
  [jetson_variables]: https://github.com/rbonghi/jetson_stats/wiki/jetson_variables
103
91
  [jetson_release]: https://github.com/rbonghi/jetson_stats/wiki/jetson_release
104
92
  [jetson_performance]: https://github.com/rbonghi/jetson_stats/wiki/jetson_performance
@@ -29,5 +29,5 @@ from .core import StatusObserver
29
29
  __author__ = "Raffaello Bonghi <raffaello@rnext.it>"
30
30
  # Version package
31
31
  # https://packaging.python.org/guides/distributing-packages-using-setuptools/#choosing-a-versioning-scheme
32
- __version__ = "2.0.0"
32
+ __version__ = "2.0.0.dev4"
33
33
  # EOF
@@ -105,9 +105,7 @@ def main():
105
105
  print("Please run with sudo")
106
106
  except jtop.JtopException as e:
107
107
  # Print error and close
108
- print(bcolors.FAIL + e + bcolors.ENDC)
109
- print("Try to use jetson_config (health page) to fix this package")
110
- print("or open an issue on https://github.com/rbonghi/jetson_stats/issues")
108
+ print(e)
111
109
 
112
110
 
113
111
  if __name__ == "__main__":
@@ -34,9 +34,8 @@ class JetsonClocks(object):
34
34
  # CPU Cluster Switching: Disabled
35
35
  CPU_CLUSTER_REGEXP = re.compile(r'CPU Cluster Switching: ((.*))')
36
36
  # CPU regex
37
- # NANO: cpu0: Online=1 Governor=schedutil MinFreq=102000 MaxFreq=1428000 CurrentFreq=1428000 IdleStates: WFI=1 c7=1
38
- # Xavier: cpu0: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1574400 IdleStates: C1=1 c6=1
39
- CPU_REGEXP = re.compile(r'cpu(.+?): Online=(.+?) Governor=(.+?) MinFreq=(.+?) MaxFreq=(.+?) CurrentFreq=(.+?) IdleStates: (.+?)=(.+?) (.+?)=((.*))')
37
+ # cpu0: Online=1 Governor=schedutil MinFreq=102000 MaxFreq=1428000 CurrentFreq=1428000 IdleStates: WFI=1 c7=1
38
+ CPU_REGEXP = re.compile(r'cpu(.+?): Online=(.+?) Governor=(.+?) MinFreq=(.+?) MaxFreq=(.+?) CurrentFreq=(.+?) IdleStates: WFI=(.+?) c7=((.*))')
40
39
  # GPU regex
41
40
  # GPU MinFreq=76800000 MaxFreq=921600000 CurrentFreq=384000000
42
41
  GPU_REGEXP = re.compile(r'GPU MinFreq=(.+?) MaxFreq=(.+?) CurrentFreq=((.*))')
@@ -81,8 +80,8 @@ class JetsonClocks(object):
81
80
  "MinFreq": int(match.group(4)),
82
81
  "MaxFreq": int(match.group(5)),
83
82
  "CurrentFreq": int(match.group(6)),
84
- "IdleStates": {str(match.group(7)): int(match.group(8)),
85
- str(match.group(9)): int(match.group(10))}}
83
+ "IdleStates": {"WFI": int(match.group(7)),
84
+ "c7": int(match.group(8))}}
86
85
  # Store in CPU list
87
86
  status["cpu"]["cpu{num}".format(num=match.group(1))] = cpu
88
87
  continue
@@ -28,9 +28,6 @@ SWAP_MIN_SIZE = 2
28
28
 
29
29
  class Swap(object):
30
30
 
31
- class SwapException(Exception):
32
- pass
33
-
34
31
  def __init__(self, dir_swap="", default=8, swap_name="swfile"):
35
32
  # Set default folder swap
36
33
  self.dir = dir_swap
@@ -41,10 +38,6 @@ class Swap(object):
41
38
  self.new_size = default
42
39
  # Initialize auto mount
43
40
  self.auto = True
44
- # Check if exist jetson_swap
45
- exist = sp.call('command -v jetson_swap >> /dev/null', shell=True)
46
- if exist != 0:
47
- raise Swap.SwapException("jetson_swap does not exist!")
48
41
  # Load swap information
49
42
  self.update()
50
43
 
@@ -93,8 +93,6 @@ def plot_watts(stdscr, start, offset, width, jetson):
93
93
  break
94
94
  # Extract the total from list
95
95
  # Otherwise sum all values
96
- # Example for Jetson Xavier
97
- # https://forums.developer.nvidia.com/t/xavier-jetson-total-power-consumption/81016
98
96
  if total_name:
99
97
  total = watts[total_name]
100
98
  del watts[total_name]
@@ -152,26 +150,26 @@ def compact_info(stdscr, start, offset, width, jetson):
152
150
  # Jetson clocks status
153
151
  jc = jetson.jetson_clocks
154
152
  if jc is not None:
155
- jc_service = jc.service
156
- jc_enable = jc.enable
157
153
  try:
158
154
  jc_status = jc.status
159
155
  # Running (Green) or Normal (Grey)
160
156
  color = curses.color_pair(2) if jc_status else curses.A_NORMAL
161
157
  # Write status jetson_clocks
162
158
  jc_status_name = "Running" if jc_status else "Stopped"
163
- # Specify the service running
164
- if jc_service == "active":
165
- jc_status_name += "+"
166
- # Show if JetsonClock is enabled or not
167
- if jc_enable:
168
- jc_status_name = "[" + jc_status_name + "]"
169
159
  except JetsonClocks.JCException:
170
160
  # Fix error color
171
161
  color = curses.color_pair(7)
172
162
  # SUDO REQUIRED is too long, change with a series of spaces
173
163
  # The number 16 = len("jetson clocks: ") + 1
174
164
  jc_status_name = (width - 16) * " "
165
+ jc_service = jc.service
166
+ jc_enable = jc.enable
167
+ # Specify the service running
168
+ if jc_service == "active":
169
+ jc_status_name += "+"
170
+ # Show if JetsonClock is enabled or not
171
+ if jc_enable:
172
+ jc_status_name = "[" + jc_status_name + "]"
175
173
  # Show status jetson_clocks
176
174
  plot_name_info(stdscr, offset + counter, start, "Jetson clocks", jc_status_name, color)
177
175
  counter += 1
@@ -25,10 +25,10 @@ from .jtopguimenu import (plot_watts,
25
25
  compact_info,
26
26
  plot_temperatures,
27
27
  plot_CPUs)
28
+
28
29
  # Actual variable printed
29
30
  # LIST_PRINT = ['CPU', 'MTS', 'RAM', 'IRAM', 'SWAP', 'EMC', 'GR3D', 'TEMP', 'WATT', 'FAN', 'APE', 'NVENC', 'NVDEC', 'MSENC']
30
31
 
31
-
32
32
  class ALL(Page):
33
33
 
34
34
  def __init__(self, stdscr, jetson, refresh):
@@ -52,14 +52,14 @@ class INFO(Page):
52
52
  self.stdscr.addstr(start_pos + idx, posx + spacing, self.jetson.board["info"]["Jetpack"], curses.A_BOLD)
53
53
  self.stdscr.addstr(start_pos + idx + 1, posx, "- Board:", curses.A_BOLD)
54
54
  idx += 1
55
- for name, info in sorted(self.jetson.board["board"].items()):
55
+ for name, info in self.jetson.board["board"].items():
56
56
  self.stdscr.addstr(start_pos + idx + 1, posx + 2, "* " + name + ":")
57
57
  self.stdscr.addstr(start_pos + idx + 1, posx + spacing, info, curses.A_BOLD)
58
58
  idx += 1
59
59
  # Libraries info
60
60
  self.stdscr.addstr(start_pos + idx + 1, posx, "- Libraries:", curses.A_BOLD)
61
61
  idx += 1
62
- for name, info in sorted(self.jetson.board["libraries"].items()):
62
+ for name, info in self.jetson.board["libraries"].items():
63
63
  self.stdscr.addstr(start_pos + idx + 1, posx + 2, "* " + name + ":")
64
64
  self.stdscr.addstr(start_pos + idx + 1, posx + spacing, info, curses.A_BOLD)
65
65
  idx += 1
@@ -61,8 +61,7 @@ JETSON_BOARD=""
61
61
  if [ -f /proc/device-tree/nvidia,dtsfilename ]; then
62
62
  # ..<something>/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
63
63
  # The last third is the codename of the board
64
- JETSON_CODENAME=$(tr -d '\0' < /proc/device-tree/nvidia,dtsfilename)
65
- JETSON_CODENAME=$(echo ${JETSON_CODENAME#*"/hardware/nvidia/platform/"} | tr '/' '\n' | head -2 | tail -1 )
64
+ JETSON_CODENAME=$(cat /proc/device-tree/nvidia,dtsfilename | tr '/' '\n' | tail -3 | head -n 1 )
66
65
  # The basename extract the board type
67
66
  JETSON_BOARD="$(tr -d '\0' < /proc/device-tree/nvidia,dtsfilename | sed 's/.*\///')"
68
67
  # List of all boards
@@ -141,14 +141,11 @@ class jtop(StatusObserver):
141
141
  break
142
142
  if not tegrastats_file:
143
143
  raise jtop.JtopException("Tegrastats is not availabe on this board")
144
- try:
145
- # Initialize Swap controller
146
- self.swap = Swap()
147
- except Swap.SwapException as e:
148
- raise jtop.JtopException(e)
149
144
  # Initialize Tegrastats controller
150
145
  self._stats = {}
151
146
  self.tegrastats = Tegrastats(tegrastats_file, interval)
147
+ # Initialize Swap controller
148
+ self.swap = Swap()
152
149
 
153
150
  @property
154
151
  def userid(self):
@@ -28,93 +28,29 @@ FORCE=false
28
28
  # - fix_<name> -> Run the installer
29
29
  # - uninstall_<name> -> Run the uninstaller
30
30
  # - <name> -> Make the gui
31
- HEALTH_FUNCTIONS=("commands" "Check all commands if are installed"\
32
- "folders" "Check folders"\
33
- "variables" "Check variables status"\
34
- "jetson_performance" "Status jetson clock service"\
35
- "jetson_stats_up" "Jetson-stats startup service")
31
+ HEALTH_FUNCTIONS=("folders" "Check folders"\
32
+ "variables" "Check variables status"\
33
+ "jetson_performance" "Status jetson clock service"\
34
+ "jetson_stats_up" "Jetson-stats startup service")
36
35
  # Jetson-stats main folder
37
36
  JETSON_STATS_FOLDER="/usr/local/jetson_stats"
38
37
  # Locate jetson-stats and python version
39
38
  # Load JETSON environment variables
40
39
  JTOP_VARIABLE=""
41
40
  JTOP_PYTHON=""
42
- JTOP_PYTHON_NAME=""
43
41
  if type -P python3 >/dev/null 2>&1 ; then
44
42
  JTOP_VARIABLE=$(python3 -c "import jtop; print(jtop.__path__[0])" 2> /dev/null)
45
43
  JTOP_PYTHON="$(python3 -V 2>&1)"
46
- JTOP_PYTHON_NAME="python3"
47
44
  fi
48
45
  if type -P python >/dev/null 2>&1 && [ -z $JTOP_VARIABLE ] ; then
49
46
  JTOP_VARIABLE=$(python -c "import jtop; print(jtop.__path__[0])" 2> /dev/null)
50
47
  JTOP_PYTHON="$(python -V 2>&1)"
51
- JTOP_PYTHON_NAME="python"
52
48
  fi
53
49
  # Load jetson_variables
54
50
  if [ ! -z $JTOP_VARIABLE ] ; then
55
51
  source $JTOP_VARIABLE/jetson_variables
56
52
  fi
57
53
 
58
- status_commands()
59
- {
60
- local BIN_FOLDER="/usr/local/bin"
61
- if [ ! -f "$BIN_FOLDER/jetson_release" ] ; then
62
- echo 1
63
- return
64
- fi
65
- if [ ! -f "$BIN_FOLDER/jetson_swap" ] ; then
66
- echo 1
67
- return
68
- fi
69
- # Everything is fine
70
- echo 0
71
- }
72
-
73
- commands()
74
- {
75
- local TEXT=""
76
- # Check status folders
77
- if [ $(status_commands) -eq 1 ] ; then
78
- TEXT="Require to reinstall this package using\n"
79
- TEXT+="sudo -H pip install --no-cache-dir -U jetson-stats"
80
- # Run script to fix variables
81
- if (whiptail --title "$TITLE" --yesno "$TEXT\n\nDo you want fix?" 11 78); then
82
- fix_commands
83
- fi
84
- else
85
- TEXT="All commands are correctly installed"
86
- # Run Message
87
- whiptail --title "$TITLE" --msgbox "$TEXT" 10 78
88
- fi
89
- # Return to healt function
90
- health
91
- }
92
-
93
- fix_commands()
94
- {
95
- # Skip this script if forced
96
- if $FORCE ; then
97
- echo "${red}Skip with FORCE option${reset}"
98
- return
99
- fi
100
- # Recognize version pip
101
- local PIP_VERSION="pip"
102
- if [ $JTOP_PYTHON_NAME == "python3" ] ; then
103
- PIP_VERSION="pip3"
104
- fi
105
- # Uninstall package
106
- sudo -H $PIP_VERSION uninstall -y jetson-stats
107
- # Reinstall package without cache dir pip
108
- sudo -H $PIP_VERSION install --no-cache-dir -U jetson-stats
109
- # After this script will be close the script
110
- exit 0
111
- }
112
-
113
- uninstall_commands()
114
- {
115
- echo "Nothing to do"
116
- }
117
-
118
54
  status_folders()
119
55
  {
120
56
  local BIN_FOLDER="/usr/local/bin"
@@ -145,18 +81,22 @@ fix_folders()
145
81
  local BIN_FOLDER="/usr/local/bin"
146
82
  # Remove jetson-docker link
147
83
  if [ -f "$BIN_FOLDER/jetson-docker" ] ; then
84
+ echo " * Remove OLD jetson-docker link"
148
85
  sudo rm "$BIN_FOLDER/jetson-docker"
149
86
  fi
150
87
  # Remove jetson_release link
151
88
  if [ -f "$BIN_FOLDER/jetson-release" ] ; then
89
+ echo " * Remove OLD jetson-release link"
152
90
  sudo rm "$BIN_FOLDER/jetson-release"
153
91
  fi
154
92
  # Remove jetson_release link
155
93
  if [ -f "$BIN_FOLDER/jetson-swap" ] ; then
94
+ echo " * Remove OLD jetson-swap link"
156
95
  sudo rm "$BIN_FOLDER/jetson-swap"
157
96
  fi
158
97
  # Remove /etc/jetson_easy folder
159
98
  if [ -d "/etc/jetson_easy" ] ; then
99
+ echo " * Remove jetson_easy folder"
160
100
  sudo rm -R "/etc/jetson_easy"
161
101
  fi
162
102
  # Remove jetson_release link
@@ -165,19 +105,6 @@ fix_folders()
165
105
  fi
166
106
  # Remove jetson_release link
167
107
  if [ -d "/opt/jetson_stats" ] ; then
168
- # remove old reference folders
169
- if [ -f "$BIN_FOLDER/jetson_docker" ] ; then
170
- sudo rm "$BIN_FOLDER/jetson_docker"
171
- fi
172
- # Remove jetson_release link
173
- if [ -f "$BIN_FOLDER/jetson_release" ] ; then
174
- sudo rm "$BIN_FOLDER/jetson_release"
175
- fi
176
- # Remove jetson_release link
177
- if [ -f "$BIN_FOLDER/jetson_swap" ] ; then
178
- sudo rm "$BIN_FOLDER/jetson_swap"
179
- fi
180
- # Remove reference folder
181
108
  sudo rm -R "/opt/jetson_stats"
182
109
  fi
183
110
 
@@ -191,15 +118,18 @@ uninstall_folders()
191
118
  folders()
192
119
  {
193
120
  local TEXT=""
121
+ if [ $(status_folders) -eq 0 ] ; then
122
+ TEXT="All folder are correctly installed"
123
+ else
124
+ TEXT="Clean and reinstall all folders."
125
+ fi
194
126
  # Check status folders
195
127
  if [ $(status_folders) -eq 1 ] ; then
196
- TEXT="Clean and reinstall all folders."
197
128
  # Run script to fix variables
198
129
  if (whiptail --title "$TITLE" --yesno "$TEXT\n\nDo you want fix?" 11 78); then
199
130
  fix_folders
200
131
  fi
201
132
  else
202
- TEXT="All folder are correctly installed"
203
133
  # Run Message
204
134
  whiptail --title "$TITLE" --msgbox "$TEXT" 10 78
205
135
  fi
@@ -219,11 +149,6 @@ status_jetson_performance()
219
149
  echo 1
220
150
  return
221
151
  fi
222
- # Check if file are same
223
- if ! cmp --silent "/etc/systemd/system/jetson_performance.service" "$JETSON_STATS_FOLDER/jetson_performance.service" ; then
224
- echo 1
225
- return
226
- fi
227
152
  # Check if jetson performance is correctly installed
228
153
  local JE_PERFOMANCE_STATUS="$(systemctl is-active jetson_performance.service)"
229
154
  if [ $JE_PERFOMANCE_STATUS = "failed" ] ; then
@@ -314,11 +239,6 @@ status_jetson_stats_up()
314
239
  echo 1
315
240
  return
316
241
  fi
317
- # Check if file are same
318
- if ! cmp --silent "/etc/systemd/system/jetson_stats_boot.service" "$JETSON_STATS_FOLDER/jetson_stats_boot.service" ; then
319
- echo 1
320
- return
321
- fi
322
242
  # Check status service
323
243
  local JE_FAN_STATUS="$(systemctl is-active jetson_stats_boot.service)"
324
244
  if [ $JE_FAN_STATUS = "failed" ] ; then
@@ -406,18 +326,11 @@ jetson_stats_up()
406
326
 
407
327
  status_variables()
408
328
  {
409
- # Check if file does not exist
410
- if [ ! -f "/etc/profile.d/jetson_env.sh" ] ; then
411
- echo 1
412
- return
413
- fi
414
- # Check if file are different
415
- if ! cmp --silent "/etc/profile.d/jetson_env.sh" "$JETSON_STATS_FOLDER/jetson_env.sh" ; then
329
+ if [ -f "/etc/profile.d/jetson_env.sh" ] ; then
330
+ echo 0
331
+ else
416
332
  echo 1
417
- return
418
333
  fi
419
- # Everything is fine
420
- echo 0
421
334
  }
422
335
 
423
336
  fix_variables()
@@ -445,13 +358,17 @@ uninstall_variables()
445
358
 
446
359
  variables()
447
360
  {
448
- local TEXT="jetson-stats add new enviroment variables in your bash starting \
449
- with \"JETSON_\" with detailed information about your board.\nThey are located in \"/etc/profile.d/jetson_env.sh"
361
+ local TEXT="Jetson variables are:\n"
362
+ # Check status variables
363
+ if [ $(status_variables) -eq 0 ] ; then
364
+ TEXT+=" - Fixed"
365
+ else
366
+ TEXT+=" - Failure"
367
+ fi
450
368
  # Check status jetson_performance
451
369
  if [ $(status_variables) -eq 1 ] ; then
452
- TEXT+="\n\nThe Jetson enviroment variables are in failure\nDo you want fix?"
453
370
  # Run script to fix variables
454
- if (whiptail --title "$TITLE" --yesno "$TEXT" 11 78); then
371
+ if (whiptail --title "$TITLE" --yesno "$TEXT\n\nDo you want fix?" 11 78); then
455
372
  fix_variables
456
373
  fi
457
374
  else
@@ -481,8 +398,8 @@ installer()
481
398
  local status=$(eval "status_$name")
482
399
  # Check if a status function in list return error=1
483
400
  if [ "$status" -eq 1 ] || $FORCE ; then
484
- echo "${green}[Install $name - $description]${reset}"
485
- # Run the Install scripts script
401
+ echo "${green}[Fix $name - $description]${reset}"
402
+ # Run the fix scripts script
486
403
  eval "fix_$name"
487
404
  fi
488
405
  done
@@ -594,13 +511,10 @@ health()
594
511
  if [ $? -eq 0 ]; then
595
512
  # Run the function with the same name
596
513
  if [ "$OUTPUT" = "<-- Back" ] ; then
597
- # Return to main
598
514
  main
599
515
  elif [ "$OUTPUT" = "Fix" ] ; then
600
516
  # Run the installer script
601
517
  installer "${HEALTH_FUNCTIONS[@]}"
602
- # End loop
603
- do_finish
604
518
  # Return to main
605
519
  health
606
520
  else
@@ -610,8 +524,6 @@ health()
610
524
  local status=$(eval "status_$FUNCTION")
611
525
  # Run function
612
526
  $FUNCTION
613
- # End loop
614
- do_finish
615
527
  fi
616
528
  else
617
529
  # Return to main for other options
@@ -619,97 +531,17 @@ health()
619
531
  fi
620
532
  }
621
533
 
622
- get_type_desktop()
623
- {
624
- local GUI_CONF="/etc/gdm3/custom.conf"
625
- # Check desktop configuration
626
- local DEFAULT_TARGET=$(systemctl get-default)
627
- local TYPE=""
628
- if [ "$DEFAULT_TARGET" = "multi-user.target" ] ; then
629
- TYPE="B1"
630
- if [ -f "/etc/systemd/system/getty@tty1.service.d/autologin.conf" ] ; then
631
- TYPE="B2"
632
- fi
633
- elif [ "$DEFAULT_TARGET" = "graphical.target" ] ; then
634
- TYPE="B3"
635
- if [ -f $GUI_CONF ] ; then
636
- if grep -q "AutomaticLoginEnable=[tT]rue" $GUI_CONF ; then
637
- TYPE="B4"
638
- fi
639
- fi
640
- fi
641
- echo $TYPE
642
- return
643
- }
644
-
645
- update_desktop_login()
646
- {
647
- local GUI_CONF="/etc/gdm3/custom.conf"
648
- local option=$1
649
- local user=$2
650
- if [ -f $GUI_CONF ] ; then
651
- # Remove old Automatic configuration data
652
- if grep -q "AutomaticLogin=" $GUI_CONF ; then
653
- sudo sed -i "/^AutomaticLogin=/d" $GUI_CONF
654
- echo "Removed"
655
- fi
656
- # Add new status
657
- sudo sed -i "/\[daemon\]/a AutomaticLogin=$user" $GUI_CONF
658
-
659
- # Remove old Automatic configuration data
660
- if grep -q "AutomaticLoginEnable=" $GUI_CONF ; then
661
- sudo sed -i "/^AutomaticLoginEnable=/d" $GUI_CONF
662
- fi
663
- # Add new status
664
- sudo sed -i "/\[daemon\]/a AutomaticLoginEnable=$option" $GUI_CONF
665
- else
666
- echo "${red}$GUI_CONF does not exist!${reset}"
667
- fi
668
- }
669
-
670
- identify_desktop()
671
- {
672
- local TYPE=$1
673
- local NAME=$2
674
- if [ "$TYPE" = "$NAME" ] ; then
675
- echo "[$NAME]"
676
- else
677
- echo "$NAME"
678
- fi
679
- }
680
-
681
534
  desktop() {
682
- # Desktop manager. Enable and disable desktop feature with autologin or not
683
- # Reference:
684
- # 1. https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config#L1122
685
- # 2. https://linuxconfig.org/how-to-enable-automatic-login-on-ubuntu-18-04-bionic-beaver-linux
686
- # 3. https://askubuntu.com/questions/819117/how-can-i-get-autologin-at-startup-working-on-ubuntu-server-16-04-1
687
- local MENU="Status board:\n"
688
- local DEFAULT_TARGET=$(systemctl get-default)
689
- local AUTO_LOGIN="False"
690
- local REQUIRE_REBOOT=false
691
- if [ $DEFAULT_TARGET = "multi-user.target" ] ; then
692
- if [ -f "/etc/systemd/system/getty@tty1.service.d/autologin.conf" ] ; then
693
- AUTO_LOGIN="True"
694
- fi
695
- else
696
- if [ -f "/etc/gdm3/custom.conf" ] ; then
697
- if grep -q "AutomaticLoginEnable=[tT]rue" "/etc/gdm3/custom.conf" ; then
698
- AUTO_LOGIN="True"
699
- fi
700
- fi
701
- fi
702
- MENU+=" - $DEFAULT_TARGET\n"
703
- MENU+=" - Autologin: $AUTO_LOGIN"
704
- local DESKTOP_TYPE=$(get_type_desktop)
535
+ # Reference from
536
+ # https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config#L1122
705
537
  # Make menu menu
706
538
  if $INTERACTIVE ; then
707
- BOOTOPT=$(whiptail --title "$TITLE" --menu "$MENU\n\nBoot Options" 18 78 6 \
539
+ BOOTOPT=$(whiptail --title "$TITLE" --menu "Boot Options" 18 78 6 \
708
540
  "<-- Back" "Return to the main menu" \
709
- "$(identify_desktop $DESKTOP_TYPE B1) Console" "Text console, requiring user to login" \
710
- "$(identify_desktop $DESKTOP_TYPE B2) Console Autologin" "Text console, automatically logged in as '$USER' user" \
711
- "$(identify_desktop $DESKTOP_TYPE B3) Desktop" "Desktop GUI, requiring user to login" \
712
- "$(identify_desktop $DESKTOP_TYPE B4) Desktop Autologin" "Desktop GUI, automatically logged in as '$USER' user" \
541
+ "B1 Console" "Text console, requiring user to login" \
542
+ "B2 Console Autologin" "Text console, automatically logged in as '$USER' user" \
543
+ "B3 Desktop" "Desktop GUI, requiring user to login" \
544
+ "B4 Desktop Autologin" "Desktop GUI, automatically logged in as '$USER' user" \
713
545
  3>&1 1>&2 2>&3)
714
546
  else
715
547
  BOOTOPT=$1
@@ -720,84 +552,70 @@ desktop() {
720
552
  case "$BOOTOPT" in
721
553
  "<-- Back")
722
554
  # Return to main for other options
555
+ main
723
556
  ;;
724
- *B1*)
725
- sudo systemctl set-default multi-user.target
726
- sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
727
- # Remove autologin
728
- if [ -f "/etc/systemd/system/getty@tty1.service.d/autologin.conf" ] ; then
729
- sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
730
- fi
731
- REQUIRE_REBOOT=true
557
+ B1*)
558
+ systemctl set-default multi-user.target
559
+ ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
560
+ rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
732
561
  ;;
733
- *B2*)
734
- sudo systemctl set-default multi-user.target
735
- sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
736
- # If the file does not exist make it one
737
- if [ ! -f "/etc/systemd/system/getty@tty1.service.d/autologin.conf" ] ; then
738
- sudo mkdir -p "/etc/systemd/system/getty@tty1.service.d"
739
- sudo touch "/etc/systemd/system/getty@tty1.service.d/autologin.conf"
740
- fi
741
- # Change hownership
742
- sudo chown $USER:$USER "/etc/systemd/system/getty@tty1.service.d/autologin.conf"
743
- # Copy the autologin configuration
562
+ B2*)
563
+ systemctl set-default multi-user.target
564
+ ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
744
565
  cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
745
566
  [Service]
746
567
  ExecStart=
747
568
  ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM
748
569
  EOF
749
- REQUIRE_REBOOT=true
750
570
  ;;
751
- *B3*)
752
- sudo systemctl set-default graphical.target
753
- sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
754
- # Remove autologin
755
- if [ -f "/etc/systemd/system/getty@tty1.service.d/autologin.conf" ] ; then
756
- sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
571
+ B3*)
572
+ if [ -e /etc/init.d/lightdm ]; then
573
+ systemctl set-default graphical.target
574
+ ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
575
+ rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
576
+ sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/"
577
+ # disable_raspi_config_at_boot
578
+ else
579
+ whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2
580
+ return 1
757
581
  fi
758
- # Update desktop login
759
- update_desktop_login "False" $USER
760
- REQUIRE_REBOOT=true
761
582
  ;;
762
- *B4*)
763
- sudo systemctl set-default graphical.target
764
- sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
765
- # Remove autologin
766
- if [ -f "/etc/systemd/system/getty@tty1.service.d/autologin.conf" ] ; then
767
- sudo rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
583
+ B4*)
584
+ if [ -e /etc/init.d/lightdm ]; then
585
+ systemctl set-default graphical.target
586
+ ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
587
+ cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
588
+ [Service]
589
+ ExecStart=
590
+ ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM
591
+ EOF
592
+ sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$USER/"
593
+ # disable_raspi_config_at_boot
594
+ else
595
+ whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2
596
+ return 1
768
597
  fi
769
- # Update desktop login
770
- update_desktop_login "True" $USER
771
- REQUIRE_REBOOT=true
772
598
  ;;
773
599
  *)
774
600
  whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2
601
+ return 1
775
602
  ;;
776
603
  esac
777
- if $REQUIRE_REBOOT ; then
778
- # Require reboot
779
- if [ ! -f /var/run/reboot-required ] ; then
780
- sudo touch /var/run/reboot-required
781
- fi
782
- # End loop
783
- do_finish
604
+ # Require reboot
605
+ if [ ! -f /var/run/reboot-required ] ; then
606
+ sudo touch /var/run/reboot-required
784
607
  fi
608
+ else
609
+ # Return to main for other options
610
+ main
785
611
  fi
786
- # Return to main for other options
787
- main
788
612
  }
789
613
 
790
614
  jetson_clocks()
791
615
  {
792
616
  # Reference
793
617
  # https://askubuntu.com/questions/19320/how-to-enable-or-disable-services
794
- local MENU="jetson_clocks is control the performance of your board.\n"
795
- # Read jtop status
796
- local JC_STATUS=""
797
- if [ ! -z $JTOP_PYTHON_NAME ] ; then
798
- local JC_STATUS=$(sudo $JTOP_PYTHON_NAME -c "from jtop import jtop; print(jtop().jc.status)")
799
- MENU+=" - [$JC_STATUS] jetson_clocks\n"
800
- fi
618
+ local MENU="jetson_clocks is manage from jetson_performance.service\n"
801
619
  # Jetson_performance status
802
620
  local JE_PERFOMANCE_STATUS="$(systemctl is-active jetson_performance.service)"
803
621
  MENU+=" - [$JE_PERFOMANCE_STATUS] jetson_performance service\n"
@@ -809,13 +627,6 @@ jetson_clocks()
809
627
  MENU+=" - [$JE_PERFOMANCE_ENABLED] jetson_performance enable"
810
628
  # Make GUI
811
629
  if $INTERACTIVE ; then
812
- if [ "$JC_STATUS" = "True" ] && [ "$JE_PERFOMANCE_STATUS" != "active" ] ; then
813
- # Run message script
814
- whiptail --title "$TITLE" --msgbox "$MENU\n\njetson_clocks running without jetson_performance.service!" 14 78 2
815
- # Return to main
816
- loop
817
- fi
818
- # Make jetson_clocks service options
819
630
  BOOTOPT=$(whiptail --title "$TITLE" --menu "$MENU\nOptions:" 18 78 6 \
820
631
  "<-- Back" "Return to the main menu" \
821
632
  "Start" "Activate jetson_clocks service" \
@@ -967,40 +778,6 @@ do_finish() {
967
778
  exit 0
968
779
  }
969
780
 
970
- do_password()
971
- {
972
- # https://superuser.com/questions/553932/how-to-check-if-i-have-sudo-access
973
- prompt=$(sudo -nv 2>&1)
974
- if [ $? -eq 0 ]; then
975
- # exit code of sudo-command is 0
976
- # echo "has_sudo__pass_set"
977
- return
978
- elif echo $prompt | grep -q '^sudo:'; then
979
- #echo "has_sudo__needs_pass"
980
- if $INTERACTIVE ; then
981
- # Open dialog menu to ask the password
982
- local PASSWORD=$(whiptail --passwordbox "please enter '$USER' password" 8 78 --title "$TITLE" 3>&1 1>&2 2>&3)
983
- exitstatus=$?
984
- if [ $exitstatus = 0 ]; then
985
- # Check if the root password if good
986
- if $(echo "$PASSWORD" | sudo -S -i true) ; then
987
- echo
988
- fi
989
- do_password
990
- else
991
- # Exit from request
992
- exit 0
993
- fi
994
- else
995
- # Request sudo password
996
- sudo -v
997
- fi
998
- else
999
- echo "no sudo"
1000
- return
1001
- fi
1002
- }
1003
-
1004
781
  usage()
1005
782
  {
1006
783
  if [ "$1" != "" ]; then
@@ -1014,7 +791,6 @@ usage()
1014
791
  echo "options,"
1015
792
  echo " -h|--help | This help"
1016
793
  echo " -p|--option | Select page to open the script"
1017
- echo " -u|--user | Change user to run the script"
1018
794
  echo " --install | Run installer. Equivalent to fix jetson-stats in health"
1019
795
  echo " --uninstall | Run uninstaller for all packages"
1020
796
  }
@@ -1024,7 +800,6 @@ loop()
1024
800
  local FUNCTION=""
1025
801
  local INSTALLER=false
1026
802
  local UNINSTALLER=false
1027
- local PIP_INSTALLER=false
1028
803
  # Decode all information from startup
1029
804
  while [ -n "$1" ]; do
1030
805
  case "$1" in
@@ -1036,10 +811,6 @@ loop()
1036
811
  FUNCTION=$2
1037
812
  shift 1
1038
813
  ;;
1039
- -u|--users)
1040
- USER=$2
1041
- shift 1
1042
- ;;
1043
814
  --install)
1044
815
  FORCE=true
1045
816
  INTERACTIVE=false
@@ -1056,14 +827,10 @@ loop()
1056
827
  esac
1057
828
  shift 1
1058
829
  done
1059
- # Ask sudo password before run
1060
- do_password
1061
830
  if $INSTALLER ; then
1062
831
  # Run the installer
1063
832
  installer "${HEALTH_FUNCTIONS[@]}"
1064
833
  elif $UNINSTALLER ; then
1065
- # Clean jtop configuration and restore
1066
- sudo jtop --restore
1067
834
  # Run the uninstaller
1068
835
  uninstaller "${HEALTH_FUNCTIONS[@]}"
1069
836
  else
@@ -1072,12 +839,16 @@ loop()
1072
839
  if type $FUNCTION | grep -i function > /dev/null; then
1073
840
  # Run function
1074
841
  $FUNCTION
842
+ # End loop
843
+ do_finish
1075
844
  fi
1076
845
  else
1077
- # Run main
846
+ # Run the main loop
1078
847
  main $@
1079
848
  fi
1080
849
  fi
850
+ # End loop
851
+ do_finish
1081
852
  }
1082
853
 
1083
854
  loop $@
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  # This file is part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it).
3
- # Copyright (c) 2019 Raffaello Bonghi.
3
+ # Copyright (c) 2020 Raffaello Bonghi.
4
4
  #
5
5
  # This program is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU Affero General Public License as published by
@@ -39,7 +39,6 @@ from io import open
39
39
  import subprocess as sp
40
40
  import shlex
41
41
  import os
42
- from shutil import copyfile
43
42
  import sys
44
43
  import re
45
44
 
@@ -83,7 +82,7 @@ with open(os.path.join(here, "jtop", "__init__.py")) as fp:
83
82
  version = VERSION
84
83
 
85
84
 
86
- def install_services(copy=False):
85
+ def install_services():
87
86
  """
88
87
  This function install all services in a proper folder and setup the deamons
89
88
  """
@@ -96,18 +95,12 @@ def install_services(copy=False):
96
95
  for f_service in list_services():
97
96
  folder, _ = os.path.split(__file__)
98
97
  path = root + os.path.basename(f_service)
98
+ print("Linking {file} in {path}".format(file=os.path.basename(f_service), path=path))
99
99
  # remove if exist file
100
100
  if os.path.exists(path):
101
101
  os.remove(path)
102
- # Copy or link file
103
- if copy:
104
- type_service = "Copying"
105
- copyfile(folder + "/" + f_service, path)
106
- else:
107
- type_service = "Linking"
108
- os.symlink(folder + "/" + f_service, path)
109
- # Prompt message
110
- print("{type} {file} -> {path}".format(type=type_service, file=os.path.basename(f_service), path=path))
102
+ # Create a symbolic link
103
+ os.symlink(folder + "/" + f_service, path)
111
104
 
112
105
 
113
106
  class PostInstallCommand(install):
@@ -115,8 +108,6 @@ class PostInstallCommand(install):
115
108
  def run(self):
116
109
  # Run the uninstaller before to copy all scripts
117
110
  sp.call(shlex.split('./scripts/jetson_config --uninstall'))
118
- # Install services (copying)
119
- install_services(copy=True)
120
111
  # Run the default installation script
121
112
  install.run(self)
122
113
  # Run the restart all services before to close the installer
@@ -126,10 +117,10 @@ class PostInstallCommand(install):
126
117
  class PostDevelopCommand(develop):
127
118
  """Post-installation for development mode."""
128
119
  def run(self):
120
+ # Install services
121
+ install_services()
129
122
  # Run the uninstaller before to copy all scripts
130
123
  sp.call(shlex.split('./scripts/jetson_config --uninstall'))
131
- # Install services (linking)
132
- install_services()
133
124
  # Run the default installation script
134
125
  develop.run(self)
135
126
  # Run the restart all services before to close the installer