2009-06-11 7 views

Répondre

2

trouvé sur http://linuxhelp.blogspot.com/2005/10/find-speed-of-your-ethernet-card-in.html

lire programatically cette information et l'analyser, à la recherche de 100baseTx ou similaire

# mii-tool -v eth0 
eth0: negotiated 100baseTx-FD flow-control, link ok 
    product info: vendor 00:00:20, model 32 rev 1 
    basic mode: autonegotiation enabled 
    basic status: autonegotiation complete, link ok 
    capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 
    advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control 
    link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control 

aussi, sur la même article, vous pouvez utiliser et chercher la « vitesse: » ligne

#ethtool eth0 

Settings for eth0: 
    Supported ports: [ TP MII ] 
    Supported link modes: 10baseT/Half 10baseT/Full 
          100baseT/Half 100baseT/Full 
    Supports auto-negotiation: Yes 
    Advertised link modes: 10baseT/Half 10baseT/Full 
          100baseT/Half 100baseT/Full 
    Advertised auto-negotiation: Yes 
    Speed: 100Mb/s 
    Duplex: Full 
    Port: MII 
    PHYAD: 32 
    Transceiver: internal 
    Auto-negotiation: on 
    Supports Wake-on: pumbg 
    Wake-on: p 
    Current message level: 0x00000007 (7) 
    Link detected: yes 
4

Si vous voulez faire dans le code C, rechercher mii-tool.c

+0

L'information est faite par l'intermédiaire de la fonction ioctl appropriée et mii-tool.c fournit un exemple de cela. – rasjani

Questions connexes