xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Raspberry Pi command line tools vcgencmd All In One

Raspberry Pi command line tools vcgencmd All In One

vcgencmd

$ vcgencmd -h
$ vcgencmd --help
Usage: vcgencmd [-t] command
Send a command to the VideoCore and print the result.

  -t          Time how long the command takes to complete
  -h, --help  Show this information

Use the command 'vcgencmd commands' to get a list of available commands

Exit status:
   0    command completed successfully
  -1    problem with VCHI
  -2    VideoCore returned an error

For further documentation please see
https://www.raspberrypi.org/documentation/computers/os.html#vcgencmd
$ vcgencmd version
Jan  5 2023 10:48:31 
Copyright (c) 2012 Broadcom
version 8ba17717fbcedd4c3b6d4bce7e50c7af4155cba9 (clean) (release) (start)

vcgencmd commands

$ vcgencmd commands
commands="commands, set_logging, bootloader_config, bootloader_version, cache_flush, codec_enabled, get_mem, get_rsts, measure_clock, measure_temp, measure_volts, get_hvs_asserts, get_config, get_throttled, pmicrd, pmicwr, read_ring_osc, version, set_vll_dir, set_backlight, get_lcd_info, arbiter, otp_dump, test_result, get_camera, enable_clock, scaling_kernel, scaling_sharpness, hdmi_ntsc_freqs, hdmi_adjust_clock, hdmi_status_show, hvs_update_fields, pwm_speedup, force_audio, hdmi_stream_channels, hdmi_channel_map, display_power, memtest, dispmanx_list, schmoo, render_bar, disk_notify, inuse_notify, sus_suspend, sus_status, sus_is_enabled, sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom, mem_reloc_stats, hdmi_cvt, hdmi_timings, readmr, file, vcos, ap_output_control, ap_output_post_processing, vchi_test_init, vchi_test_exit, pm_set_policy, pm_get_status, pm_show_stats, pm_start_logging, pm_stop_logging, vctest_memmap, vctest_start, vctest_stop, vctest_set, vctest_get"

image

#!/usr/bin/env bash

# $ vcgencmd commands

<<EOF
vcgencmd commands
vcgencmd set_logging
vcgencmd bootloader_config
vcgencmd bootloader_version
vcgencmd cache_flush
vcgencmd codec_enabled
vcgencmd get_mem
vcgencmd get_rsts
vcgencmd measure_clock
vcgencmd measure_temp
vcgencmd measure_volts
vcgencmd get_hvs_asserts
vcgencmd get_config
vcgencmd get_throttled
vcgencmd pmicrd
vcgencmd pmicwr
vcgencmd read_ring_osc
vcgencmd version
vcgencmd otp_dump
vcgencmd set_vll_dir
vcgencmd set_backlight
vcgencmd get_lcd_info
vcgencmd arbiter
vcgencmd test_result
vcgencmd get_camera
vcgencmd enable_clock
vcgencmd scaling_kernel
vcgencmd scaling_sharpness
vcgencmd hdmi_ntsc_freqs
vcgencmd hdmi_adjust_clock
vcgencmd hdmi_status_show
vcgencmd hvs_update_fields
vcgencmd pwm_speedup
vcgencmd force_audio
vcgencmd hdmi_stream_channels
vcgencmd hdmi_channel_map
vcgencmd display_power
vcgencmd memtest
vcgencmd dispmanx_list
vcgencmd schmoo
vcgencmd render_bar
vcgencmd disk_notify
vcgencmd inuse_notify
vcgencmd sus_suspend
vcgencmd sus_status
vcgencmd sus_is_enabled
vcgencmd sus_stop_test_thread
vcgencmd egl_platform_switch
vcgencmd mem_validate
vcgencmd mem_oom
vcgencmd mem_reloc_stats
vcgencmd hdmi_cvt
vcgencmd hdmi_timings
vcgencmd readmr
vcgencmd file
vcgencmd vcos
vcgencmd ap_output_control
vcgencmd ap_output_post_processing
vcgencmd vchi_test_init
vcgencmd vchi_test_exit
vcgencmd pm_set_policy
vcgencmd pm_get_status
vcgencmd pm_show_stats
vcgencmd pm_start_logging
vcgencmd pm_stop_logging
vcgencmd vctest_memmap
vcgencmd vctest_start
vcgencmd vctest_stop
vcgencmd vctest_set
vcgencmd vctest_get
EOF

