Connect Cinterion modem with SWWAN fails with unknown error
Sven Schwermer
sven at svenschwermer.de
Mon Mar 18 12:48:17 UTC 2019
Hi all,
>> Might this imply that we're talking about the initial bearer and that
>> when MM tries to connect, because it will attempt to close any existing
>> connection, the modem is telling MM "no"?
>>
>> We already know we need to be better about auto-detecting that the
>> initial bearer is active and should probably create a Bearer object to
>> represent it when we can figure it out. Then perhaps a connection
>> request for the same APN would just be NOP and return that already
>> created bearer? (perhaps Aleksander already implemented that, I recall
>> some discussion about it late last year)
>>
>
> More or less; for MBIM devices I implemented the support to show the
> initial LTE bearer information, and allow configuring it.
> But I didn't do anything yet for AT-based modems.
Is there any interaction with the modem other than the AT commands that are being logged at debug level? When I rerun all commands from the debug log with virtually identical timing, I can connect while the ModemManager fails. I ensured that the modem state is identical in both cases (+PBREADY received, PDP attached as seen by the changed APN name in the PDP list). I even verified that all replies by the modem are identical (except for the replies to AT+CCLK? Which is expected).
Since I run all AT commands just like the ModemManager and I succeed while MM doesn’t, I believe that there must be some other interaction. Perhaps via the CDC-ECM devices? I also made sure that ModemManager only talks to the first CDC-ACM which is identical to what I did in my script.
Here’s how I extracted the AT commands from the debug log (journal):
journalctl -u ModemManager -o cat | grep -E '(-->)|(<--)'
I then generated a script that replicates the AT commands via the following Python script:
import re
func = """
function cmd {
# params: cmd, expected reply, time
t=$(date +%s)
echo "##################################################"
echo "Sending command: $1"
local reply
reply=$(echo "$1" | /tmp/atinout - /dev/ttyACM0 -)
if [ "$(echo "$reply" | tr -d '[:space:]')" != "$(echo "$2" | tr -d '[:space:]')" ]; then
echo "Unexpected reply:"
echo "$reply"
echo "Expected:"
echo "$2"
fi
sleep $(awk "BEGIN{
delta = systime() - $t
wait = $3 - delta
print (wait > 0) ? wait : 0
}")
}
"""
regex_cmd = r'\[([\d.]+)\] \(ttyACM0\): --> \'(AT.*)<CR>\''
regex_reply = r'\[([\d.]+)\] \(ttyACM0\): <-- \'(.+)\''
cmds = []
with open('/Users/sven/ModemManager/cinterion.raw.txt', 'r') as f:
for line in f.readlines():
match = re.match(regex_cmd, line)
if match:
cmds.append({
"t": float(match[1]),
"cmd": match[2].replace('"', '\\"'),
"reply": ""})
match = re.match(regex_reply, line)
if match:
reply = match[2].replace('<CR>', '').replace('<LF>', '\n').strip()
reply = reply.replace('"', '\\"')
cmds[len(cmds)-1]["reply"] += reply
print("""#!/usr/bin/env bash
set -euo pipefail
""", func)
for i, cmd in enumerate(cmds):
t = 0
if i < len(cmds)-1:
t = cmds[i+1]["t"]-cmd["t"]
print(f'cmd "{cmd["cmd"]}" "{cmd["reply"]}" "{t}”')
Any suggestions what to test next are welcome :-)
Sven
More information about the ModemManager-devel
mailing list