-
Notifications
You must be signed in to change notification settings - Fork 2
/
vcgencmd
executable file
·63 lines (61 loc) · 2.09 KB
/
vcgencmd
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
#!/bin/sh
# -*- coding: us-ascii -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# try and keep this pure bourne shell
# minimal clone of raspberry tool vcgencmd
# for use with Android rpicheck on;
# Generic Linux, Armbian, Odroid, Pine64, Rock64 and other SBCs
# Does not fully implement Raspberry Pi version, silently exits
# on unhandled parameters. See README.md for debugging tips.
command=$1
case ${1} in
measure_clock)
case ${2} in
arm)
# awk is probably overkill....
value=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq | awk '{print $1 * 1000}'`
echo 'frequency(45)='${value}
exit
;;
core)
value=0 # TODO / FIXME
echo 'frequency(1)='${value}
exit
;;
# TODO anything else thrown an error/debug
esac
exit
;;
measure_temp)
# awk is probably overkill....
value=`cat /sys/class/thermal/thermal_zone0/temp | awk '{printf "%.3f\n", $1 / 1000}'`
# NOTE RasPi Check expects floating point result, integer result displays as 0 degrees in RasPi Check v1.8.12
echo 'temp='${value}"'C"
exit
;;
measure_volts)
case ${2} in
core)
value=0 # TODO / FIXME
echo 'volt='${value}'.0000V'
exit
;;
# TODO anything else thrown an error/debug
esac
;;
version)
# kern will pobably get truncated in raspicheck output
# appears to trucate about 31 characters
# but will truncate first word and not the end two?
kern=`uname -r|sed 's/-/_/'`
arch=`uname -i`
board=`grep BOARD= /etc/*elease* |head -1 |cut -d= -f2`
echo 'Nov 4 2018 16:31:07'
echo 'Copyright (c) 2020 clach04'
#echo 'version rock64_TODO (clean) (release)'
# custom format, to get something useful out
#echo "version ${kern} (${arch}) (${board})"
echo "version ${kern} (${arch})"
exit
;;
esac