Commit Graph

1600 Commits

Author SHA1 Message Date
Alexander Couzens 43febf13a4 qmimodem: sync the modem on enable
The qmi sync call release all previous resources.
qmi/discovery: only do the sync call when ctl service version >= 1.5
2017-10-02 06:56:15 +02:00
Alexander Couzens d7fda89cbc qmi/discovery: include control service into service list
There is no need to exclude it. It helps debugging because the service is now logged.
2017-10-02 06:56:15 +02:00
Alexander Couzens bfb71b4829 qmi/discovery: remove useless code 2017-10-02 06:56:15 +02:00
Alexander Couzens 5071dab4c2 [RFC] qmimodem: implement voice calls
The voice_generated.* files is an RFC how files should look like.
They aren't yet generated.
2017-10-02 06:56:15 +02:00
Alexander Couzens 5ebe118ad6 atutil.h: remove doublicated ofono_call_compare_by_status() 2017-10-02 06:56:15 +02:00
Alexander Couzens 2c802658e3 common,atmodem: rename & move at_util_call_compare_by_id to common.c
at_util_call_compare_by_id is used by several modem drivers.
2017-10-02 06:56:14 +02:00
Alexander Couzens 2bdcf3f0d0 common,atmodem: rename & move at_util_call_compare_by_status to common.c
at_util_call_compare_by_status is used by several modem drivers.
2017-10-02 06:55:33 +02:00
Alexander Couzens 0982b4c4e8 common: create GList helper ofono_call_compare
replaces at_util_call_compare (atmodem) and
call_compare (rild).
2017-09-12 11:53:07 +02:00
Alexander Couzens a18c892c64 qmimodem: register callbacks after netreg_register
When registering callbacks before ofono_netreg_register(), callbacks
will use the netreg api which might lead into undefined behaviour,
because certain fields aren't yet initilized.
2017-09-11 10:41:14 -05:00
Nishanth V 4590c695e0 rilmodem: netmon fix missing notify for g_ril_send 2017-09-11 10:37:52 -05:00
Clayton Craft cbac15cdd9 isimodem: Use correct callback for pin status 2017-09-11 10:37:06 -05:00
Nishanth V 25347b9e83 rilmodem: driver changes for netmon agent
Rilmodem driver updated to handle enabling
and disabling periodic serving cell updates
2017-09-08 15:07:06 -05:00
Denis Kenzior 0f2d1278c4 qmimodem: Fix whitespace issue 2017-09-08 09:56:32 -05:00
Jonas Bonn 054323d4ba qmi: provide AvailableTechnologies in radio-settings
This provides the list of available technologies in the radio-settings
atom.  The list is queried by the DMS Get Capabilities method; ofono
takes care of caching the available technologies for us so we don't need
to worry about this method being called excessively.
2017-09-08 09:48:42 -05:00
Alexander Couzens b81bdfe456 qmimodem: extract network time from serving system 2017-09-07 16:50:14 -05:00
Alexander Couzens 8d74986d6e qmimodem: add strength (in %) to the debug output 2017-09-07 16:49:00 -05:00
Jonas Bonn 76689b81d4 qmi: add helper to get int16_t result 2017-09-07 11:57:31 -05:00
Jonas Bonn 4ac537394e qmi: implement RAT selection
The QMI radio-settings atom was just a skeleton and did not even implement
the mandtory property TechnologyPreference.  As such, it probably should
never even have been registered for the modem.  Nonetheless, this patch
puts this mandatory property into place.

This is implemented via the 'Set System Selection' method by way of the
'mode' parameter.  This seems to best reflect the intention of the Ofono
API and works as expected when tested with a Quectel EC21.

Some notes:
i)  There is an alternative function called 'Set Technology Preference'
    which provides similar functionality.  This 'technology preference'
    is updated automatically when the 'system selection mode' is modified
    so everything seems to be in order.
ii) For the EC21, switching the underlying technology works seamlessly.
    There are indications, however, that some modems _might_ require a
    reset before changes take effect; that bridge will need to be crossed
    if reached.
