On Fri, Jul 18, 2003 at 11:13:12PM +0300, Itay 'z9u2K' Duvdevani 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?
> 
> I need this for the internet tool (http://iwiz.linux-kinneret.org), I want to 
> be able to present to the user this information so he would know which 
> interface his modem is connected to more easily, in case he have more then 
> one ethernet card.
> 
> Thanks.
> 
> -- 
> Regards,
> Itay 'z9u2K' Duvdevani, GNU/Linux Kinneret.
> Public GPG Key: ftp://ftp.berlios.de/pub/kinneret/z9u2k.asc
> 
> 
> =================================================================
> 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]
> 

It seems that for Redhat machines the following command:

kudzu -s -p

produces the output:

.
.
.
class: NETWORK
bus: PCI
detached: 0
device: eth
driver: tulip
desc: "Linksys|Network Everywhere Fast Ethernet 10/100 model NC100"
vendorId: 1317
deviceId: 0985
subVendorId: 1113
subDeviceId: 1216
pciType: 1
.
.
.

This is what you wanted but I realise that it is only a solution for Redhat systems. 
Whats more, if Redhat changes the program you'll be left stranded I would look at the 
source code for the kudzu program and see how Redhat do it though.
-- 
"Cut your own wood and it will warm you twice"
        Regards, Yoni Rabkin

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to