-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 18 Jul 2003 23:13:12 +0300, Itay 'z9u2K' Duvdevani <[EMAIL PROTECTED]> wrote: > > Hi, > I am looking for a way to do these two: > 1. Finding out how many eths the system have (eth0, eth1 ... ethn) > 2. Knowing the string of each eth as shown in lspci > > I'm trying to write an app that will output something like: > # ./geteths > You have 2 ethernet cards, > eth0: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ > eth1: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ > > Thought about counting the number of times the string 'Ethernet controller' > appears in lspci, that should give me the number of eths, shouldn't it? > > But how will I know the correct string for each eth? > is the eth numbering is as their order on the bus so that the first occurrence > of 'Ethernet controller' will hold the string for eth0, the second one for > eth1 etc?
Do grep -C1 Eth /proc/pci to find all (pci) NICs descriptions and their IRQ. You can correlate it with the output of ifconfig (it has the IRQ for each working NIC). I'm not sure, but I think the NICs order in /proc/pci is the eth<n> order (it seems so on several machines with more than one NIC). BTW. You can run this as unprivileged user (unlike mii-tool or lspci). Ehud. - -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ mailto:[EMAIL PROTECTED] Better Safe Than Sorry -----BEGIN PGP SIGNATURE----- Comment: use http://www.keyserver.net/ to get my key (and others) iD8DBQE/GsW5LFvTvpjqOY0RAgN1AJ9sKL15mUstjkxBIQScxCjsDrFOTQCfV9dq ULtEHu7tWY9+bcO4EN0K838= =oMB5 -----END PGP SIGNATURE----- ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]