Commit Graph

1822 Commits

Author SHA1 Message Date
Marcel Holtmann fd69b05542 isimodem: Fix size calculation for address array 2019-08-12 19:36:42 +02:00
Richard Röjfors cfac75a332 atmodem: Check for auto activated contexts during init
To detect if a context gets activated before we register
for unsolicited events we need to check if any is
already activated, and flag it auto activated.
2019-07-24 02:11:25 -05:00
Martin Hundebøll d97912f5f1 atmodem: gprs-context: parse list-less CGDATA response
The Quectel M95 and MC60 modems respond to AT+CGDATA=? with a single
+CGDATA="PPP", but the callback in gprs-context expects a list of
protocols.

Avoid falling back to the old-style ATD*99 by not expecting a list of
protocols for serial quectel modems.
2019-07-19 10:34:25 -05:00
Jonas Bonn 9b1d83eaea ubloxmodem: Add model entries for LARA R2 series 2019-07-19 02:46:57 -05:00
Jonas Bonn b4b74f009f ublox: network-registration atom
For uBlox modems, a bit of custom setup is required, but after that the
generic "atmodem" (27.007-compatible) method implementations are
sufficient.  This driver, therefore, just puts the custom probe method
into place and defers remaining functionality to the recently exported
atmodem implementations.
2019-07-19 02:45:05 -05:00
Jonas Bonn 819f89f955 ublox: be explicit about lack of IPv6
The TOBY L4 has no IPv6 support whatsoever.
2019-07-19 01:43:26 -05:00
Jonas Bonn a86d6ffede atmodem: export struct netreg
In order to do inheritance by composition.
2019-07-19 01:38:56 -05:00
Jonas Bonn 3e55559301 atmodem: export generic netreg funcs
An upcoming netreg driver for uBlox modems will need to override the
probe method in order to set itself up, but for further functionality
the "generic" AT implementations are sufficient.  The easiest way to do
this is to just set up a vtable with a custom probe implementation and
defer all other methods to the common/generic methods.

The problem is that the AT methods are not actually exported.  This
generic AT functionality was not intended to be hooked directly into
other drivers.

This patch exports all the methods of the atmodem network-registration
driver implementation so that they can be used as generic/common
implementations for other drivers.
2019-07-19 01:38:52 -05:00
Christophe Ronco 17bf6ac7c0 qmimodem: remember lac and cellid
Lac and cellid information are optional in ss_info notifications.
Remember them in order to give a correct information each time a
notification is received.
2019-07-19 01:19:23 -05:00
Martin Hundebøll 8be2adc908 atmodem: rename OFONO_VENDOR_QUECTEL_M95
Other serial connected modems (i.e the MC60 model) from is AT-compatible
with the M95 model, so rename the M95 vendor id to be common for both.
2019-07-17 10:25:51 -05:00
Martin Hundebøll 46616a52d9 atmodem: sms: add quectel m95 quirks
CNMA isn't mentioned in the m95 documentation, but trial'n'error has
revealed some details:
 * the CSMS query returns the list (0,128) instead of a range
 * CNMA is enabled by setting 128 as CSMS service
 * once enabled, SMS deliveries are acked by sending AT+CNMA without a
   value setting

Add m95 quirks to the atmodem driver, so that CNMA is correctly
detected, configured, and used.
2019-07-12 09:41:08 -05:00
Martin Hundebøll 181e8d3da7 atutil: guard call to g_hash_table_destroy()
Glib emits a warning when g_hash_table_destroy() is called on a NULL
pointer:

  GLib-CRITICAL **: 13:27:40.269: g_hash_table_destroy: assertion 'hash_table != NULL' failed

Add a check to avoid this warning.
2019-07-05 17:17:44 -05:00
Martin Hundebøll 35b61e3ec2 ubloxmodem: fix maybe-unitialized error
Fixes:

../git/drivers/ubloxmodem/gprs-context.c: In function ‘ublox_gprs_activate_primary’:
../git/drivers/ubloxmodem/gprs-context.c:339:2: error: ‘auth’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  snprintf(buf, sizeof(buf), "AT+UAUTHREQ=%u,%u,\"%s\",\"%s\"",
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    gcd->active_context, auth, username, password);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../git/drivers/ubloxmodem/gprs-context.c:324:11: note: ‘auth’ was declared here
  unsigned auth;
           ^~~~
2019-06-21 12:54:10 -05:00
Denis Kenzior 5ee73d9101 mbim: Fix warning
CC       drivers/mbimmodem/mbim-message.o
	 drivers/mbimmodem/mbim-message.c: In function ‘_iter_copy_string’:
	 drivers/mbimmodem/mbim-message.c:199:18: error: cast increases required
	 alignment of target type [-Werror=cast-align]
