Commit Graph

8869 Commits

Author SHA1 Message Date
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 2bb87d88ff udevng: detect LARA R2 series 2019-07-19 02:47:29 -05:00
Jonas Bonn 9b1d83eaea ubloxmodem: Add model entries for LARA R2 series 2019-07-19 02:46:57 -05:00
Jonas Bonn a39944a5c0 ublox: use custom netreg atom 2019-07-19 02:45:10 -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 3a53f140cc ublox: add SMS support 2019-07-19 01:43:23 -05:00
Jonas Bonn 5559874592 ublox: add voicecall support 2019-07-19 01:42:45 -05:00
Jonas Bonn 353b7bc3e9 ublox: create only 1 gprs context
Some uBlox modems support multiple, simultaneously active contexts.  These
contexts are either bridged to the network interface or handled
transparently by the modem acting like a router.

The problem with this approach is that ofono and ofono clients (e.g.
mmsd) expect a dedicated _local_ network interface for each context.

As such, it doesn't make sense for ofono to set up the multiple gprs
contexts.
2019-07-19 01:42:15 -05:00
Jonas Bonn 5b1d6f4e13 ublox: determine gprs-context driver from network interface
Some u-blox devices present a USB network class device for data and some
just switch to PPP on (one of) the communication channel(s).  Whether
the atmodem or ubloxmodem gprs-context driver should be used depends on
whether or not the network interface is present; check this condition
directly when deciding which driver to us.
2019-07-19 01:41:43 -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
Martin Hundebøll 1c168e8338 test: process-context-settings: print settings to stderr
Prepare the test to print commands to execute and let the caller
evaluate those. In that way, more commands can be added to also set up
name servers and default routes without secretly breaking the existing
system network setup.
2019-07-19 01:22:00 -05:00
Martin Hundebøll 777ae04611 test: process-context-settings: use ip instead of ifconfig/route 2019-07-19 01:21:54 -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 e98af8127f quectel: add support for the Quectel MC60 modem
The modem is AT-compatible with the Quectel M95 modem, but also features
a GNSS module.
2019-07-17 10:27:31 -05:00
Martin Hundebøll 5a255d6e62 quectel: store model id in private data
Some Quectel models supports different features such as GNSS or
different URC strings. Add a field in the quectel data structure to be
used when adding support for said features.
2019-07-17 10:26:53 -05:00
Martin Hundebøll bac8a9cf8d quectel: enable call volume settings 2019-07-17 10:26:16 -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 8905150bda gatresult: strip trailing spaces from unquoted strings
Some vendors might print trailing spaces after unsolicited result codes.
Avoid duplicating and stripping the string after calling
g_at_result_iter_next_unquoted_string() by stripping the spaces in
gatresult instead.
2019-07-17 10:25:12 -05:00
Denis Kenzior c56b66bf4b gatchat: Fix use of unterminated strings
escaped_str was allocated of size escaped + 1.  But we were only
memsetting the first escaped characters.
2019-07-16 23:15:10 -05:00
Martin Hundebøll 57b4aa3678 quectel: initialize call, phonebook and sms when ready
The Quectel M95 modem issues a "Call ready" notification when call and
phonebook are ready, so set up a listener for that.

The only way to know when sms is ready is to issue QINITSTAT queries.
Since sms is always ready after call and phonebook, the queries are
initiated after creating call/phonebook.
2019-07-12 11:00:52 -05:00
Martin Hundebøll ded2915fd5 quectel: query device model to enable vendor quirks 2019-07-12 11:00:48 -05:00
Martin Hundebøll 47f6e8c3ad quectel: configure flow control when enabled 2019-07-12 10:54:21 -05:00
Martin Hundebøll 2f58421b64 quectel: support gpio to power on/off the modem
This adds support for configuring a gpio in udev to control the modem
power.

To enable gpio control, specify OFONO_QUECTEL_GPIO_CHIP and
OFONO_QUECTEL_GPIO_OFFSET in the udev environment, for example:

KERNEL=="ttymxc0", ENV{OFONO_DRIVER}="quectel", \
        ENV{OFONO_QUECTEL_GPIO_CHIP}="gpiochip2", \
        ENV{OFONO_QUECTEL_GPIO_OFFSET}="26"
2019-07-12 10:50:51 -05:00
Denis Kenzior 6a967b81c7 build: Add ell gpio sources 2019-07-12 10:50:51 -05:00
Martin Hundebøll 23a09f8559 quectel: add basic support for serial connected modems
Setup GSM 07.10 multiplexing using the kernel n_gsm line discpline
driver, and use the virtual tty devices as Aux and Modem channels.

The driver supports rts/cts on the underlying serial device. This is
enabled with OFONO_QUECTED_RTSCTS udev environment, e.g.:

KERNEL=="ttymxc0", ENV{OFONO_DRIVER}="quectel", \
        ENV{OFONO_QUECTEL_RTSCTS}="on"
2019-07-12 10:47:10 -05:00
Martin Hundebøll e41252d00b quectel: replace glib uses with ell 2019-07-12 10:17:12 -05:00
Martin Hundebøll 4fe04add08 quectel: unwrap call to at_util_open_device() 2019-07-12 10:16:45 -05:00
Martin Hundebøll a0a93da0f9 quectel: always print modem pointer in debug messages 2019-07-12 09:42:43 -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 47021f9950 quectel: fix initial channel/device configuration
The three-commands-in-one-go results in error on some quectel devices
(e.g. m95). Add semicolons between the commands to fix it.
2019-07-05 17:28:04 -05:00
Martin Hundebøll db74f0998a quectel: improve coding style 2019-07-05 17:17:47 -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 7f065625ca gatresult: include glib header
The gatresult data types embeds GSList members, and the function
prototypes uses glib types.

Add include of glib.h to allow use of gatresult.h without also including
glib.h
2019-07-05 17:17:41 -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
Antara Borwankar 90c312484f netmon: adding get functionality for neighbouring cell information
Handled the get neighbouring cell information function which returns
an array of signal strength of all neighbouring cells.
2019-06-07 11:40:59 -05:00
Antara Borwankar dbcd081a63 netmon: adding get function for neighbouring cell information
Added declaration of functions and structures required for getting
neighbouring cell information.
2019-06-07 11:19:15 -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 c1ccae7efc alcatel: Use at_util_open_device 2019-05-31 11:58:39 -05:00
Denis Kenzior 98ec74cf10 hso: Use at_util_open_device 2019-05-31 11:58:39 -05:00
Denis Kenzior e0ac26458e huawei: Use at_util_open_device 2019-05-31 11:58:39 -05:00
Denis Kenzior eab7d90572 icera: Use at_util_open_device 2019-05-31 11:58:39 -05:00
Denis Kenzior 2e544e6745 linktop: Use at_util_open_device 2019-05-31 11:58:39 -05:00
Denis Kenzior 1ff6e83db0 mbm: Use at_util_open_device 2019-05-31 11:58:39 -05:00