[ECOS] Re: connect ethernet cable at run-time

Jonathan Larmour jifl@jifvik.org
Thu Sep 24 16:26:00 GMT 2009

Grant Edwards wrote:
> On 2009-09-24, Lars Dahlin <haraxidix@gmail.com> wrote:
>>I want to be able to connect the ethernet cable and it
>>shouldn't be necesary to restart ecos.
> We've been using eCos for 10 years, and we've never found it
> necessary to restart eCos (or the network stack, or anything
> else) when the Ethernet link goes down/up.
>>As far as I know (please correct me if i'm wrong) incoming ip
>>and arp requests are handled by the thread cyg_netint. It
>>seems that this thread is put to sleep if the network cable is
>>not connected.
> Again, I've never seen that.  We connect/disconnect Ethernet
> cables all the time, and never have to restart anything.  
> We do have code in our Ethernet drivers that makes sure that
> the Ethernet MAC duplex setting is changed to match the PHY's
> negotiation results when a cable is plugged in, but I don't
> think that has anything to do with what you're talking about.

I think the issue may be that if you start the device with it 
disconnected, nothing _automatically_ will bring the interface up using 
BOOTP/DHCP. Static IP should probably be ok. That's a different scenario 
to being up and then being disconnected and reconnected as the interface 
already has an IP address (as long as it's reconnected within the DHCP 
lease expiry time).

I believe you should just be able to call init_all_network_interfaces() 
again, when your PHY spots the cable is inserted. If you don't have an 
interrupt for your PHY to detect that, you'll need to have a thread poll 
it. Note that init_all_network_interfaces needs to be run from a thread 
context in any case, not an ISR or DSR context.

--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list