9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] better pci database
       [not found] <<1220d97ca772e1fc09a39649bd62f98a@coraid.com>
@ 2009-12-31  3:27 ` erik quanstrom
  0 siblings, 0 replies; 2+ messages in thread
From: erik quanstrom @ 2009-12-31  3:27 UTC (permalink / raw)
  To: 9fans

made into a contrib package.  contrib quanstro/pci.
also fixed the fact i'd started with an old version of pci.

- erik



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [9fans] better pci database
@ 2009-12-30 23:15 erik quanstrom
  0 siblings, 0 replies; 2+ messages in thread
From: erik quanstrom @ 2009-12-30 23:15 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

the database on sourceforge has about 3x the devices listed.
here's a little before-and-after

before:
	3.0.0:	net  02.00.00 14c1/0008   9 0:d800000c 16777216 1:00000000 16 2:d9000004 1048576 3:00000000 16
		Myricom Inc.
	4.0.0:	net  02.00.00 8086/1096  11 0:d9120000 131072 1:d9100000 131072 2:00002001 32
		Intel Corporation
	4.0.1:	net  02.00.00 8086/1096  10 0:d9160000 131072 1:d9140000 131072 2:00002021 32
		Intel Corporation
	7.1.0:	vid  03.00.00 1002/515e  11 0:d0000008 134217728 1:00003001 256 2:d9300000 65536
		ATI Radeon ES1000 Radeon ES1000
after:
	3.0.0:	net  02.00.00 14c1/0008   9 0:d800000c 16777216 1:00000000 16 2:d9000004 1048576 3:00000000 16
		MYRICOM Inc. Myri-10G Dual-Protocol NIC
	4.0.0:	net  02.00.00 8086/1096  11 0:d9120000 131072 1:d9100000 131072 2:00002001 32
		Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
	4.0.1:	net  02.00.00 8086/1096  10 0:d9160000 131072 1:d9140000 131072 2:00002021 32
		Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
	7.1.0:	vid  03.00.00 1002/515e  11 0:d0000008 134217728 1:00003001 256 2:d9300000 65536
		ATI Technologies Inc ES1000

instructions.  replace /rc/bin/pci with the attached.  replace
/lib/pci with the following, make executable and execute.

#!/bin/rc
{
	sed '/^$/q' pci
	hget http://pciids.sourceforge.net/v2.2/pci.ids |
	sed 's:(^	*[0-9a-f][0-9a-f][0-9a-f][0-9a-f])[ 	]+:\1	:g'
} >npci && mv npci pci
exit 0


- erik

[-- Attachment #2: pci --]
[-- Type: text/plain, Size: 1028 bytes --]

#!/bin/rc
# pci [-v] - dump pci configuration
rfork e
fn verbose {
	if (! test -f /lib/pci)
		echo pci: no /lib/pci >[1=2]
	awk '

	function lower(s) {
		gsub(/A/, "a", s)
		gsub(/B/, "b", s)
		gsub(/C/, "c", s)
		gsub(/D/, "d", s)
		gsub(/E/, "e", s)
		gsub(/F/, "f", s)
		return s
	}
	BEGIN{
		file="/lib/pci"
		FS="\t"
		while(getline <file > 0){
			if(/^[#;]/) continue
			if(/^[0-9A-Fa-f]/){
				vid=lower($1)
				vendor[vid] = $2
			}
			if(/^	[0-9A-Fa-f]/){
				did=lower($2)
				id[vid "/" did] = $3
			}
		}
		FS = " "
	}

	{
		print $0
		vid = $4
		sub(/\/.*/, "", vid)
		if(vid in vendor){
			s = vendor[vid]
			if($4 in id)
				s = s " " id[$4]
			print "\t" s
		}
	}
' | dd -conv sync >[2=]
}

filter=cat
if(~ $1 -v){
	filter=verbose
}
builtin cd '#$/pci' && grep . *ctl | sed '
	s/ctl:/:	/
	s/:	01/:	disk 01/
	s/:	02/:	net  02/
	s/:	03/:	vid  03/
	s/:	06/:	brg  06/
	s/:	0c\.03/:	usb 0c.03/
	s/:	0c\.05/:	smb 0c.05/
	s/:	([0-9])/:	---  \1/
' | $filter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-31  3:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <<1220d97ca772e1fc09a39649bd62f98a@coraid.com>
2009-12-31  3:27 ` [9fans] better pci database erik quanstrom
2009-12-30 23:15 erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).