How to detect "no ethernet cable" in QNX 6.3.2 ?

How to detect “no ethernet cable” in QNX 6.3.2 ?

Is there any eth driver func available through io-net (in c/c++) ?

As far as I know, you have to issue a devctl() call with DCMD_IO_NET_GET_CONFIG command to /dev/io-net/enX. The driver effectively copies the current nic_config_t object to your address space, and the “flags” member contains a bit NIC_FLAG_LINK_DOWN that you can evaluate. The nicinfo program does just that.

HOWEVER, don’t rely on every driver setting that bit correctly and under all circumstances. For instance, with, we observed that it correctly sets this bit when in auto-negotiation mode. If you fix speed/duplex on the command line, it will always report “Link up” even if the cable is unplugged.

Best regards,

good to know that it is not much trustworthy;

are there any events from enX driver (to io-net)
when link flag changes state ?

I was wondering myself. Maybe there is, however, the network DDK doesn’t say anything, and scanning the sample code and network-related headers doesn’t tell anything in that direction. The only possibility I can think of is sending up an npkt_t object with the _NPKT_MSG flag set. But what to put in?

Any ideas?


Yes, the only way to get message on link flag change (from eth card driver)
is to write your own driver, or faster/easier way: add this func. in driver sources.

There is a library called “libdrvr” that ships with the network DDK and contains some functionality common to all network drivers. I think that is definitly the spot where to put such a function.

Maybe some people at QSSL read this. What is your opinion about this?

Best regards,