Skip to content

Commit 9790d31

Browse files
committed
show current pci driver
1 parent e652287 commit 9790d31

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lnxrouter

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,22 +698,31 @@ get_interface_pci_info() { # pci id / model / virtual
698698
local pci_id
699699
local pci_full
700700

701+
local pci_path
702+
local driver
703+
701704
device_path="$(readlink -f /sys/class/net/$1)"
705+
pci_path=$device_path/../..
702706

703707
if [[ "$device_path" == "/sys/devices/pci"* ]]; then
704708
pci_id="$(echo "$device_path" | sed 's/\//\n/g' | tail -n 3 |sed -n 1p)"
705709

706710
if which lspci >/dev/null 2>&1 ; then
707-
pci_full="$( lspci -D -nn | grep -E "^$pci_id " )"
708-
echo " PCI: $pci_full"
711+
pci_full="$( lspci -D -nn -s "$pci_id" )"
712+
echo -n " PCI: $pci_full"
709713
else
710-
echo " PCI: $pci_id"
714+
echo -n " PCI: $pci_id"
711715
fi
712716
elif [[ "$device_path" == *"/virtual/"* ]]; then
713717
echo " virtual interface"
714718
fi
719+
720+
if [[ -d "$pci_path/driver" ]] ; then
721+
driver=$(readlink -f "$pci_path/driver" | sed 's/\//\n/g' | tail -n 1)
722+
echo -n " System-already-loaded driver: $driver"
723+
fi
724+
echo ""
715725
# TODO usb
716-
# TODO current driver
717726
}
718727

719728
alloc_new_vface_name() { # only for wifi

0 commit comments

Comments
 (0)