Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 101 additions & 71 deletions raspinfo/raspinfo
Original file line number Diff line number Diff line change
Expand Up @@ -8,88 +8,75 @@


display_info_drm() {
# If running X then can use xrandr, otherwise
# dump the /sys/class entries for the displays
if command -v xrandr > /dev/null &&
DISPLAY=${DISPLAY:-:0} xrandr --listmonitors &>/dev/null;
then
echo "Running (F)KMS and X"
echo

DISPLAY=${DISPLAY:-:0} xrandr --verbose
else
echo "Running (F)KMS, console"
echo

for card in /sys/class/drm/card[0-9]-*;
do
echo $card

# if kmsprint isn't installed print basic mode info
if ! command -v kmsprint > /dev/null; then
if [ -f $card/modes ];
then
cat $card/modes
else
echo "No modes found"
fi
fi

if [ -f $card/edid ];
then
base64 $card/edid
else
echo "No EDID found"
fi
echo
done
fi

# kmsprint is more useful, but not always installed
echo
if command -v kmsprint > /dev/null; then
kmsprint
echo
kmsprint -m
echo
kmsprint -p
else
echo "kmsprint is not installed. Install with: sudo apt install kms++-utils"
fi

echo

# dump the /sys/class entries for the displays
for card in /sys/class/drm/card[0-9]-*;
do
echo $card

if ! command -v kmsprint > /dev/null; then
if [ -f $card/modes ];
then
cat $card/modes
else
echo "No modes found"
fi
echo
fi

if [ -f $card/edid ];
then
base64 $card/edid
else
echo "No EDID found"
fi
echo
done

# dump the /sys/kernel/debug entries for the displays
cardfound=0
for card in `seq 0 9`;
do
if sudo test -f "/sys/kernel/debug/dri/${card}/state";
then
for hdmi in 0 1;
do
if sudo test -f "/sys/kernel/debug/dri/${card}/hdmi${hdmi}_regs";
then
echo "HDMI${hdmi}: $(sudo cat /sys/kernel/debug/dri/$card/hdmi${hdmi}_regs | grep HOTPLUG)"
for hdmi in 0 1;
do
if sudo test -f "/sys/kernel/debug/dri/${card}/hdmi${hdmi}_regs";
then
echo "HDMI${hdmi}: $(sudo cat /sys/kernel/debug/dri/$card/hdmi${hdmi}_regs | grep HOTPLUG)"
fi
done
echo
# dump the state if we don't have kmsprint
if ! command -v kmsprint > /dev/null; then
echo "/sys/kernel/debug/dri/$card/state:"
sudo cat "/sys/kernel/debug/dri/$card/state"
echo
fi
done
echo
echo "/sys/kernel/debug/dri/$card/state:"
sudo cat "/sys/kernel/debug/dri/$card/state"
echo
cardfound=1
cardfound=1
fi
done
if [ "$cardfound" == "0" ];
then
echo "kms state not found"
echo
fi
echo

}

display_info_legacy() {
# Legacy mode
echo "Running Legacy framebuffer"
echo

for card in `seq 0 9`;
do
F="/dev/fb${card}"
Expand All @@ -100,31 +87,64 @@ display_info_legacy() {
fi
done

disps=`tvservice -l | awk '/Display Number/{print substr($3,1,1)}'`
if command -v tvservice > /dev/null; then
disps=`tvservice -l | awk '/Display Number/{print substr($3,1,1)}'`

tmp=$(mktemp)
tmp=$(mktemp)

for display in $disps
do
echo
echo "Display: " $display
for display in $disps
do
echo
echo "Display: " $display

tvservice -v $display -s
tvservice -v $display -n
tvservice -v $display -m CEA
tvservice -v $display -m DMT
tvservice -v $display -s
tvservice -v $display -n
tvservice -v $display -m CEA
tvservice -v $display -m DMT

echo
tvservice -v $display -d $tmp > /dev/null
base64 $tmp
done
echo
tvservice -v $display -d $tmp > /dev/null
base64 $tmp
echo
done

rm $tmp
rm $tmp
else
echo "tvservice not installed"
fi

if pgrep Xorg > /dev/null &&
command -v xrandr > /dev/null &&
DISPLAY=${DISPLAY:-:0} xrandr --listmonitors &>/dev/null; then
DISPLAY=${DISPLAY:-:0} xrandr --verbose
echo
fi
}

display_info() {
# Check if we are running a KMS/DRM system

if [ -f /proc/device-tree/soc/firmwarekms@*/status ] &&
grep -q okay /proc/device-tree/soc/firmwarekms@*/status; then
KMS=fkms
elif [ -f /proc/device-tree/*/v3d@*/status ] &&
grep -q okay /proc/device-tree/*/v3d@*/status; then
KMS=kms
else
KMS=legacy
fi

if pgrep labwc > /dev/null; then
WIN=labwc
elif pgrep wayfire > /dev/null; then
WIN=wayfire
elif pgrep Xorg > /dev/null; then
WIN=Xorg
else
WIN=console
fi
echo "Using $WIN with $KMS"

if [ -d "/dev/dri" ];
then
display_info_drm
Expand Down Expand Up @@ -170,7 +190,17 @@ uname -a
cat /proc/cpuinfo | tail -3

echo "Throttled flag : "`vcgencmd get_throttled`
echo "Camera : "`vcgencmd get_camera`


echo "Camera Information"
echo "------------------"
echo

if command -v libcamera-hello > /dev/null; then
libcamera-hello --list
else
echo "Camera : "`vcgencmd get_camera`
fi

echo
echo "Videocore information"
Expand Down Expand Up @@ -275,7 +305,7 @@ echo "dmesg log"
echo "---------"
echo

dmesg | sed -e "s/\([0-9a-fA-F]\{1,4\}:\)\{7,7\}[0-9a-fA-F]\{1,4\}/y.y.y.y.y.y.y.y/g" | sed -e "s/[0-9a-fA-F]\{1,4\}:\(:[0-9a-fA-F]\{1,4\}\)\{1,4\}/y::y.y.y.y/g" | sed -e "s/\([0-9a-fA-F]\{2,2\}\:\)\{5,5\}[0-9a-fA-F]\{2,2\}/m.m.m.m/g"
sudo dmesg | sed -e "s/\([0-9a-fA-F]\{1,4\}:\)\{7,7\}[0-9a-fA-F]\{1,4\}/y.y.y.y.y.y.y.y/g" | sed -e "s/[0-9a-fA-F]\{1,4\}:\(:[0-9a-fA-F]\{1,4\}\)\{1,4\}/y::y.y.y.y/g" | sed -e "s/\([0-9a-fA-F]\{2,2\}\:\)\{5,5\}[0-9a-fA-F]\{2,2\}/m.m.m.m/g"


if grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]11[0-9a-fA-F]$" /proc/cpuinfo
Expand Down