[Click] cable check

Panos click at pgttso.best.vwh.net
Fri Feb 29 18:34:10 EST 2008


On Fri, 22 Feb 2008, Bart Braem wrote:

> On Friday 22 February 2008 12:43:06 pieter wuytens wrote:
>> is there a way to check if the cable is present in an eth0 if i plug out
>> the cable then click should detect this and switch to an other interface
>> eth1. how should i do this? i tried it with a ping and when the ping loses
>> packages then switch but this is really slow. so i hope there is a way to
>> do this faster in click
>
> You could script something with mii-tool, that's the linux tool to check for
> presence of a cable. But that's not Click of course.
>
> Regards,
> Bart
>

If your driver supports it, you can also check the file

/sys/class/net/eth0/carrier

(replace eth0 with whichever interface you want to check)

The e1000 driver does offer this status file.

Panos



More information about the click mailing list