For LTE, a context is created automatically when the modem registers
to the network. The read_settings function is called for these
automatic contexts to get their configuration.
The GPRS context needs to be configured with connection parameters when
the bearer has been established. This was only partially implemented, so
this patch adds additional parameters to those passed to the context.
Calling the ps_state/cs_state alternatives *ATTACH_STATUS* was confusing
because there is also a status field in the *serving_system structure.
This patch does a minor rename and adds the appropriate definitions for
the status field.
qmi_device_shutdown allocated a new orphaned data structure and kicked
off a timeout to wait for the shutdown to complete. The logic was quite
racy, but the main issue was that the timeouts could not be canceled
when the underlying qmi_device object was destroyed. This resulted in
crashes.
This patch switches to first-past-the-gate mechanism. Since only the
modem driver should be issuing a qmi_device_shutdown call, this should
not be a limitation. The shutdown source is then tracked on the
qmi_device object itself and is canceled when the qmi_device object is
freed.
As an added bonus, the shutdown_destroy callback should now actually
function. Before it was simply never called.
struct discovery was allocated for every discovery procedure that was
kicked off, which itself allocated a structure. This patch uses a
class/subclass concept to only allocate a single structure per discovery
procedure.
Calling set_online(TRUE) for an AlwaysOnline modem should succeed; the
modem is, after all, in the requested state when the call returns.
Returning not_implemented is not necessarily wrong, but it's a bit ugly.
This function was never removing discovery instances because it was looking
them up in the wrong list. This led to some strangeness with the discovery
callbacks being invoked after the "failure" timeout of 5 seconds and
consequent failures with everything getting out of sync.
With this patch we fix the lookup to use the correct queue. There's also
a double-free in the function that was never being hit before because the
lookups never succeeded; fix that as well.
With this, service discovery and creation work as expected when testing with
an EC21.
Telit AT modem firmware (tested with UE910-EUR) generates
+CGREG: 0\r\n\r\n+CGEV: NW DETACH
after a context is de-activated and ppp connection closed.
Then, after a random amount of time (observed from a few seconds
to a few hours), an unsolicited +CGREG: 1 arrives.
Attempt to fix the problem, by sending AT+CGATT=1 once.
This does not re-activate the context, but if a network connection
is still correct, will generate an immediate +CGREG: 1.
...and disable old udev code by shorting it out in it's init() function.
The check_device function is augmented to differentiate between USB
and serial devices:
- if the device sits on a USB bus, the device is handled as before
- if not, an attempt is made to handle the device as a serial device
This adds, but does not hook up, support for simple serial modems. These
modems generally have only a single device node so are simpler than the
USB devices which generally have different device nodes for different
functions. These modems are currently handled by udev.c, but this
functionality will allow to remove that module completely in a later patch.
- A new "device_info" type is created called serial_device_info
- the function add_serial_device sets up a modem_info structure and a
serial_device_info for the device
- A reference to the device's udev node is saved in the device info
- The device driver is retrieved from the OFONO_DRIVER environment variable
which needs to be set up by some udev rule
- Setup functions are added for these types of devices: a common function
setup_serial_modem covers the generic (simple) case, whereas modems
with special requirements are given their own setup functions to handle
the special bits
- Modem destroy needs to know the "device_info" type in order to clean
up properly, so a 'type' value is set on the modem_info structure to
guide selection of the proper cleanup function
There are various device & service discovery tasks that are initiated
based on a qmi_device object. qmi_device object does not currently
keep track of these tasks. Unfortunately the qmi_device object can
go away at any time, and these tasks can become orphaned.
The result of this can lead to crashes. E.g. a discovery task timeout fires
after the qmi_device object has been destroyed. Since the object is no
longer valid, any accesses to it will likely result in a SEGFAULT.
This patch attempts to track all discovery tasks on the qmi_device
object itself, so that they can be cleaned up properly. This patch does
not handle the qmi_device_shutdown functionality.
Adding a modem boils down to finding the device in the hierarchy with
the OFONO_DRIVER property. The original code special-cased the property
being on the device itself rather than on a parent device. This patch
combines the two cases.
This patch simplifies and cleans up the check_usb_device function a bit
by doing the two following (slightly intertwined) things:
1) The parent "usb_device" is searched for early in this function and this
device will always have the ID_VENDOR_ID and ID_MODEL_ID properties.
As such, we can get them from this device and thereby be certain that
we _always_ have them available.
2) The logic of iterating the vendor_list table is cleaned up. It's
easier to follow and won't be any less efficient.
Telit QMI modems have a problem with the low-power operating modes.
After entering and leaving such a state, UIM service does not return.
The sim card is still marked as powered-down. The QMI interface does
not have a way to power it back on.
To avoid this, keep modems with the "AlwaysOnline" flag online
in the disable-modem and offline-modem procedures.
Telit QMI modems can return non-utf-8 characters in plmn-desc.
Observed with LE910-SVG and Verizon. When that happens, libdbus
will abort ofono.
If non-utf-8 characters are detected, use mccmnc string.
LTE modems (observed with Telit LE910 V1) can power on
already registered to a network. In that case, the SS_INFO
change notification will never arrive, and the gprs driver
will never be marked as attached.
To avoid this situation, read SS_INFO at probe time, and if
registered, mark the gprs driver as attached.
This was introduced by the previous patch:
drivers/qmimodem/devinfo.c: In function ‘get_ids_cb’:
drivers/qmimodem/devinfo.c:129:14: error: implicit declaration of function ‘strcmp’ [-Werror=implicit-function-declaration]
if (!str || strcmp(str, "0") == 0) {
On E3372 after a GPRS disconnection, modem AT channel (used by PPP) gets
disconnected (G_IO_HUP and G_IO_ERR are detected in received_data
in gatio.c).
After that all connection attempts fail because we are not able to send
any AT commands on modem channel (it is closed).
With this patch, when this behavior is detected, we close gprs context
driver, reopen AT channel and gprs context driver.
This plugin allows to provision gprs-context data based on MCC and MNC.
This is useful when provisioning using mbpi fails (either because you
are using a private APN or because there are multiple internet type context
for your operator in mbpi database).
Config file is STORAGEDIR/provisioning.
Config file should look like that:
[operator:MCC1,MNC1]
internet.AccessPointName=apn1
internet.Username=myUsername
internet.Password=myPassword
internet.AuthenticationMethod=pap
internet.Protocol=ipv6
[operator:MCC2,MNC2]
internet.AccessPointName=apn2
The only mandatory parameter for each operator is internet.AccessPointName.
Parameter description:
internet.AccessPointName: APN
internet.Username: Username
internet.Password: Password
internet.AuthenticationMethod: authentication method.
Possible values are:
- pap
- chap
Default is chap if unset.
internet.Protocol: protocol
Possible values are:
- ip: ipv4
- ipv6
- dual
Default is ip if not set.
All parameters are prefixed with internet to be able to extend this plugin
to other type of contexts (MMS, ...).
Command read_file_info on MC7304 always fails.
Using qmicli or AT command, I am able to read file info.
Qmicli command is:
qmicli -d /dev/cdc-wdm0 --uim-get-file-attributes=0x3f00,0x7fff,0x6fad
[(null)] Successfully got file '/dev/cdc-wdm0' attributes from the UIM:
Card result:
SW1: '0x90'
SW2: '0x00'
File attributes:
File size: 4
File ID: 28589
File type: transparent
Record size: 0
Record count: 0
Read security attributes: (always) (null)
Write security attributes: (single) adm
Increase security attributes: (always) (null)
Deactivate security attributes: (single) adm
Activate security attributes: (single) adm
Raw: 62:17:82:02:41:21:83:02:6F:AD:8A:01:05:8B:...
After a check of parameters sent by qmimodem driver and qmicli,
the only difference is on parameter "Session Information".
Session type sent by qmimodem driver is 'Card on slot 1'.
Session type sent by qmicli command is 'primary-gw-provisioning'.
Changing session type in qmimodem driver fixed problem (on this modem).
Comparing with what is done by qmili command
Some modems do not support AT+CGDATA="PPP",X to enter data state.
Use AT+CGDATA=? to detect these modems and for them use ATD*99***X#
to enter data state.
drivers/rilmodem/stk.c: In function ‘ril_stk_probe’:
drivers/rilmodem/stk.c:210:18: error: ‘data’ is used uninitialized in
this function [-Werror=uninitialized]
struct cb_data *cbd = cb_data_new(stk, NULL, data);
At least firmware version 12.00.405 on the UE910-EUR otherwise
closes the AT command port whenever the PPP connection is
dropped, and we'd be left in a funny state.
sending RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING after
stk atom is created so that modem will inititialize
sim toolkit by sending terminal profile to sim.