From c007a7d382f5164977517836a46909bd401fbb26 Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Thu, 23 Oct 2025 15:50:21 +0100 Subject: [PATCH 1/3] raspinfo: Improve display info output Explicitly report kms/fkms/legacy and labwc/wwayfire/Xorg and generally tidy up --- raspinfo/raspinfo | 158 ++++++++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 69 deletions(-) diff --git a/raspinfo/raspinfo b/raspinfo/raspinfo index d92dbf0..7cae1f2 100755 --- a/raspinfo/raspinfo +++ b/raspinfo/raspinfo @@ -8,49 +8,13 @@ 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 @@ -58,38 +22,61 @@ display_info_drm() { 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}" @@ -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 From 589a9680df52dcbd20da19e9bc317e3436b7a23f Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Thu, 23 Oct 2025 15:51:13 +0100 Subject: [PATCH 2/3] raspinfo: report libcamera-hello output if installed --- raspinfo/raspinfo | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/raspinfo/raspinfo b/raspinfo/raspinfo index 7cae1f2..4ea6a1b 100755 --- a/raspinfo/raspinfo +++ b/raspinfo/raspinfo @@ -190,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" From fc7ec253e630008fe540e654e85d42bea83cdf1b Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Thu, 23 Oct 2025 15:51:31 +0100 Subject: [PATCH 3/3] raspinfo: Add sudo to dmesg You can configure the kernel to require root to access dmesg. Lets use sudo anyway - we already do in other places in this script --- raspinfo/raspinfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raspinfo/raspinfo b/raspinfo/raspinfo index 4ea6a1b..e8f8a12 100755 --- a/raspinfo/raspinfo +++ b/raspinfo/raspinfo @@ -305,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