Herbert Xu <[EMAIL PROTECTED]> wrote:
> 
> With PCI/USB devices, we really should be using the module system to
> autodetect (i.e., the hotplug approach).  There is no point in duplicating
> all the information in another list when the modules themselves have
> it.  To start with, just look at /lib/modules/2.4.19-386/modules.pcimap.

Here's a script that takes the list of modules and pcimap from the kernel
packages, mixes it with the description from pci.ids to produce a
ethpci.list for ddetect.

The advantage of this is that for all the PCI network devices that we
actually have modules for, we are guaranteed to have an entry in this
list with the correct module name.  It's also true that we won't have
an entry in this list if the card is not supported by one of our modules.

The modlist file can be obtained by doing

cat modules/nic-modules* > modlist

in an unpacked kernel-image-2.4.19-i386 source tree.

The resulting list when run against 2.4.19-3 can be downloaded from

http://gondor.apana.org.au/~herbert/debian/ethpci.list
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
#!/bin/sh

set -e

usage() {
        echo "Usage: $0 <modlist> <pcimap> <pciids>" >&2
        exit 1
}

cleanup() {
        [ $TMPDIR ] && rm -r $TMPDIR
}

mesh='
        function read() {
                while (1) {
                        if ((getline < f) <= 0) {
                                eof = 1
                                return
                        }

                        if (/^[^\t]/) {
                                v = substr($0, 1, 4)
                                h = v " " substr($0, 7)
                                continue
                        }

                        if (/^\t\t/)
                                continue

                        break
                }

                n = v substr($0, 2, 4)
                d = substr($0, 8)
        }

        BEGIN {
                f = ARGV[1]
                ARGV[1] = ""

                read()
        }

        {
                m = $1
                u = $2
                p = $3
                k = u p

                while (!eof && n < k)
                        read()

                if (v == u) {
                        if (h)
                                print h
                } else {
                        v = u
                        print v
                }
                h = ""

                print "\t" k "\tethernet\t" m "\t" (n == k ? d : p)
        }
'

[ $# -ge 3 ] || usage

modlist=$1
pcimap=$2
pciids=$3

trap cleanup EXIT
for i in INT HUP TERM; do
        trap "cleanup; kill -$i $$" $i
done
TMPDIR=$(mktemp -d)

sed 's%.*/%%; s/..$//' $modlist | sort > $TMPDIR/c
tail +2 $pcimap | sort | join -o 1.1,1.2,1.3 - $TMPDIR/c | sort -k 2,3 |
        sed -n 's/ 0x0000/ /; t n; :n; s/ 0x0000/ /; t g; b; :g; p' > $TMPDIR/d
sed -n '/^#/d; /^0000/,/^ffff/p' $pciids > $TMPDIR/e
awk "$mesh" $TMPDIR/e $TMPDIR/d


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to