Skip to content

Instantly share code, notes, and snippets.

@whitequark
Created September 4, 2011 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whitequark/1193679 to your computer and use it in GitHub Desktop.
Save whitequark/1193679 to your computer and use it in GitHub Desktop.
A script to find differences in PCI configuration space on Linux
#!/bin/bash
set +e
if ! [ "`id -u`" == '0' ]; then
echo 'This script must be run as root'
exit
fi
mkdir -p diff-pci-configs-data
cd diff-pci-configs-data
for i in /sys/bus/pci/devices/*; do
hd $i/config >`basename $i`-before
done
echo "Do what you want, and press Enter."
read
for i in /sys/bus/pci/devices/*; do
hd $i/config >`basename $i`-after
echo ">>> `lspci -s $(basename $i)`"
diff -U0 `basename $i`-before `basename $i`-after
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment