1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #!/bin/rc
- fn verbose { 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){
- if(/^;/) continue
- if(/^[0-9A-F]/){
- vid=lower($1)
- vendor[vid] = $2
- }
- if(/^ [0-9]/){
- 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
- }
- }
- '
- }
- filter=cat
- if(~ $1 -v){
- filter=verbose
- }
- cd '#$/pci' && grep . *ctl | sed '
- s/ctl:/: /
- s/: 01/: disk 01/
- s/: 02/: net 02/
- s/: 03/: vid 03/
- s/: ([0-9])/: --- \1/
- ' | $filter
|