When not using none_prefix for matching the responses of AT+XSIMSTATE
call, it will consume all notifications. And this includes the initial
SIM state that the modem sends at that point. Without this notification
the SIM will never be marked as inserted.
Since the udev support allows to specify a line discipline number as
part of the modem configuration, use that one and report and error if
it has not been set.
The IFX modem plugin uses a kernel based multiplexer. And to support
different line discipline numbers on different target platforms, allow
them to be specified as option:
KERNEL=="ttyIFX[0-9]*", ENV{OFONO_DRIVER}="ifx", ENV{OFONO_IFX_LDISC}="23"
The extra OFONO_IFX_LDISC option specifies to use line discipline 23
for the multiplexer setup. The number is just an example here and the
correct one will be different.
The +XSIM notifies us about missing or removed SIM. Use that for telling
the core if a SIM card is present or not. Besides that all other states
are treated as when a SIM card got inserted.
This supports a simple static multiplexer that is activated with setting
the line discipline 23 on the TTY. It is static, because the DLC numbers
are hardcoded.
This is a first attempt at the Infineon modem support. The support
is limited since it doesn't handle the setup of the multiplexer or
the different SIM states yet.
The recently introduced online support to huawei didn't work with my
Huawei E1552. The problem was that with command AT+CFUN=1;+CFUN=5
the modem didn't initialise the sim state properly.
To fix this I changed the logic so that CFUN=5 is called only after the sim
state has switched to a valid state. Now my Huawei E1552 works with connman
again.
PIN locked SIMs still won't work. The problem is that it takes some time for
the sim state to go to a valid state:
Sep 20 15:01:57 dell-m520 ofonod[12451]: Pcui:< \r\n+CPIN: READY\r\n\r\nOK\r\n
[...]
Sep 20 15:02:00 dell-m520 ofonod[12451]: huawei: invalid sim state in post online (0)
[...]
Sep 20 15:02:01 dell-m520 ofonod[12451]: Pcui:< \r\n^SIMST:1\r\n
I don't know why it takes so long to get a valid state.
There is also another issue, in "cold start" case the phonebook
initialisation fails:
Sep 20 14:34:24 dell-m520 ofonod[11939]: Pcui:> AT+CPBS=?\r
Sep 20 14:34:24 dell-m520 ofonod[11939]: Pcui:< \r\n+CME ERROR: SIM busy\r\n
But in "warm start" it seems to work:
Sep 20 14:38:59 dell-m520 ofonod[12091]: Pcui:> AT+CPBS=?\r
Sep 20 14:38:59 dell-m520 ofonod[12091]: Pcui:< \r\n+CPBS: ("SM","EN","ON")\r\n\r\nOK\r\n
I consider this as a minor issue and didn't investigate it at all.
On my Huawei E1552 when I plug in the modem (ie. cold start) with PIN locked
SIM, the sim state is 255 (HUAWEI_SIM_STATE_NOT_EXISTENT). As the modem
doesn't send ^SIMST notifications, poll the sim state until it's ready.
In theory it might be possible to do this better, for example follow
^BOOT notifications or something, but it's unknown what parameter we
should check for.
The IFX device detection is pretty static, but instead of using
a static configuration file it is important to know when the device
node is actually present. For this udev is perfect. Adding a simple
udev rule is all that it takes:
KERNEL=="ttyIFX[0-9]*", ENV{OFONO_DRIVER}="ifx"
With this rule for every TTY with the kernel name like ttyIFX0, a new
modem will be added and the IFX modem plugin driver requested for it.
Dell D5530 is an OEM version of F3507g. It has an annoying habit of
announcing itself to world with its own name. Another problem is some weird
+CGAP messages at the same time. It also crashes upon processing received
CBS messages.