What is supposed to happen to the rmnet interface when the radio is turned off (i.e. issuing a cm radio off on the command line)?
I’ve just tried that with a WP7702 running Legato 18.05.1 while I have an application with a TCP socket open. In my case, the network interfaces rmnet0 and bridge0 are both still up … and the write() call in my application is still happily consuming data (although it’s not going up the stick!).
When the radio is turned off, I would have expected the rmnet0 interface to have gone away, and my write() call to start failing (probably with SIGPIPE or EPIPE errors).
cm data returns not connected and the log notes that the device is not registered to the network.
I would expect the rmnet0 interface to disappear and fdMonitor process to fault a lot earlier than 22 minutes after the radio is turned off.
Further debug shows that the POLLERR message is only indicating that the write buffer is full (essentially that the last write operation failed). I would be expecting and EPIPE or “Resource Not Available” message from the write() or from the POLLERR event.
Per understanding, “rmnet0” and “bridge0” is there since boot up, they will be there regardless radio state.
Instead WP7702 establish data connection over rmnet_dataX (i.e. rmnet_data0), please try monitor if you have these interfaces after “cm data connect”.
For write(), I think it is normal behavior, the write() is actually putting data in buffer even network is not available, until buffer full or socket timeout/close.
The buffer size depends on SO_SNDBUF.
For your case, I guess you may register the callback, i.e. le_mrc_AddNetRegStateEventHandler(), le_mdc_AddSessionStateHandler(), to determine if data connection is available and to stop write() or to drop the socket.
Ta. I’ve gotten confused between the WP8548 (rmnet0 only) and the WP7702 (rmnet0 & friends).
I was only turning the radio on and off to simulate the WWAN link going away so I could test recovery handling…
I’m porting some existing socket code to Legato so things are somewhat tricky - but I’ll see if I can shoehorn the native legato network handlers into the code.
One of the issues I have is that the uplink may not always be going out the WWAN interface - on the FX30 (for example) it may be going out the ethernet interface.
I’ve used the le_data API before - it’s supposed to manage this - but in my view it’s broken as while you get an event for both interface UP and DOWN events, the interface name is ONLY provided when the event is a network UP (i.e. isConnected==1) - when the network goes down you have absolutely no idea which interface has just gone away. This is (in my view) worse than useless.
rmnet interface name Is given by modem side and we cannot control it up if up/down scripts. And the interface name is notified when interface is up and not when it is down.
And le_data_AddConnectionStateHandler() will not specify which interface is going down.
So can you try to use some way of awk/grep command to search in ifconfig output for which interface was earlier up and now has gone down