Commit Graph

601 Commits

Author SHA1 Message Date
Jonas Bonn 3beeff758d treewide: Remove superfluous use of _GNU_SOURCE
There are a large number of files in the tree that define _GNU_SOURCE
despite not actually using features hidden behind this flag.  This patch
removes all these definitions in one fell swoop...
2018-10-17 10:01:57 -05:00
Jonas Bonn 67701b1c40 drivers: constify vtables
The driver vtables are read-only structures.  This patch declares them as
'const' allowing the compiler to (optionally) put them in the RELRO
section.  RELRO pages may be marked as read-only by the linker after
the relocations have been done ensuring that they aren't inadvertently
or maliciously altered at runtime.
2018-10-17 09:56:27 -05:00
Giacinto Cifelli bd6f807849 drivers: support for auth NONE
Added the explicit support for auth NONE.
It needs to be added in all drivers/*/gprs-context.c atoms.

This method is already supported by all atoms that support
authentication (ie, all but Sierra' swmodem driver).

The behavior is left unchanged in case of inconsistent parameters:
if username is empty, then fallback to auth NONE.
2018-10-09 12:35:44 -05:00
Anirudh Gargi 276330abc4 atmodem: add EUTRAN tech for creg read status
Add handling for CREG's status to get the technology type. CREG
notify URC does not need additional handling as 'AcT' is mapped
one-on-one to tech.
2018-09-27 07:35:17 -05:00
Giacinto Cifelli 579e9dd3ec atmodem/sms: no mms support for Gemalto 2018-09-27 07:32:03 -05:00
Giacinto Cifelli df5bc68fcf atmodem: change vendor CINTERION in GEMALTO in sms 2018-09-25 09:44:30 -05:00
Giacinto Cifelli 66e9a30040 atmodem: change vendor CINTERION to GEMALTO in sim 2018-09-25 09:39:56 -05:00
Giacinto Cifelli 9556d7bd78 atmodem: added Gemalto vendor to CBS CSCB logic 2018-09-24 15:57:58 -05:00
Giacinto Cifelli abd219c89f atmodem/sms: Do not print an error message incorrectly
add missing return in at_cmt_notify.  Without it an error message was
generated in all cases, even successful ones.
2018-09-20 10:50:44 -05:00
Giacinto Cifelli c269d92fac atmodem: added vendor Gemalto 2018-09-20 10:22:31 -05:00
Julien Tournier 925006f49d atmodem: Handle cinterion modems compliant with 27.005 2018-08-29 16:10:29 -05:00
Martin Hundebøll 8b63185929 atmodem: add Quectel M95 special case for PIN query
The AT command reference for Quectel M95 specifies that remaining SIM
pin retires can be queried using AT+QTRPIN, which responds with one
count for each pin-type:

+QTRPIN: 3,3,10,10

After entering the PIN code, enable an extra AT+CPIN? for the M95
vendor.
2018-08-28 14:09:45 -05:00
Christophe Ronco 527e6b1f86 atmodem: Add gprs-context quirk for HUAWEI vendor
When ofono dies while connected using PPP, modem AT channel is not put
back to command mode (tested with HUAWEI modems E3372 and MS2372).
If ofono is restarted, it won't be able to connect as it gets no answer
to AT commands on this AT channel.
This patch adds a quirk to immediately send escape sequence on modem
channel when gprs-context atom is removed.
2018-07-25 14:11:45 -05:00
Antara Borwankar 1fe34da0af atmodem: Support ETWS & CMAS on XMM series modems 2018-06-13 11:58:45 -05:00
Florent Beillonnet 46896014ee atmodem: Fix at_pin_send_puk userdata use
It seems that the function at_pin_send_puk should have been changed
along with at_pin_send, because it's also refering to the
at_pin_send_cb callback

See this commit : ba9f126716
2018-05-23 09:02:16 -05:00
Bob Ham 1ebae47777 atmodem: Don't set AT+COLP=1 on SIMCom modems
On the SIMCom SIM7100E, setting AT+COLP=1 causes there to be no
response at all from "ATD...;" commands until the call is answered.
The results in oFono stalling rather than creating a new VoiceCall
object.

We fix this by adding SIMCOM to the list of vendors for whom we set
AT+COLP=0 rather than AT+COLP=1.
2018-05-14 11:11:14 -05:00
Mariem Cherif ce37f864f3 gemalto: acquire the network technology 2018-03-16 09:24:42 -05:00
Denis Kenzior 4103f81846 atmodem: Update to the new lte API 2018-03-12 09:37:58 -05:00
James Prestwood 065e27fa92 atmodem: removed simauth.c from atmodem 2017-11-09 11:20:39 -06:00
James Prestwood 1c46f8ee85 atmodem: removed simauth init 2017-11-09 11:20:39 -06:00
Denis Kenzior ba9f126716 atmodem: Rework at_pin_send_cb
Instead of delaying the cpin entry callback until the sim is found to be
'ready', call back into the core right away.  The core will wait until
the initialized notification is called from the driver before proceeding
with the rest of the initialization procedure.

The sim state query is now being done in the background and potential
leaking of cbd is now fixed.
2017-11-08 21:41:34 -06:00
Denis Kenzior 3c36211be3 atmodem: Remove XSIM handling from sim driver
This will be covered by ifx/xmm7xxx modem drivers using
sim_initialized_notify
2017-11-08 21:41:34 -06:00
Denis Kenzior 15b2ab8b31 sim: Remove QSS handling
The telit plugin will use sim_initialized_notify instead
2017-11-08 21:41:34 -06:00
Denis Kenzior 7996e2374a atmodem: Remove EPEV handling
This will be moved to ste & mbm modem drivers
2017-11-08 21:41:34 -06:00
James Prestwood 44fdcbe97c atmodem: implemented logical access driver API
This moves the logical access API from the simauth
driver to the sim atmodem driver.
2017-11-07 10:55:01 -06:00
Denis Kenzior 64a240015d atmodem: Disambiguate simcom/cinterion spic use 2017-11-07 10:01:57 -06:00
Gabriel Lucas 90a89b2529 gemalto: add PIN retries support in driver
In SimManager, the Retries property isn't used for gemalto modems.
The at command AT^SPIC is used to get the remaining retries left
for the current required password type.

This commit adds the implementation in the SIM driver of the retries
queries.
2017-11-07 09:55:35 -06:00
James Prestwood 0d5faa5adf atmodem: implement new driver APIs for AID sessions
Implementation for open/close channel, list applications,
and session based file read.
2017-11-03 18:28:11 -05:00
James Prestwood c3b2ff945b atmodem: helper for appending the file path to a command
Several file read API's were re-using the same code to append
a file path. This code was moved into a helper API.
2017-11-03 17:52:25 -05:00
Slava Monich b26abc8f78 atmodem: Query the list of supported <fac>s from the modem
Not all modems support all <fac>s (particularly, "PS"), let's be polite
and not ask them for the ones they don't support.
2017-10-23 17:24:02 -05:00
James Prestwood 1b5e95a32a atmodem: implemented sim-auth functionality in atmodem
Implemented the core API's needed for sim-auth:

list_apps: already implemented
open_channel: Opens a logical channel with +CCHO
close_channel: Closes logical channel with +CCHC
logical_access: Access an opened channel with +CGLA
2017-10-12 15:33:27 -05:00
Slava Monich 4a2915d52d atmodem: Fix use after free in sim_state_cb
==2941== Invalid read of size 4
==2941==    at 0x69338: sim_state_cb (sim.c:1301)
==2941==    by 0x71DCB: cpin_check_cb (atutil.c:567)
==2941==    by 0xA602B: at_chat_finish_command (gatchat.c:459)
==2941==    by 0xA6277: at_chat_handle_command_response (gatchat.c:521)
==2941==    by 0xA6587: have_line (gatchat.c:600)
==2941==    by 0xA6BB7: new_bytes (gatchat.c:759)
==2941==    by 0xAAFAF: received_data (gatio.c:124)
==2941==    by 0x4AF606F: g_main_dispatch (gmain.c:3154)
==2941==    by 0x4AF606F: g_main_context_dispatch (gmain.c:3769)
==2941==    by 0x4AF658F: g_main_loop_run (gmain.c:4034)
==2941==    by 0xBDDBB: main (main.c:261)
==2941==  Address 0x519c344 is 4 bytes inside a block of size 12 free'd
==2941==    at 0x4840B28: free (vg_replace_malloc.c:530)
==2941==    by 0x71F33: at_util_sim_state_query_free (atutil.c:613)
==2941==    by 0x6930B: sim_state_cb (sim.c:1297)
==2941==    by 0x71DCB: cpin_check_cb (atutil.c:567)
==2941==    by 0xA602B: at_chat_finish_command (gatchat.c:459)
==2941==    by 0xA6277: at_chat_handle_command_response (gatchat.c:521)
==2941==    by 0xA6587: have_line (gatchat.c:600)
==2941==    by 0xA6BB7: new_bytes (gatchat.c:759)
==2941==    by 0xAAFAF: received_data (gatio.c:124)
==2941==    by 0x4AF606F: g_main_dispatch (gmain.c:3154)
==2941==    by 0x4AF606F: g_main_context_dispatch (gmain.c:3769)
==2941==    by 0x4AF658F: g_main_loop_run (gmain.c:4034)
==2941==    by 0xBDDBB: main (main.c:261)
2017-10-05 11:11:13 -05:00
Ankit Navik ffbf6159e0 ifxmodem: support automatic context activation
Add support for automatic context activation by adding read_settings.
It also adds detach_shutdown to make sure context is cleaned up when
network registration is lost.
2017-09-13 10:27:32 -05:00
Ankit Navik aadd4668f1 atutil: Add logic for cgcontrdp to get address and netmask 2017-09-13 10:26:35 -05:00
Christophe Ronco b3e4837641 atmodem: correctly report lte bearer for huawei modems 2017-09-07 11:41:01 -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
Marcel Holtmann 6c936db4ae atmodem: Fix missing break statement for ublox driver 2017-07-11 10:42:59 -07: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
Lukasz Nowak 81a54c5a47 atmodem: telit - re-attach gprs automatically
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.
2017-03-29 10:01:50 -05:00
Christophe Ronco 8e929df4f5 atmodem: use ATD99 to enter data state when needed
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.
2017-02-16 11:52:49 -06:00
Piotr Haber c493491c1a atmodem: add LTE to Telit #PSNT status parser
Network type of 4 in Telit #PSNT command response
denotes LTE network
2017-01-25 10:00:07 -06:00
Vincent Cesson 4edc9fd57f atmodem: Fix CGDCONT result parsing.
CGDCONT result parsing fails if first list contains several ranges. For
example with modem Cinterion PHS8:

 AT+CGDCONT=?
 +CGDCONT: (1-17,101-116),"IP",,,(0),(0-4)

Solution: read first range and jump to second list instead of trying to
close the brackets.
2017-01-13 09:38:43 -06:00
Marko Šulejić a9a477e469 atmodem: fix typo 2016-12-14 11:19:56 -06:00
Denis Kenzior 847df8ee78 atmodem: Change query_locked to query_facility_lock 2016-04-27 11:04:43 -05:00
John Ernberg 6a07d059d1 atmodem: use g_slist_free_full 2016-04-22 15:20:11 -05:00
Dragos Tatulea 52b698222c atmodem: gprs: handle automatic context activation
When the event comes, trigger CGCONT? to read the APN for the
activated cid and then call ogono_gprs_cid_activated to handle
the event.
2016-03-18 10:10:09 -05:00
Dragos Tatulea 6970a289c2 atmodem: add support for U-Blox TOBY L2 modems
Besides exceptions below, act like normal U-Blox devices.

gprs-context: don't set auth for TOBY L2. U-Blox Toby L2
doesn't support PAP/CHAP APN auth method.

atmodem: TOBY L2 supports only CMER mode 1. Also chaged original
mode variable to ind, which is a more appropriate name.
mode is what is being set first.
2016-03-16 13:15:08 -05:00
Dragos Tatulea 1290fd1410 atmodem: ublox: EPS now supported by newer ublox
Based on UBX-13002752 R33
2016-03-10 08:26:34 -06:00
Dragos Tatulea cf13dcf4a6 atmodem: add vendor enumeration for ublox toby
Required to differentiate between the old LISA family
of supported devices and future TOBY L2 devices.
2016-03-10 08:04:58 -06:00