Hello,

At the end, I implement in my application main loop the following procedure:

=> I get the current interface status using netlib_getifstatus() (devup)

=> check the link state using ioctl with the key SIOCGMIIREG and the
register MII_MSR.

=> I check the result with the MII_MSR_LINKSTATUS flag (linkup)

=> Then I performed the following verifications:
if (!devup && linkup) => netlib_ifup()
if (devup && !linkup) => netlib_down()

In fact, that's quite the same approach found in net_monitor. But, the
net_monitor cannot be called due the lack of interruption.

Best regards,

Flavio

Em qua., 19 de mai. de 2021 às 21:49, Flavio Castro Alves Filho
<flavio.al...@gmail.com> escreveu:
>
> Hello David,
>
> I will try this option.
>
> Thank you very much.
>
> Best regards,
>
> Flavio
>
>
> Em qua., 19 de mai. de 2021 19:28, David Sidrane <david.sidr...@nscdg.com> 
> escreveu:
>>
>> This https://github.com/apache/incubator-nuttx/pull/1924 was merged. It adds
>> the polling.
>>
>> This is the app https://github.com/PX4/NuttX-apps/pull/8  does the rest.
>>
>> It was not upstreamed because it was not everything others wanted and I
>> could not test what they wanted.
>>
>> David
>>
>> -----Original Message-----
>> From: Gregory Nutt [mailto:spudan...@gmail.com]
>> Sent: Wednesday, May 19, 2021 2:56 PM
>> To: dev@nuttx.apache.org
>> Subject: Re: Ethernet cable (network interface availability) detection
>>
>>
>> > Considering this scenario, is there any alternative approach that I
>> > could use to have this detection? Polling the phy, or something
>> > similar?
>>
>> As I recall, David Sidrane submitted a PR to do just this but it was not
>> incoporated.  I don't recall why.   I recall having some concerns that
>> polling the PHY in maintenance mode would interfere with normal
>> operational mode, but I think David demonstrated that there was not an
>> issue with that.
>>
>> I think these:
>>
>> https://github.com/apache/incubator-nuttx-apps/pull/402
>>
>> https://github.com/apache/incubator-nuttx-apps/pull/415



-- 
Flavio de Castro Alves Filho

flavio.al...@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves

Reply via email to