[svn-commits] tzafrir: branch tools/tzafrir/perl-sysstate r7721 - /tools/team/tzafrir/perl-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 22 11:33:31 CST 2009


Author: tzafrir
Date: Tue Dec 22 11:33:30 2009
New Revision: 7721

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7721
Log:
* Trim some irrelevant PCI devices
* Also include the pci_express bus. No idea if this is of any use, though.

Modified:
    tools/team/tzafrir/perl-sysstate/build_tools/dump_sys_state

Modified: tools/team/tzafrir/perl-sysstate/build_tools/dump_sys_state
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/perl-sysstate/build_tools/dump_sys_state?view=diff&rev=7721&r1=7720&r2=7721
==============================================================================
--- tools/team/tzafrir/perl-sysstate/build_tools/dump_sys_state (original)
+++ tools/team/tzafrir/perl-sysstate/build_tools/dump_sys_state Tue Dec 22 11:33:30 2009
@@ -99,12 +99,47 @@
 
 # FIXME: the following grab tons of files from sysfs. Any way to do with
 # less information?
+pci_dev_pat='/sys/devices/pci*'
 mkdir -p "$name/sys/devices"
-cp -a /sys/devices/pci* "$name/sys/devices/" 2>/dev/null
+cp -a $pci_dev_pat "$name/sys/devices/" 2>/dev/null
 
-for bus in astribanks xpds pci usb; do
+for bus in astribanks xpds pci pci_express usb; do
 	if [ -d /sys/bus/$bus ]; then
 		mkdir -p "$name/sys/bus/"
 		cp -a /sys/bus/$bus "$name/sys/bus/" 2>/dev/null
 	fi
 done
+
+# Remove PCI devices of irelevan classes:
+irrelevant_devs() {
+	grep . "$name"/$pci_dev_pat/0*/class "$name"/$pci_dev_pat/0*/0*/class \
+	| perl -n -e '# Perl provides commented regexes:
+		next unless m{/class:( # The following is a list of device classes
+			# that can be safely removed:
+			0x060000 | # Host bridge
+			0x030000 | # VGA compatible controller
+			0x038000 | # Display controller
+			0x040300 | # Audio device
+			0x060401 | # PCI bridge
+			0x060100 | # ISA bridge
+			0x01018a | # IDE interface
+			0x01018f | # IDE interface
+			0x0c0500 | # SMBus
+			0x060700 | # CardBus bridge
+			0x0c0010 | # FireWire (IEEE 1394)
+			# The following are not to be removed:
+			#0x0c0300 | # USB Controller (UHCI?)
+			#0x060400 | # PCI bridge
+			#0x0c0320 | # USB Controller (EHCI?)
+			#0x020000 | # Ethernet controller
+			#0x0c0010 | # Network controller: (Wifi?)
+		)$}x;
+		# Leave out just the name of the node:
+		s{/[^/]*$}{};
+		print;
+		print "\n"
+	'
+}
+
+rm -rf `irrelevant_devs`
+




More information about the svn-commits mailing list