2019-06-21 12:47:18 -05:00
Antara Borwankar e794adb0f2 xmm7modem: disabling reporting of intermediate results for CGDATA
Setting <connect_flag> in AT+XDATACHANNEL set command to 0. This will
disable intermediate result reporting of "CONNECT" and "NO CARRIER"
on control channel.

This resolves the issue of getting failure response for offline-modem
since "NO CARRIER" is received as result of AT+CFUN operation instead
of "OK".
2019-06-20 11:21:25 -05:00
James Prestwood a6001c1153 isimodem: gprs-context: properly null terminate cd->password
It looks like a previous line was copied and cd->username was re-terminated
instead of password. This also fixes a compiler error when using GCC 9:

In function ‘strncpy’,
    inlined from ‘isi_gprs_activate_primary’ at drivers/isimodem/gprs-context.c:546:3:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ output may be truncated copying 53 bytes from a string of length 255 [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-06-17 13:49:53 -05:00
Antara Borwankar 999cf73282 atmodem: fix to activate context with cid zero
xmm7xxx based devices (among others) return 0 as cid for default
pdp context. Fix the atmodem gprs driver logic to work with such
devices by initializing last_auto_context_id to -1 instead of 0
to indicate a deactivated context.
2019-06-14 11:42:28 -05:00
Antara Borwankar 686e3fba83 xmm7modem: adding netmon changes for reporting neighbouring cell
Added netmon changes for xmm7modem driver to fetch neighbouring
cell information.
2019-06-07 11:41:37 -05:00
Tom Nguyen df36faccd9 qmimodem: change msg class none to store/notify
Change message class none configuration from directly delivering a new
message in the event indication to storing it in the modem's NV then
sending an event indication identifying the new message. Also, add
checking for stored, unread messages at boot up.

This fixes a scenario where the modem powers on, automatically
connects to the network, receives a message, and sends an indication
before oFono has fully initialized. Now, the message is saved and
retrieved after initialization.

This also helps with suspend/resume on platforms where the modem,
supports waking the host CPU upon SMS reception. And, the platform
design limitation is that the modem's interfaces (eg, cdc-wdm, wwan,
etc) disconnect on suspend and reconnect on resume. This causes oFono
to re-initialize and miss the message indication because it was sent
before oFono is ready. Now, the wake up message is saved and retrieved
after initialization.
2019-06-05 14:54:59 -05:00
Denis Kenzior 630e48465c atutil: Introduce at_util_open_device 2019-05-31 11:58:36 -05:00
Denis Kenzior 0d40114a14 qmi: Fix style issues 2019-05-24 12:27:27 -05:00
Denis Kenzior 765c6655f2 treewide: Use L_TFR macro 2019-05-24 11:55:38 -05:00
Denis Kenzior 4b8cc2fcac stemodem: Quiet warning about strncpy use 2019-05-16 15:10:09 -05:00
Antara Borwankar 90758c5ffc xmm7modem: enabling simtoolkit in modem driver
handled enabling of stk for xmm7modem vendor in atmodem
driver.
2019-05-16 10:44:44 -05:00
Antara Borwankar 41e1cfcd64 xmm7modem: handling of dual mode technology preference
Handled dual mode technology preference "umts,gsm" and
"lte,umts" for xmm7modem.
2019-05-16 10:40:45 -05:00
Richard Röjfors 9b1dae2e62 atmodem: Fix a race if a context get deactivated while read
When a context gets activated we read its settings, but
if the context gets deactivated during this time we should
not indicate that the context is activated when the settings
are received.
2019-05-08 09:38:11 -05:00
Denis Kenzior 74dc62b148 drivers: Silence strncpy use warnings 2019-04-30 11:35:14 -05:00
Denis Kenzior fbd9974998 qmimodem: Fix potential memory leak
In case strlen(ICCID) > 20, we simply return without freeing the ICCID
value first.
2019-04-29 14:20:25 -05:00
Denis Kenzior b126407632 mbmmodem: Remove unneeded if 2019-04-29 14:11:22 -05:00
Denis Kenzior 9da5779a90 stemodem: Remove unneeded if 2019-04-29 14:09:11 -05:00
Denis Kenzior 0b2de27727 telit: Remove unneeded if 2019-04-29 14:07:59 -05:00
Denis Kenzior ea6cd4e7fd huawei: Remove unneeded if statement 2019-04-29 14:06:58 -05:00
Denis Kenzior c13411da6f icera: Remove unneeded if statement 2019-04-29 14:06:27 -05:00
Denis Kenzior cdcb576692 hsomodem: Remove unneeded if statement 2019-04-29 14:06:19 -05:00
Denis Kenzior eef1f73cb3 swmodem: Remove unneeded if statement 2019-04-29 14:01:41 -05:00
Denis Kenzior c05cbf147d ifxmodem: Remove unneeded if statement
if (ctx->apn) always evalues to true since it is an array member
2019-04-29 14:00:42 -05:00
Denis Kenzior 88f2ae3869 atmodem: Remove unneeded if statement
if (ctx->apn) is always true since apn is an array variable
2019-04-29 13:59:36 -05:00
Antara Borwankar 413e6ecab0 xmm7modem: handling of IPv6 address for activated context
Handled IPv6 address after activating PDP context.
Received IPv6 address is of format addr + netmask in the same string
in the form of "a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12.a13.a14.a15.a16.
m1.m2.m3.m4.m5.m6.m7.m8.m9.m10.m11.m12.m13.m14.m15.m16"
2019-04-29 11:33:58 -05:00
Alexander Couzens 64df5344c5 qmi: netmon: fix crashs on get_rssi_cb when BER or RSSI are empty
The message can be emitted without the fields being present. In this case ber or rssi are 0
resulting in a null pointer deref.
2019-04-28 10:13:51 -05:00
Tom Nguyen 0ddb7c6e2f qmimodem: return all serial numbers
Some modems, eg. Quectel EC25E, return the ESN, IMEI, and MEID even
though they support only one network type in a region. Current serial
number query gives precedence to the ESN if it exists, and does not
consider the IMEI and MEID.

