This is a discussion on device connected within the Linux Networking forums, part of the Linux Forums category; Is there a way in say the /proc filesystem to tell if the ethernet media is actually connected or not? ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
In comp.os.linux.networking Michael Lodman
<jlodman@rainbow-networks.com> wrote: > Is there a way in say the /proc filesystem to tell if the ethernet > media is actually connected or not? I understand how to tell if the > device is there or no. You can use mii-tool and grep to prevent network services starting (dhcp on a laptop is a pain on boot otherwise). mii-tool eth0 | grep -q 'link ok' && dhclient -- Cameron Kerr cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/ Empowered by Perl! |
|
|||
|
Hi Michael,
> Is there a way in say the /proc filesystem to tell if the ethernet media is > actually connected or not? I understand how to tell if the device is there > or no. Whether or not a cable is connected is information available from the ethernet card's MII PHY. Depending on the card, this info is available to the linux driver, and you can usually see it reported in the kernel logs. I have never seen any ethernet driver implement it under a /proc entry, although it's not impossible. There are also some user-space tools you may find of interest: mii-diag, mii-tool and eth-tool, which talk to the mii via ioctls to the ethernet driver. regards, -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ Damion de Soto - Software Engineer email: damion@snapgear.com SnapGear - A CyberGuard Company --- ph: +61 7 3435 2809 | Custom Embedded Solutions fax: +61 7 3891 3630 | and Security Appliances web: http://www.snapgear.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ --- Free Embedded Linux Distro at http://www.snapgear.org --- |