write(9, "A", 1) = -1 EAGAIN

Jean-Christian de Rivaz jc at eclis.ch
Wed Sep 23 17:22:19 PDT 2015


Le 23. 09. 15 23:41, Dan Williams a écrit :
> On Wed, 2015-09-23 at 22:51 +0200, Jean-Christian de Rivaz wrote:
>> Hello,
>>
>> I use ModemManager 1.4.0 from Debian Jessie armhf on an embedded system
>> with a u-blox SARA-U270 modem over USB and the generic MM driver.
>> Sometimes MM fail to make the modem connected to the Internet because it
>> always get this:
>>
>> write(9, "A", 1) = -1 EAGAIN (Resource temporarily unavailable)
>>
>> Searching more on the system, I found the observations below:
>>
>> 1) This happens always when the modem try to connect. The registration
>> is not affected so far.
>>
>> 2) If it pass the connected state, the modem is not affected so far.
>>
>> 3) A tshark using usbmon show that the kernel don't send the expected
>> "A" char to the modem CDC.
>>
>> 4) The same tshark show that the modem still report +CIEV messages on
>> the same CDC.
>>
>> 5) Others CDC of the modem are still working well.
>>
>> 6) A restart of the ModemManager is enough to recover from this situation.
>>
>> 7) MM code have a kind of protection against this EAGIN in the form of
>> eagain_count:
>> http://cgit.freedesktop.org/ModemManager/ModemManager/tree/src/mm-port-serial.c#n593
>   We may also need a custom plugin for
> your ublox device if it has specific needs for the serial port for flow
> control and the like.  That's quite variable for actual serial modems
> (eg, ones that aren't necessarily USB connected), and MM has logic to
> allow plugins to handle port characteristics.
>

I found the following in the ublox AT commands manual:

14.5 Flow control &K
3 (default value and factory-programmed value): enable RTS/CTS DTE flow 
control
The software flow control (XON/XOFF) setting is not allowed on the USB 
interfaces, on the SPI interface and
on a multiplexer channel.

14.7 DTE-DCE local flow control +IFC
<DCE_by_DTE> 2 (default and the factory-programmed value): circuit 105 (RTS)
<DTE_by_DCE> 2 (default and the factory-programmed value): circuit 106 (CTS)
The software flow control (XON/XOFF) setting is not allowed on the USB 
interfaces, on the SPI interface
and on a multiplexer channel.

14.8 Set flow control \Q
3 (default value): DCE_by_DTE on circuit 105 (RTS) and DTE_by_DCE on 
circuit 106 (CTS)
The software flow control (XON/XOFF) setting is not allowed on the USB 
interfaces, on the SPI interface
and on a multiplexer channel. See the Appendix B.5 for all the behavior 
differences in respect to the
supported interfaces.

Since the SARA-U270 is connected on the USB bus in the system and that 
it use the vanilla default profile settings, I think:

1) The modem never sent a XOFF to the Linux driver as a control flow 
char. It could still have send a binary char that could have been 
interpreted as a XOFF by the kernel. While this could explain the 
write() = EAGAIN, this will not explain why MM can't read the +CEIV 
message from the modem and captured by tshark on the same CDC.

2) The modem expect RTS/CTS DTE/DCE signals. I don't know how this 
translate in the case of USB and how to check them. For some serial 
drivers there is the /proc/tty/driver/* files, but this is not the case 
of the cdc_acm driver.

So, at this stage I am still trying to understand why the write() return 
EAGAIN.

Regards,
Jean-Christian


More information about the ModemManager-devel mailing list