From 56824abc9b36449477cf2a4081f27f0580babb02 Mon Sep 17 00:00:00 2001 From: macmpi <16296055+macmpi@users.noreply.github.com> Date: Fri, 29 May 2026 11:53:47 +0200 Subject: [PATCH] raspinfo: do not assume network interfaces names --- raspinfo/raspinfo | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/raspinfo/raspinfo b/raspinfo/raspinfo index 0947b8e..255a707 100755 --- a/raspinfo/raspinfo +++ b/raspinfo/raspinfo @@ -170,18 +170,7 @@ audio_info() { network_info() { ifconfig | 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-9]\{1,3\}\.\)\{3,3\}[0-9]\{1,3\}/x.x.x.x/g" | sed -e "s/\([0-9a-fA-F]\{2,2\}\:\)\{5,5\}[0-9a-fA-F]\{2,2\}/m.m.m.m/g" echo - if command -v ethtool > /dev/null; then - ethtool eth0 - echo - ethtool --show-eee eth0 - echo - ethtool -S eth0 - else - echo "ethtool not installed" - fi -} -wifi_info() { cat /proc/net/wireless 2>/dev/null || echo "/proc/net/wireless not available" echo if command -v rfkill >/dev/null; then @@ -190,8 +179,28 @@ wifi_info() { echo "rfkill not installed" fi echo + if command -v ethtool >/dev/null; then - ethtool -i wlan0 + # Using sysfs to identify physical interfaces + for iface in /sys/class/net/*; do + iface_name=$(basename "$iface") + # Check if device directory exists (indicates physical interface) + if [ -d "$iface/device" ]; then + echo "$iface_name interface:" + if [ -d "$iface/phy80211" ]; then + ethtool -i $iface_name + else + sudo ethtool $iface_name + echo + ethtool --show-eee $iface_name + echo + ethtool -S $iface_name + fi + echo + fi + done + else + echo "ethtool not installed" fi } @@ -269,8 +278,6 @@ echo network_info echo -wifi_info -echo echo "USB Information" echo "---------------"