2017-09-07 11:54:25 -05:00
Christophe Ronco b3e4837641 atmodem: correctly report lte bearer for huawei modems 2017-09-07 11:41:01 -05:00
Ankit Navik 2640e0a882 Add support for Intel xmm7xxx series modem driver
This adds driver as xmm7modem for radio-settings
2017-09-05 10:48:00 -05:00
Ankit Navik 7df48a5107 atmodem: Add lte atom driver
Adds atmodem driver for setting the default APN command.
The default APN is manage by config storage.
2017-09-05 10:44:22 -05:00
Matthijs Kooijman 8d690efa83 at/cdma/ifxmodem: Use /dev/net/tun to check for TUN support
Previously, these drivers would check /sys/devices/virtual/misc/tun to
see if TUN is supported, and bail out otherwise. However, the tun module
can sometimes be autoloaded by opening the /dev/net/tun file. In this
case the /dev file already exists, but the /sys file only gets created
after the modul is loaded.

Additionally, the ppp code does not use the /sys file, but only the
/dev file, so checking for the existence of the latter seems a better
indicator of expected success.
2017-08-22 23:24:59 -05:00
Alexander Couzens fb17995721 qmi/sms: require WMS version >= 1.2 for bearer calls
I've never seen a major 0 service. The gobi2000 comes with
WMS 1.0 and doesn't support the bearer command. Guessing
it's 1.2 required.
2017-08-22 10:38:14 -05:00
Alexander Couzens 49a7d0aa1b qmimodem: use a default RAT when registering
When registering to an operator ofono uses the old RAT.
In the case the modem is not connected to any network, this would use
QMI_NAS_NETWORK_RAT_NONE which results in the error OP_DEVICE_UNSUPPORTED.

Use QMI_NAS_NETWORK_RAT_NO_CHANGE instead to not define any preference.
2017-08-07 13:50:03 -05:00
Marcel Holtmann 9cdcf72994 ifxmodem: Fix GPRS activation command string buffer size 2017-07-11 10:43:59 -07:00
Marcel Holtmann 339e874212 telitmodem: Fix GPRS activation command string buffer size 2017-07-11 10:43:23 -07:00
Marcel Holtmann 6c936db4ae atmodem: Fix missing break statement for ublox driver 2017-07-11 10:42:59 -07:00
Alexander Couzens 417af0eaf2 qmimodem/sms: don't check for free ME space on receive
If the ME storage is full, the modem will reject new messages
with a SMPP RP-Error 'Protocol error, unspecific'.
It seems the qmimodem is first checking the ME storage for
free space, then deliver the SMS via QMI and not saving it
to the ME anyway.
Using QMI_WMS_STORAGE_TYPE_NONE it doesn't check for free space.

Tested-on: Quectel EC20
2017-05-30 17:31:25 -05:00
Alexander Couzens b5cc57775f qmimodem: add debug helper qmi_result_print_tlvs
qmi_result_print_tlvs prints the type and length field
of a result to DBG()
2017-05-30 17:29:13 -05:00
Denis Kenzior 2d6c4f9d02 qmi: Fix invalid memory access
When qmi_device_shutdown is used and the callback provided utilizes
qmi_device_unref, an access into already freed memory is triggered.

Sequence of events is:

1. timeout fires
2. glib calls timeout callback (e.g. shutdown_callback) which in turn
calls shutdown_func (gobi shutdown_cb) which in turn calls
qmi_device_unref()
3. qmi_device_unref calls g_source_remove, which doesn't call the
destroy callback (it is blocked)
4. qmi_device_unref then frees the memory used by device
5. glib then calls the source destroy callback (e.g. shutdown_destroy)
which results in just freed memory being used.

glib appears to always call the destroy callback, even if the source has
been removed previously.  So to work around the issue, delay the actual
g_free until the destroy callback is invoked.
2017-05-11 14:41:43 -05:00
Jonas Bonn f23ea6b45f qmimodem: set APN for LTE default bearer
Apparently, an empty APN in an ofono context means that that the context
cannot be activated.  connman definitely interprets it this way.

This patch sets a default name of "automatic" for the default bearer if
no other LTE APN is supplied (which is currently the case as the LTE
atom is not in place yet).  Without this, connman happily ignores the
context, even though it has been activated by ofono.
2017-05-04 11:00:24 -05:00
Jonas Bonn 4651a70285 qmi: activate default bearer context for LTE networks
When the modem attaches to an LTE network, a default bearer is
automatically negotiated using the "defalt profile" settings.  The
QMI modem, however, does not given any explicit indication that
the bearer exists; instead, we must assume its existence based on
the network registration state.

This patch extends the GPRS atom to signal the presence of a
default bearer when it detects network connectivity on an LTE
network.
2017-05-01 12:12:08 -05:00
Jonas Bonn 10854cb459 qmi: use named status values 2017-05-01 12:08:02 -05:00
Jonas Bonn ea7691f04b qmi: use shared services
Apparently it's not legal to create a QMI service multiple times for
a device.  I've been testing with a Quectel EC21 and here it works fine
to do so, but the general case would require "shared" services across
atoms.

