Monday, October 21, 2013

Print system info for Raspberry Pi

To print system info of Raspberry Pi, we can use the shell script "" download here:

Before run, you have to modify its permission to be executable.

Print system info for Raspberry Pi
Print system info for Raspberry Pi

# raspberry-pi system information script
# One script that can tell you the RAM config, serial number, SD card size, 
# temperature, and codec entitlements. Work-in-progress!
# Requires bc to for quick calculation. (apt-get install bc on debian)

# check if run as a normal user - if so, exit.
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
    echo "$0 not running as root!"

# calculate the memory allocated based upon the GPU / system split
# in config.txt (gpu_mem=64) - use vcgencmd because text file contents may be
# different than actual memory split allocation!
sysmem=`/opt/vc/bin/vcgencmd get_mem arm  | sed 's/[A-Za-z]*//g' | cut -c 2-`
gpumem=`/opt/vc/bin/vcgencmd get_mem gpu  | sed 's/[A-Za-z]*//g' | cut -c 2-`
totalmem=`expr $sysmem + $gpumem`

# Model A shouldn't have the smsc95xx installed! Return 1 if it's a modelB
modelB=`lsusb -t | grep -c smsc95xx`
rpiSerialNum=`grep Serial /proc/cpuinfo | cut -d " " -f 2`

echo "*** system-info for raspberry-pi $VERSION ***************************************"
if [ "$modelB" = "1" ]
  echo "Model B serial $rpiSerialNum detected with $totalmem MB ($sysmem Sys/$gpumem GPU)"
  echo "Model A serial $rpiSerialNum detected with $totalmem MB installed ($sysmem sys / $gpumem gpu split)"

# Raw SD card capacity does not translate to usable space! May need resizing!
fdiskOutput=`fdisk -l /dev/mmcblk0 | grep GB | cut -d \  -f 3,4`
echo "SD card raw capacity: ${fdiskOutput:0:-1}"
echo " "
echo -n "Firmware version: "
/opt/vc/bin/vcgencmd version | grep -v Broadcom
echo " "
tm=`/opt/vc/bin/vcgencmd measure_temp`
tc=`echo $tm| cut -d '=' -f2 | sed 's/..$//'`
tf=$(echo "scale=1; (1.8*$tc)+32" | bc)
echo -e "temp:\t $tf'F ($tc'C)"
echo " "
#echo -e "temp:\t $(/opt/vc/bin/vcgencmd measure_temp)" ;
for src in arm core v3d uart emmc pixel hdmi ; do echo -e "$src:\t $(/opt/vc/bin/vcgencmd measure_clock $src)" ; done
echo " "
for id in core sdram_c sdram_p ; do echo -e "$id: $(/opt/vc/bin/vcgencmd measure_volts $id)" ; done
echo " "
for codec in MPG2 WVC1 ; do echo -e "$codec:\t $(/opt/vc/bin/vcgencmd codec_enabled $codec)" ; done

No comments: