Skip to content

Commit b9fda0c

Browse files
popcornmixpelwell
authored andcommitted
vcgencmd: Add utility from userland repo
This has been cut down to only support the mailbox interface as vchiq use is deprecated.
1 parent 5e903b9 commit b9fda0c

File tree

4 files changed

+453
-0
lines changed

4 files changed

+453
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ add_subdirectory(pinctrl)
1111
add_subdirectory(raspinfo)
1212
add_subdirectory(vclog)
1313
add_subdirectory(vcmailbox)
14+
add_subdirectory(vcgencmd)

vcgencmd/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
add_executable(vcgencmd vcgencmd.c)
4+
install(TARGETS vcgencmd RUNTIME DESTINATION bin)
5+
install(FILES vcgencmd.1 DESTINATION man/man1)

vcgencmd/vcgencmd.1

Lines changed: 287 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
.TH VCGENCMD 1
2+
.
3+
.SH NAME
4+
vcgencmd \- query the VideoCore for information
5+
.
6+
.
7+
.SH SYNOPSIS
8+
.SY vcgencmd
9+
.OP \-t
10+
.IR command \ [ params ]
11+
.YS
12+
.
13+
.SY vcgencmd
14+
.B \-h
15+
.SY vcgencmd
16+
.B \-\-help
17+
.YS
18+
.
19+
.
20+
.SH DESCRIPTION
21+
.B vcgencmd
22+
is a command line utility that can get various pieces of information
23+
from the VideoCore GPU on the Raspberry Pi.
24+
.
25+
.
26+
.SH OPTIONS
27+
.TP
28+
.B \-t
29+
Time how long the command takes to complete
30+
.
31+
.TP
32+
.BR \-h ", " \-\-help
33+
Show this information
34+
.
35+
.
36+
.SH COMMANDS
37+
To get a list of all the commands that
38+
.B vcgencmd
39+
supports, type
40+
.IR "vcgencmd\ commands" .
41+
Some of the more useful commands are described below.
42+
.
43+
.TP
44+
.BI vcos \ sub-command
45+
The
46+
.B vcos
47+
command has a number of sub-commands:
48+
.RS
49+
.TP
50+
.B version
51+
Displays the build date and version of the firmware on the VideoCore.
52+
.TP
53+
.B log status
54+
Displays the error log status of the various VideoCore software areas.
55+
.RE
56+
.
57+
.TP
58+
.B version
59+
Displays the build date and version of the firmware on the VideoCore.
60+
.
61+
.TP
62+
.B get_camera
63+
Displays the enabled and detected state of the official camera. 1 means yes, 0
64+
means no. Whilst all firmware (except cutdown versions) will support the camera,
65+
this support needs to be enabled by using the
66+
.I start_x
67+
boot option
68+
.BR [BOOT] .
69+
.
70+
.TP
71+
.B get_throttled
72+
Returns the throttled state of the system. This is a bit pattern - a bit being
73+
set indicates the following meanings:
74+
.TS
75+
tab(|);
76+
l l .
77+
Bit|Meaning
78+
\_|\_
79+
.T&
80+
n l .
81+
0|Under-voltage detected
82+
1|Arm frequency capped
83+
2|Currently throttled
84+
3|Soft temperature limit active
85+
16|Under-voltage has occurred
86+
17|Arm frequency capping has occurred
87+
18|Throttling has occurred
88+
19|Soft temperature limit has occurred
89+
.TE
90+
.IP
91+
A value of zero indicates that none of the above conditions is true.
92+
.IP
93+
To find if one of these bits has been set, convert the value returned to binary,
94+
then number each bit along the top. You can then see which bits are set. For
95+
example:
96+
.IP
97+
.EX
98+
0x50000 = 0101 0000 0000 0000 0000
99+
.EE
100+
.IP
101+
Adding the bit numbers along the top we get:
102+
.TS
103+
tab( );
104+
n n n n n n n n n n n n n n n n n n n .
105+
19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
106+
0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
107+
.TE
108+
.IP
109+
From this we can see that bits 18 and 16 are set, indicating that the Pi has
110+
previously been throttled due to under-voltage, but is not currently throttled
111+
for any reason.
112+
.
113+
.TP
114+
.B measure_temp
115+
Returns the temperature of the SoC as measured by the on-board temperature
116+
sensor.
117+
.
118+
.TP
119+
.BI measure_clock \ clock
120+
This returns the current frequency of the specified clock. The options are:
121+
.TS
122+
tab(|);
123+
l l .
124+
Clock|Description
125+
\_|\_
126+
arm|ARM cores
127+
core|VC4 scaler cores
128+
h264|H.264 block
129+
isp|Image Signal Processor
130+
v3d|3D block
131+
uart|UART
132+
pwm|PWM block (analog audio output)
133+
emmc|SD card interface
134+
pixel|Pixel valve
135+
vec|Analog video encoder
136+
hdmi|HDMI
137+
dpi|Display Peripheral Interface
138+
.TE
139+
.IP
140+
For example,
141+
.IR "vcgencmd measure_clock arm" .
142+
.
143+
.TP
144+
.BI measure_volts \ block
145+
Displays the current voltages used by the specific block.
146+
.TS
147+
tab(|);
148+
l l .
149+
Block|Description
150+
\_|\_
151+
core|VC4 core voltage
152+
sdram_c|
153+
sdram_i|
154+
sdram_p|
155+
.TE
156+
.
157+
.TP
158+
.B otp_dump
159+
Displays the content of the One Time Programmable (OTP) memory, which is part
160+
of the SoC. These are 32 bit values, indexed from 8 to 64. See the
161+
.BR raspi-otp (7)
162+
for more details.
163+
.
164+
.TP
165+
.BI get_mem \ type
166+
Reports on the amount of memory allocated to the ARM cores with
167+
.I vcgencmd get_mem arm
168+
or the VC4 with
169+
.IR "vcgencmd get_mem gpu" .
170+
.IP
171+
.B Note:
172+
On a Raspberry Pi 4 with greater than 1GB of RAM, the
173+
.I arm
174+
option is inaccurate.
175+
This is because the GPU firmware which implements this command is only aware of
176+
the first gigabyte of RAM on the system, so the
177+
.I arm
178+
setting will always return
179+
1GB minus the
180+
.I gpu
181+
memory value. To get an accurate report of the amount of ARM
182+
memory, use one of the standard Linux commands, such as
183+
.I free
184+
or
185+
.IR "cat /proc/meminfo" .
186+
.
187+
.TP
188+
.BI codec_enabled \ type
189+
Reports whether the specified CODEC type is enabled. Possible options for type
190+
are AGIF, FLAC, H263, H264, MJPA, MJPB, MJPG, MPG2, MPG4, MVC0, PCM, THRA,
191+
VORB, VP6, VP8, WMV9, WVC1.
192+
.IP
193+
MPG2, WMV9, and WVC1 currently require a paid for licence (see the
194+
.B [FAQ]
195+
for more info), except on the Pi4, where these hardware codecs are disabled in
196+
preference to software decoding, which requires no licence. Note that because
197+
the H265 hardware block on the Raspberry Pi4 is not part of the VideoCore GPU,
198+
its status is not accessed via this command.
199+
.
200+
.TP
201+
.BI get_config \ type|name
202+
This returns all the configuration items of the specified type that have been
203+
set in config.txt, or a single configuration item. Possible values for type
204+
parameter are
205+
.IR int ", " str ", "
206+
or simply use the name of the configuration item.
207+
.
208+
.TP
209+
.B get_lcd_info
210+
Displays the resolution and colour depth of any attached display.
211+
.
212+
.TP
213+
.B mem_oom
214+
Displays statistics on any Out Of Memory events occuring in the VC4 memory
215+
space.
216+
.
217+
.TP
218+
.B mem_reloc_stats
219+
Displays statistics from the relocatable memory allocator on the VC4.
220+
.
221+
.TP
222+
.B read_ring_osc
223+
Returns the curent speed voltage and temperature of the ring oscillator.
224+
.
225+
.TP
226+
.B hdmi_timings
227+
Displays the current HDMI settings timings. See
228+
.B [VIDEO]
229+
for details of the values returned.
230+
.
231+
.TP
232+
.B dispmanx_list
233+
Dump a list of all dispmanx items currently being displayed.
234+
.
235+
.TP
236+
.BI display_power \ 0|1|-1
237+
.TQ
238+
.BI display_power " 0|1|-1 display"
239+
Show current display power state, or set the display power state.
240+
.I vcgencmd display_power 0
241+
will turn off power to the current display.
242+
.I vcgencmd display_power 1
243+
will turn on power to the display. If no parameter is set, this will display
244+
the current power state. The final parameter is an optional display ID, as
245+
returned by
246+
.I tvservice -l
247+
or from the table below, which allows a specific display to be turned on or
248+
off.
249+
.IP
250+
.I vcgencmd display_power 0 7
251+
will turn off power to display ID 7, which is HDMI 1 on a Raspberry Pi 4.
252+
.TS
253+
tab(|);
254+
l l .
255+
Display|ID
256+
\_|\_
257+
.T&
258+
l n .
259+
Main LCD|0
260+
Secondary LCD|1
261+
HDMI 0|2
262+
Composite|3
263+
HDMI 1|7
264+
.TE
265+
.IP
266+
To determine if a specific display ID is on or off, use -1 as the first
267+
parameter.
268+
.IP
269+
.I vcgencmd display_power -1 7
270+
will return 0 if display ID 7 is off, 1 if display ID 7 is on, or -1 if display
271+
ID 7 is in an unknown state, for example undetected.
272+
.
273+
.
274+
.SH EXIT STATUS
275+
.
276+
.IP 0
277+
Command completed successfully
278+
.IP -1
279+
Problem with VHCI
280+
.IP -2
281+
VideoCore returned an error
282+
.
283+
.
284+
.SH SEE ALSO
285+
.B [DOCS]
286+
https://www.raspberrypi.org/\:documentation/\:computers/\:os.html#vcgencmd
287+
.

0 commit comments

Comments
 (0)