This patch switches the users of the NAS and WDS services over to using
a "shared" service instead of each instatiating their own instance.
2017-05-01 12:07:41 -05:00
Jonas Bonn 81cb808daf qmi: watch packet status for spontaneous disconnection only
There are three principal ways for a context to become disconnected:

i)  deactivate_primary() is called
ii)  the network registration is lost and the context is cleaned up
via _detach_shutdown() (via release_all_contexts())
iii) the network decides to disconnect the context

We need to watch the packet status in order to detect case iii).  For
case i) and ii), stop_net will be called, the pkt_handle will be
cleared, and subsequent packet status notifications be ignored.

This patch makes it so that the packet status "disconnected" event
is only propagated when the pkt_handle has not been cleared, indicating
an unrequested disconnection.

This should fix a race reported by Christophe Ronco whereby the packet
status disconnect notification is called between activate_primary
(start_net) and it's callback (start_net_cb).
2017-05-01 12:05:54 -05:00
Vincent Cesson 0e7add9447 atmodem: Fix SMS reception for Gemalto modems
SMS reception is not working for Gemalto modems because of +CMT parsing.
PDU length is the first argument of +CMT URCs in Gemalto modems.

Add a switch case on vendor info to handle Gemalto case.
Also handle acknowledgment, +CNMA takes only one parameter.

CMT parsing is moved from at_parse_cmt() to at_cmt_notify(). This
function is modified to match the style of at_cmgr_notify() and it
includes a switch case for CINTERION modems.
2017-04-21 11:02:05 -05:00
Jonas Bonn d6704223d8 qmi: move rat_to_tech() into own module
We want to use this function from multiple atoms so this patch moves
it out to its own module for NAS-related helper functions.
2017-04-18 09:48:04 -05:00
Jonas Bonn c0273f9d85 qmi: add missing header inclusion 2017-04-18 09:47:39 -05:00
Jonas Bonn 27b527c4f9 qim: use named status value 2017-04-17 12:11:40 -05:00
Jonas Bonn 949f968676 qmi: implement detach_shutdown method
The detach_shutdown method is invoked to unconditionally release
an active context.  For QMI, this is equivalent to a call to
deactivate_primary.

This patch makes the callback to deactivate_primary optional and
implements detach_shutdown to simply call it.  When there is no
callback, the stop_net callback notifies ofono about the context
release via an asynchronous ofono_gprs_context_deactivated() call.
2017-04-17 12:09:48 -05:00
Jonas Bonn f0f5a19af5 qmi: free cb_data on error
...and move allocation of structure up to variable declarations to
match the pattern used elsewhere in the code.
2017-04-17 12:07:43 -05:00
Jonas Bonn 91b89f472f qmi: read_settings needs to call start network
For LTE networks, a default bearer is automatically activated when
the modem registers to the network.  QMI modems, however, do not
automatically enable the network interface just because the bearer
exists; a call to "start network" needs to be made in order to
get the packet handle before get_settings will return any data and
the network interface can be configured.

This patch makes read_settings call "start network" in order to
enable the interface for the default bearer.  No new bearer will
be created with this call and the settings for the bearer will come
from the default profile, irregardless of what parameters are passed
to the "start network" method.
2017-04-14 17:54:29 -05:00
Jonas Bonn ad39b9003b qmi: fix typo 2017-04-14 16:49:31 -05:00
Jonas Bonn 71372ba0b3 qmi: duplicate callback data correctly 2017-04-14 16:44:05 -05:00
Denis Kenzior 7a2e198fd7 qmi: Use destroy callback for context activate 2017-04-11 12:01:15 -05:00
Denis Kenzior f29a316c91 qmi: Use destroy callback for context deactivate
This ensures that cbd will be freed even if the device is hot-unplugged.
Also, this fixes a memory leak on the failure path inside stop_net_cb
2017-04-11 12:01:06 -05:00
Jonas Bonn ef9af151ee qmi: implement read_settings for automatic contexts
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.
2017-04-11 11:45:41 -05:00
Jonas Bonn 475b789f3d qmi: retrieve GPRS context parameters
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.
2017-04-11 11:43:16 -05:00
Jonas Bonn 55bd639ae1 qmi: add WDS parameter definition 2017-04-11 11:22:29 -05:00
Jonas Bonn a0b3a8e0b8 qmi: NAS definitions adjustment
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.
2017-04-11 10:22:57 -05:00