Detecting and using wired network when available

Kareem Shehata kshehata-XAaQGU7qChDQT0dZR+AlfA at public.gmane.org
Fri Jul 9 15:25:59 UTC 2010


On 2010-07-08, at 15:54 , Daniel Hedlund wrote:
> 
> I'm assuming that the you don't have any programs that are monitoring
> the wired network interface for changes in state; it's just a static
> IP address that has been created with ifconfig/ip and is never removed
> or brought down automatically.

Yup.  We have our own scripts that set-and-forget the network config.

> Are you running any particular distribution/project on the embedded
> device?  I'm not sure what tools are available to you, but check if
> 'ifplugd' is availabl.  It's designed to detect and configure devices
> when the cable is plugged in and unconfigure it when unplugged.  In
> newer desktop-based distros, ifplugd has been mostly superseded by
> NetworkManager which I assume won't be available.

We use LTIB from Freescale to produce what is essentially a custom build.  I don't see a package for ifplugd, but I can probably build it and install it as needed.

> If you can't find ifplugd, perhaps you can create a script that
> monitors the network status via ethtool the /sys filesystem (depending
> on kernel version):
> /sys/class/net/<DEVICE>/carrier ("0" or "1")
> /sys/class/net/<DEVICE>/operstate ("up", "down" or "unknown")

Thank for the pointer to those!  I'd been looking under /sys/platform/<NIC>.  Would you happen to know how to get udev to respond to changes in the operstate?  That would essentially do the trick: a udev rule to trigger a script whenever the link state changes.

-kms

--
Kareem Shehata
kshehata-XAaQGU7qChDQT0dZR+AlfA at public.gmane.org
Aeryon Labs Inc
519-489-6726 x254

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20100709/6b5661ed/attachment.html>


More information about the Legacy mailing list