vcgencmd API docs

https://www.raspberrypi.org/documentation/computers/os.html#vcgencmd

# 电压太低,不能完全带动 CPU/GPU 会损坏 SD 卡 ⚠️
# 欠压检测 ✅
$ vcgencmd get_throttled
throttled=0x50000

欠压

https://www.raspberrypi.com/documentation//computers/os.html#get_throttled

image

https://github.com/raspberrypi/userland/tree/master/host_applications/linux/apps/gencmd

vcgencmd get_config <config>: this displays a specific config value, e.g. vcgencmd get_config arm_freq.

vcgencmd get_config int: this lists all the integer config options that are set (non-zero).

vcgencmd get_config str: this lists all the string config options that are set (non-null).

image

https://www.raspberrypi.com/documentation/computers/config_txt.html#what-is-config-txt

demos

$ vcgencmd display_power
display_power=1

$ vcgencmd measure_temp
# temp=45.6'C

$ vcgencmd measure_clock arm
# frequency(48)=600062000

$ vcgencmd get_throttled
# throttled=0x50005 ❌ 欠压

$ vcgencmd get_config arm_freq
arm_freq=1200

$ vcgencmd measure_clock arm
frequency(48)=600000000
$ vcgencmd get_config int
aphy_params_current=819
arm_64bit=1
arm_freq=1200
arm_freq_min=600
audio_pwm_mode=514
camera_auto_detect=1
config_hdmi_boost=5
core_freq=400
desired_osc_freq=0x387520
disable_commandline_tags=2
disable_l2cache=1
disable_overscan=1
display_auto_detect=1
display_hdmi_rotate=-1
display_lcd_rotate=-1
dphy_params_current=547
dvfs=3
enable_tvout=1
force_eeprom_read=1
force_pwm_open=1
framebuffer_ignore_alpha=1
framebuffer_swap=1
gpu_freq=300
init_uart_clock=0x2dc6c00
lcd_framerate=60
mask_gpu_interrupt0=3072
mask_gpu_interrupt1=26370
max_framebuffers=2
over_voltage_avs=0x1b774
pause_burst_frames=1
program_serial_random=1
program_usb_boot_mode=1
sdram_freq=450
total_mem=1024
hdmi_drive:0=2
hdmi_force_cec_address:0=65535
hdmi_force_cec_address:1=65535
hdmi_force_hotplug:0=1
hdmi_pixel_freq_limit:0=0x9a7ec80
$ vcgencmd get_config str
device_tree=-
overlay_prefix=overlays/
hdmi_cvt:0=
hdmi_cvt:1=
hdmi_edid_filename:0=
hdmi_edid_filename:1=
hdmi_timings:0=
hdmi_timings:1=

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

vcgencmd alias

$ sudo vim .bashrc
$ cat .bashrc
# 🚀
alias vcmv='vcgencmd measure_volts'
alias vcmt='vcgencmd measure_temp'
alias vcarm='vcgencmd measure_clock arm'

# 绝对路径✅
alias vcgt='/home/pi/vcgt.sh'

# update ✅
$ source ~/.bashrc
$ vcarm
frequency(48)=600000000
$ vcmv
volt=1.3125V
$ vcmt
temp=46.7'C

$ vcgt
✅ OK
cat ./vcgt.sh 
#!/usr/bin/env bash
# coding: utf8

bug='throttled=0x50005'
state=$(vcgencmd get_throttled)
# echo $state

# 没有空格 bug ❌
# if [$state == $bug]
# 有空格 OK ✅
# if [ $state == $bug ]
# 有空格 OK ✅
if [ $state == 'throttled=0x50005' ]
then
  echo "❌ Error"
else
  echo "✅ OK"
fi

# WIFI=$(ifconfig | grep "192.168")
# echo $WIFI

image

refs



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2023-06-04 11:41  xgqfrms  阅读(193)  评论(3编辑  收藏  举报