Commit Graph

8869 Commits

Author SHA1 Message Date
Denis Kenzior aeeb321a72 AUTHORS: Mention Shweta's contributions 2020-07-08 11:49:10 -05:00
Shweta Jain d0c014111e gatchat: increase line buffer max size
Some modems might transfer results that are larger than the current
buffer.  Increase it.
2020-07-08 11:47:55 -05:00
Denis Kenzior ae8eb80d87 AUTHORS: Mention Sergey's contributions 2020-06-29 10:20:28 -05:00
Sergey Matyukevich 2807a5fe55 plugins: gemalto: enable LTE for ELS81x
Enable LTE atom for Cinterion ELS81x modems.
2020-06-29 10:20:01 -05:00
Sergey Matyukevich 28d4be1af2 plugins: udevng: detect Centirion ELS81x modem
Enable detection of Centirion ELS81x modem.
2020-06-29 10:20:01 -05:00
Jimmy Gysens b513bf8d33 huawei: fix AT^SYSCFGEX acqorder "0201"
Commit 6c574ee24a ("huawei: the AT^SYSCFGEX
command supports additional modes") has a mistake for acqorder "0201". It
should be UMTS and GSM preferred.
2020-06-26 10:30:10 -05:00
Jimmy Gysens c83d693097 gprs: clean context properly
After a context is detached, the context is not properly cleared. In
addition to releasing the context:

- Reset the context settings (IP, DNS, interface, ...).
- Signal the Active flag as false.
2020-06-25 12:04:54 -05:00
Jimmy Gysens ef7e5f016b huawei: send restore settings command on startup
When initializing a Huawei device, send the AT&F0 command to restore the
default AT settings on device restart.

Huawei stores all APN settings, which can cause issues when changing the
APN. The AT&F0 command makes sure the device starts from a clean state.
2020-06-25 11:36:20 -05:00
Denis Kenzior b1d9be030c AUTHORS: Mention Jimmy's contributions 2020-06-25 11:35:09 -05:00
Jimmy Gysens 6c574ee24a huawei: the AT^SYSCFGEX command supports additional modes
- LTE and UMTS preferred (acqorder = 0302);
AT^SYSCFGEX="0302",40000000,2,4,40000000

- UMTS and GSM preferred (acqorder = 0201);
AT^SYSCFGEX="0201",40000000,2,4,40000000

For AT^SYSCFG, the modes are not available.
2020-06-25 11:33:58 -05:00
Slava Monich 47b52aab34 lte: Use the right D-Bus interface for property change signal 2020-06-18 15:37:45 -05:00
Slava Monich cf4a4a7bd0 cbs: Allow the last CBS fragment to be truncated
That does happen in real life.
2020-06-18 15:34:20 -05:00
Christophe Ronco 6cc1851b18 huawei: use AT^SYSCFG for radio setting operations on 3G only modems
AT^SYSCFGEX must be used on LTE Huawei modems to enable LTE support.
But some modems (or firmwares?) do not support this command and AT^SYSCFG
must be used to get/set radio settings.
This has been introduced in commit:
22adf6402c

There is a bug in this commit and AT^SYSCFGEX commands are used even on
modems not supporting it.
2020-06-11 09:30:04 -05:00
Denis Kenzior 9fd44f11c8 AUTHORS: Mention Marius' contributions 2020-06-10 14:23:28 -05:00
Marius Gripsgard 4e61dc355e qmimodem: Implement data capability bearer notify
This implements data capability bearer notify to qmi modem.
Since this is included in the serving system response this
just adds a new data extraction for dc.
2020-06-10 14:23:06 -05:00
Denis Kenzior a88d1120a4 doc: sim-api was missing SetProperty method 2020-05-26 22:23:58 -05:00
Lars Poeschel 1868dbf2b3 quectel: EC21 needs aux channel to be the first mux channel
The Quectel EC21 does only work correctly, if the mux channel used for
aux is the first mux channel. It does only put it's URC messages in the
first mux channel, so this has to be the aux channel in our case.
To be flexible on the mux order we introduce two arrays here, that then
contain the initialization data in their needed order.
Initialization data is then applied by for-looping over this array.
2020-05-26 22:22:09 -05:00
Denis Kenzior 2d991d8296 AUTHORS: Mention Lars' contributions 2020-05-21 08:28:45 -05:00
Lars Poeschel 8ce74ba07b quectel: EC21 add ussd with atmodem driver 2020-05-21 08:28:30 -05:00
Lars Poeschel f7f3b754ad voicecall: Quectel modem do not understand AT+CNAP 2020-05-21 08:28:20 -05:00
Lars Poeschel c7de38491d quectel: EC21 does not understand AT+QIURC
Because the Quectel EC21 does not understand the AT+QIURC command, we
leave that out during initialisation.
2020-05-21 08:28:09 -05:00
Lars Poeschel debd73639a quectel: Query the model before setting up the mux
This is a change for the EC21. It will require specific handling before
and right after setting up the mux. So this change prepares this. It
queries the modem model before the mux (CMUX) is activated.
2020-05-21 08:24:40 -05:00
Lars Poeschel c121ccebc2 quectel: use lte atom on EC21 2020-05-21 08:24:37 -05:00
Lars Poeschel 3c158ceee9 quectel: Add Quectel EC21 to known serial modems
This adds the Quectel EC21 to the known modems of the quectel driver and
therefore allows to use it with its serial interface.
2020-05-21 08:24:29 -05:00
JongSeok Won 48c5ab07af rilmodem: update call direction from the isMT value
oFono cannot determines the call of direction when the voicecall
is triggered in rilmodem
2020-04-02 18:09:55 -05:00
joey@joeyhewitt.com cf850de632 build: require dbus >= 1.6
dbus_validate_path() is used several times. dbus's NEWS says it was
added in 1.5.12.
2020-03-04 10:03:20 -06:00
Richard Röjfors 952f1d00be ublox: network-registration: Handle UREG unsolicited during poll
In the case a unsolicited indication for UREG was received
while the status was polled. The poll response failed to parse.
This since the unsolicited indication only carries one
parameter, while the poll response is expected to carry two.

Update the code to loop until the response is found.

The log below shows a case where this happened.

10:07:55 ofonod[520]: Aux: > AT+UREG?\r
10:07:55 ofonod[520]: Aux: < \r\n+CGREG: 4\r\n\r\n+UREG: 0\r\n\r\n+CIEV: 9,1\r\n
10:07:55 ofonod[520]: src/gprs.c:ofono_gprs_status_notify() /ublox_0 status unknown (4)
10:07:55 ofonod[520]: src/gprs.c:ofono_gprs_detached_notify() /ublox_0
10:07:55 ofonod[520]: Aux: < \r\n+UREG: 1,0\r\n
10:07:55 ofonod[520]: Aux: < \r\nOK\r\n
2020-02-14 11:24:14 -06:00
Denis Kenzior 8e78d4dba5 allowed-apns: Do not try to unregister unnecessarily
allowed-apns plugin will try to uregister the AllowedAccessPoints
interface whenever the sim state changes, even when not registered.
This results in the (benign) error being printed inside
ofono_modem_remove_interface:

Interface org.ofono.AllowedAccessPoints not found on the interface_list
2020-02-07 11:08:13 -06:00
Richard Röjfors 90dadace21 Instead of implementing an own copy of requesting and parsing
CREG, reuse the existing one from at-modem.
2020-02-07 10:49:10 -06:00
Antara Borwankar d90cfdd71c sim: handling crash in error scenario for SIM PIN query
In case of error in sim_pin_query_cb function. pin_type is set
to -1. This is causing segmentation fault in function
sim_passwd_name due to invalid index pin_type = -1. Fixing this
issue by handling error case before calling sim_passwd_name
function.
2019-12-20 12:46:18 -06:00
Antara Borwankar f76e1d75d0 xmm7xxx: modified handling of XSIM states for xmm modems
+XSIM:7 state as defined in xmm7560 functional AT specification
only indicates ready for attach.

+CPIN: READY is received after SIM is completely initialized.
Also indicating readiness of Phonebook and SMS. Hence moving the
creation of SMS and Phonebook atom to xmm7xxx_post_sim function.

+XSIM:4 PUK needed state was not handled. It must be handled
same as PIN needed state. Added handling of this case to
switch_sim_state_status function.
2019-12-20 12:32:39 -06:00
Richard Röjfors aa89c19a50 gprs: Update attach state on context deactivation for LTE
To be considered attached on LTE a context should be activated.
But in case the context got deactivated we did not update
the attached state, it remained attached.
That caused the connection manager to try to re-activate the
context manually, but for LTE thats done automatically.
In the case of ublox it returns errors, which is passed
on to the connection manager, which tries again and
again, until we get attached again.

It looked like this:
12:03:18 ofonod[547]: Aux: < \r\n+CIEV: 2,3\r\n
12:03:23 ofonod[547]: Aux: < \r\n+CIEV: 2,2\r\n

Deactivated

12:16:01 ofonod[547]: Aux: < \r\n+CGEV: NW PDN DEACT 4\r\n
12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgev_notify() cid 4, active cid: 4
12:16:01 ofonod[547]: src/gprs.c:ofono_gprs_context_deactivated() 0x1743e50 0x17424a8 4

Connection manager now try to activate, over and over again
because Attached remains TRUE

12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:01 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:01 ofonod[547]: Aux: < \r\nOK\r\n
12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:01 ofonod[547]: Aux: > AT+CGACT=1,1\r
12:16:01 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n
12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:01 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:01 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: No network service
12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:02 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:02 ofonod[547]: Aux: < \r\nOK\r\n
12:16:02 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:02 ofonod[547]: Aux: > AT+CGACT=1,1\r
12:16:02 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n
12:16:02 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:02 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:02 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: No network service
.
.
.
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:14 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:14 ofonod[547]: Aux: < \r\nOK\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:14 ofonod[547]: Aux: > AT+CGACT=1,1\r
12:16:14 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: No network service
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:14 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:14 ofonod[547]: Aux: < \r\nOK\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:14 ofonod[547]: Aux: > AT+CGACT=1,1\r

The context got activated again

12:16:14 ofonod[547]: Aux: < \r\n+CGEV: ME PDN ACT 4\r\n\r\n+CIEV: 9,2\r\n\r\n+CTZE: +04,0,"19/12/11,13:17:58"\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/network-registration.c:ctze_notify() tz +04 dst 0 time 19/12/11,13:17:58
12:16:14 ofonod[547]: src/network.c:ofono_netreg_time_notify() net time 2019-12-11 13:17:58 utcoff 3600 dst 0
12:16:14 ofonod[547]: Aux: < \r\n+CME ERROR: 100\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: Unknown error
2019-12-11 15:08:26 -06:00
Richard Röjfors 3b7d8e003e gprs: Don't modify the context if assign fails
There was an issue while running LTE and the connection
manager tried to activate the context with CID 1 while
it got automatically activated at the same time with
CID 4.

When the automatic activation happened ofono_gprs_cid_activated
got called which tried to assign the context, but that failed
since the driver context was considered in use
(by the activation call).
Eventhough it failed, the context was modified,
cid was set to 0 (making cid 1 leak).
Then release_context got called which clear pointers
assigned to the context.

A bit later the activation callback got called, in my case
activation failed. Due to the failure it tries to clean up
by calling context_settings_free, but unfortunately the pointers
where reset above causing ofono to segfault du to null pointer
derefs.

Instead we make sure assign_context does not touch the context
unless it succeeds. Then there is no need to call release_context
if assign fails.
That ensures the context being intact when the activation callback
gets called.

03:23:21 ofonod[545]: Aux: < \r\n+CGEV: ME PDN ACT 4\r\n\r\n+CTZE: +04,0,"19/12/10,04:25:03"\r\n
03:23:21 ofonod[545]: drivers/ubloxmodem/network-registration.c:ctze_notify() tz +04 dst 0 time 19/12/10,04:25:03
03:23:21 ofonod[545]: src/network.c:ofono_netreg_time_notify() net time 2019-12-10 04:25:03 utcoff 3600 dst 0
03:23:22 ofonod[545]: Aux: > AT+CGDCONT?\r
03:23:22 ofonod[545]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1

Connection manager requests activation, will mark the context in use and assign
it cid 1.

03:23:22 ofonod[545]: Aux: < \r\n+CGDCONT: 1,"IP","m2m.tele2.com","",0,0,0,0,0,0\r\n
03:23:22 ofonod[545]: Aux: < +CGDCONT: 4,"IP","m2m.tele2.com.mnc003.mcc248.gprs","100.69.174.133",0,0,0,0,0,0\r\n
03:23:22 ofonod[545]: Aux: < \r\nOK\r\n
03:23:22 ofonod[545]: drivers/atmodem/gprs.c:at_cgdcont_read_cb() ok 1
03:23:22 ofonod[545]: src/gprs.c:ofono_gprs_cid_activated() cid 4
03:23:22 ofonod[545]: Can't assign context to driver for APN.

Since its marked in use above, we fail to assign it cid 4. When that fails
the cid is cleared an all context pointers are set to NULL.

03:23:22 ofonod[545]: Aux: > AT+CGDCONT=1,"IP","m2m.tele2.com"\r
03:23:22 ofonod[545]: Aux: < \r\nOK\r\n
03:23:22 ofonod[545]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
03:23:22 ofonod[545]: Aux: > AT+CGACT=1,1\r
03:23:22 ofonod[545]: Aux: < \r\n+CME ERROR: 100\r\n
03:23:22 ofonod[545]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
03:23:22 ofonod[545]: src/gprs.c:pri_activate_callback() 0x853480
03:23:22 ofonod[545]: src/gprs.c:pri_activate_callback() Activating context failed with error: Unknown error

Activation callback, and it failed. Will try to clean up, but the pointers are
NULL'ed...

Dec 10 03:23:22 ofonod[545]: Aborting (signal 11) [/usr/sbin/ofonod]
2019-12-11 14:35:34 -06:00
Jimmy Gysens d7d49eb1d5 huawei: Fix infinite loop on modem removal
After unplugging a Huawei USB dongle, the 'atoms' in oFono are removed
via 'flush_atoms'.  Every atom has a destruct function pointer, used as
destructor.  This includes the gprs_context atom that is currently
active.

The function calls are:
flush_atoms -> destruct -> gprs_context_remove ->
at_gprs_context_remove -> modem_disconnect

Because the device is physically removed, the IO channel for the AT
port is gone.  In 'at_gprs_context_remove', there is an attempt to
resume communication over that AT port, but that is not possible. This
is detected, and 'io_disconnect' (pointer to 'modem_disconnect') is
called. 'modem_disconnect' has the same atom and tries to remove it
again, so it calls the same destructor.  This continues infinitely.

This patch moves the GPRS context removal so that it only happens if the
modem port could be re-opened successfully.  If the port cannot be
re-opened (in the case of modem removal), the atom is already in the
process of being removed by the process kicked off in flush_atoms.

This fix is limited to Huawei devices and has been tested using the
following devices:

- E3531i-2
- E3372
- E3531s-2
- E369
- E1552
2019-11-21 21:12:53 -06:00
David Lechner cd13b2b5f3 test: make all files executable
This sets the executable bit on the only two files in the test directory
that do not already have it set.
2019-11-18 15:35:01 -06:00
Denis Kenzior 4a078b353b atutil: Add missing va_end 2019-11-13 17:01:15 -06:00
Denis Kenzior a847ccf82c xmm7xxx: Remove unreachable statement 2019-11-13 17:01:15 -06:00
Denis Kenzior d8ca3df926 gatchat: Make sure to set out length for omitted hexstrings 2019-11-13 17:01:15 -06:00
Denis Kenzior 66bc5b3fd4 mbim: Don't copy too much
_mbim_message_build doesn't really care about the fragmentation header
contents, so just don't copy those unnecessarily.
2019-11-13 17:01:15 -06:00
Denis Kenzior 6cd9a241bd gprs: Remove pointless check
name is declared as an array, so the check will always evaluate to true
2019-11-13 17:01:15 -06:00
Denis Kenzior 9111a1ac53 simutil: Remove pointless check
len is already checked >= 16 above
2019-11-13 17:01:15 -06:00
Denis Kenzior f9204363e0 log: Remove dead code 2019-11-13 17:01:15 -06:00
Denis Kenzior 17b6c6c314 simutil: Fix EF structure bit processing
The intent here was to find the contents of the 3 low order bits
according to Table 11-5 in ETSI 102.221.  However, the mask ended up
only grabbing the contents of the 2 low order bits.
2019-11-13 17:01:15 -06:00
Marcel Holtmann 0db662bd6b Release 1.31 2019-10-31 08:58:24 +01:00
Marcel Holtmann 37be9d1026 call-forwarding: Increase string buffer to avoid overflow 2019-10-31 08:39:18 +01:00
Marcel Holtmann 96a83c167e huawei: Increase string buffer to avoid overflow 2019-10-31 08:38:47 +01:00
Richard Röjfors 7528a6096d gprs: update attached on netreg updates when running LTE
There was a race condition where a context might be
registered before the netreg status updates to LTE.

The code took for granted the context is activated after
the technology update. With this change, any order is
is accepted.
2019-10-11 12:31:08 -05:00
Martin Hundebøll ab9cb3b47c udevng: Support quectel MUX settings 2019-10-11 12:19:52 -05:00
Martin Hundebøll d0398b3965 quectel: support both internal and n_gsm muxes
The in-kernel implementation of gsm0710 causes deadlocks in the
kernel[1], so switch the default back to the user-space implementation
in ofono.

The change also removes the timeout-callback used to defer disabling the
n_gsm line discipline, as that is no longer needed[2]

To enable use of the kernel line discipline, add an udev env entry with
OFONO_QUECTEL_MUX="n_gsm".

[1] https://lore.kernel.org/lkml/4b2455c0-25ba-0187-6df6-c63b4ccc6a6e@geanix.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7030082a7415d18e3befdf1f9ec05b3d5de98de4
2019-10-11 12:19:20 -05:00
Martin Hundebøll ad73e590e2 quectel: rework sim detection
Use at_util_sim_state_query_new() to query the sim inserted state. Once
that returns, the locked state is queried by issuing a AT+CPIN? command.

If not locked, a timer is started to query the quectel init status of
the sim. Once the init status is ready, the sim atom is created, and the
modem is set to powered, and the sim is signaled both inserted, and
initialized.

If locked, the modem is set to powered, and the sim atom is created.
This allows users to enter the pin to unlock the sim. Once the sim is
unlocked, a +CPIN: READY indication is caught to query the quectel
init status. Once the init status is ready, the sim is signaled
initialized.

All the above is needed, because the modem indicated +CPIN: READY before
the sim is really ready. The only way to be certain, is to wait for the
quectel init status to be ready. Even signaling the sim inserted
prematurely can cause to modem to hang during the initial AT+CRSM
commands.
2019-10-11 12:10:21 -05:00