Add a check of the supported radio interfaces in deciding which
serial number to return. If radio interfaces are 3GPP based, then
return the IMEI, else return the ESN. If neither exist, return MEID
if available, else fail.
2019-04-16 11:51:37 -05:00
Richard Röjfors 64df539a27 ublox: gprs-context: Fix router mode IP settings.
The ublox modems always run DHCP when in router mode.
Unfortunately the code overwrote the IP settings with
static IP settings while activating.

Now we respect the networking_mode regardless if
we read settings during activation or read settings
phase.
2019-04-04 09:55:04 -05:00
Antara Borwankar c76b68d4bf xmm7modem: handling of dual sim single active feature
Handled DSSA use case for xmm7modem. Added driver function
to switch between available card slots for SIM.

Only one SIM will be active at a given time. On calling this
function the active SIM will be removed and the card slot made
inactive and SIM in the other card slot will be made active.

Use case is similar to a SIM swap/change where one SIM is replaced
another SIM in the same slot.
2019-04-02 10:34:11 -05:00
Jonas Bonn a55e797ba2 ublox: gprs-context: query networking mode for TOBY L2
The TOBY L2 may run in either "bridge" mode or "router" mode.  For this
model, query the configured mode so that the appropriate settings are
communicated when the context is activated.
2019-03-14 20:34:32 -05:00
Jonas Bonn efe1306ec2 ublox: TOBY L4 supports only router mode
The TOBY L4 supports only "router mode" where the modem presents a
network interface that one can run a DHCP client against.  Behind this
interface, the modem takes care of routing packets via NAT by:

i)  selecting the relevant context based on destination IP
ii) using the first activated context as the default route

In order to have the connection manager, thus, do the right thing, the
context only needs to report itself as being active and with the IP
settings set to method "dhcp".  There's no need for the connection manager
to know details like what IP address the context was assigned.

Tested with connman that does the right thing when it finds an active
"dhcp" context.
2019-03-14 20:34:32 -05:00
Jonas Bonn d393863486 ublox: gprs-context: take model parameter 2019-03-14 20:34:32 -05:00
Jonas Bonn 0c2afdd3f0 ublox: extend LTE driver
There are a couple of semi-independent changes here:

* use the 'vendor' parameter to pass the modem 'model'
* support TOBY L4 modem which uses a fixed CID for configuring the EPS
default bearer
* add the setup of authentication parameters that was recently added to
the atmodem LTE driver
2019-03-13 16:39:42 -05:00
Jonas Bonn 83834419e5 ublox: add TOBY L4 models 2019-03-13 16:38:55 -05:00
Jonas Bonn cfab42825d ublox: add model flag HAVE_USBCONF
This flag should be set on devices that support multiple USB profiles
and will be used to determine whether or not querying USB profiles is
appropriate/necessary.
2019-03-13 16:26:42 -05:00
Jonas Bonn d7844183c0 ublox: create model data structures
This sets up some device model data structures and adds some helpers for
manipulating them.  These data structures are a first step to trying to
support the large number of devices that ublox produces with a common
driver structure.
2019-03-13 13:48:54 -05:00
Jonas Bonn e70789534e atmodem: Remove TOBY_L2 vendor 2019-03-13 13:20:43 -05:00