Commit Graph

133 Commits

Author SHA1 Message Date
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 66e9a30040 atmodem: change vendor CINTERION to GEMALTO in sim 2018-09-25 09:39:56 -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
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
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
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
Denis Kenzior 847df8ee78 atmodem: Change query_locked to query_facility_lock 2016-04-27 11:04:43 -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
Cedric Jehasse d539ed19f3 atmodem: fix retries reporting from AT+CPINR
The retries array was not correctly filled in.
2015-02-02 09:22:21 -06:00
Cedric Jehasse 25f926c733 atmodem: Sierra modems should be polled after CPIN
Sierra modem will return "CME ERROR: 14" when polled right after pin has
been entered. Use the existing vendor quirk to handle this.
2015-02-02 09:21:10 -06:00
Philip Paeps cca3e085b3 sim: query u-blox PIN retries with AT+UPINCNT 2014-07-08 08:51:54 -05:00
Denis Kenzior b2bfdd69d2 atmodem: Minor style fixups 2014-06-30 13:44:40 -05:00
Philip Paeps 1588e7c082 sim: query Quectel UC15 PIN retries with AT+QPINC? 2014-06-30 13:35:19 -05:00
Anthony Viallard d3e8218b50 SIMCOM: add a quirk to fix crsm request 2013-07-22 15:49:59 -05:00
Anthony Viallard 8650c1019a sim: Add SIMCOM SIM card ready quirk
SIM is busy right after pin is entered. Use the quirk which
add a CPIN? pooling check until having "CPIN: READY" answer.
2013-04-01 21:38:26 -05:00
Christopher Vogl 404f2e3cb9 sim: return from cpin when sim ready for telit
Especially for Telit HE910 it is not enough to wait for
entering a PIN code.
If we do not wait for #QSS: 3, subsequent commands,
like +CMER will report SIM BUSY and the network registration
atom will be removed as a consequence.
2012-12-17 09:50:22 -06:00
Mingli Wu 911eeb6565 atmodem: remove pending idle callbacks at removal
If device probe and removal happen in short succession, it's possible
that the idle handler registered in the probe function doesn't run before
the device is removed.  In this case, the idle handler needs to be
unregistered so that it does not run and try to access the data that's
destroyed during the removal.
2012-12-04 23:48:14 -06:00
Denis Kenzior b26f7c73d3 atmodem: For IFX XSIMSTATE 7 should never occur
in the case of a PIN entry, XSIMSTATE of 7 (Ready to Attach) should
never occur
2012-11-28 10:31:14 -06:00
Denis Kenzior 2528b74491 atmodem: Always quote data in CRSM write operations 2012-11-23 07:22:25 -06:00
Denis Kenzior 291f4e0bb0 atmodem: Support CRSM with paths
For GET STATUS and READ BINARY variations, support appending of the
optional path in the CRSM command
2012-11-23 07:22:25 -06:00
Denis Kenzior 57692483a9 atmodem: Update sim driver to the new api 2012-11-22 10:26:34 -06:00
Cedric Jehasse b728a02981 atmodem: add PIN retry count for Alcatel modems 2012-11-15 12:31:06 -06:00
Cedric Jehasse 5f9c1e9e34 atmodem: Poll SIM state after entering PIN
Encountered a problem of CME ERROR 14: SIM busy on Alcatel and Huawei modem.
The Huawei modem has a ^SIMST unsollicited sim state indication, but not all
Huawei modems support this.
So poll the SIM state, as was already done for ZTE modems.
2012-11-12 13:30:38 -06:00
Holger Hans Peter Freyther 2b9b1ae6d3 sim: Fix the quirk handling of CPIN for Wavecom
The Wavecom Q2XXX support broke in commit 72ce19bf3e.
This is because at_cpin_cb called decode_at_error with final and not
with OK. This lead to an error being set in the error variable and the
new code returns early when an error is set.

The addition of the terminator in at_sim_probe for Wavecom broke in
git commit ac524be99f because
terminators can not be added on cloned chats.

Move the addition of the terminator from the atmodem to the wavecom
plugin. Use the same terminator for Q2XXX and the normal Wavecom
class. The WAVECOM terminator has been tested on a Q2XXX modem.

Apply the CPIN quirk for both WAVECOM and WAVECOM_Q2XXX inside the
sim.c file. Introduce needs_wavecom_sim_quirk to handle it for
WAVECOM and WAVECOM_Q2XXX.
2012-11-01 04:56:51 -05:00
Christopher Vogl 90c7bdfc8d sim: return from CPIN when SIM unlocked for telit
Only return from CPIN when the modem informs that the SIM is ready
2012-08-22 18:44:18 -05:00
Denis Kenzior b264440737 sim: Minor formatting nitpicks 2012-08-16 01:05:54 -05:00
Denis Kenzior aec21db6cb sim: Fix warning
drivers/atmodem/sim.c: In function ‘at_pct_cb’:
drivers/atmodem/sim.c:872:2: error: ISO C90 forbids mixed declarations
and code
2012-08-16 01:05:46 -05:00
August Mayer ee8ba6f2ff sim: support PIN retry counters for telit modems 2012-08-16 01:00:28 -05:00
Pablo Neira Ayuso 78637b130d sim: Quirk Wavecom Q2XXX CPIN behavior 2012-05-31 09:48:12 -05:00
Pablo Neira Ayuso 1ccecfe01e sim: Handle quirky CPIN of Wavecom Q2XXX 2012-05-30 00:03:10 -05:00
Marcel Holtmann 1698d720ce atmodem: Add support for Icera PIN retry counters 2012-05-25 14:32:28 +02:00
Guillaume Zajac d0232dee06 atmodem: Poll SIM state after having entered PIN
We encountered the problem of CME ERROR 14: SIM busy on ZTE modems.
ZTE modems don't use SIM notification to check SIM state.
We poll SIM ready state before confirming PIN is entered.
2012-04-18 04:22:19 -05:00
Denis Kenzior 31e1b2e6ce sim: Don't use sprintf unnecessarily
Using sprintf for a single quote is quite wasteful
2012-03-23 08:28:37 -05:00
Denis Kenzior 95e7982938 sim: Fix up various coding style violations 2012-03-23 08:27:44 -05:00
Nicolas Bertrand ad29b6d18f sim: Use quoted string with AT+CRSM data parameter
Fix issue with some modems preventing to update elementary files
(speedup, ZTE, huawei, MBM)
2012-03-23 08:12:24 -05:00
Renat Zaripov 409b0f01b6 sim: Add SIMCOM specific PIN retry handling
Use AT+SPIC for obtaining retries remaining for SIM PIN / PUK

AT+SPIC Retries Remaining to Input SIM PIN/PUK

+SPIC: <pin1>,<pin2>,<puk1>,<puk2>

Parameters
<pin1> Times remained to input chv1
<pin2> Times remained to input chv2
<puk1> Times remained to input puk1
<puk2> Times remained to input puk2
2012-02-22 04:14:16 -06:00
Guillaume Zajac 38056fdd50 atmodem: Create new sim driver without EF entries
This driver will be used by CDMA modems to support PIN
management and IMSI retreival.
EF entries for CDMA modems cannot be implemented without
manufacturers specifications.
2012-01-11 06:46:24 -06:00
Marcel Holtmann 2e0f1f79c1 atmodem: Add support for Option HSO specific PIN retry counters 2011-12-29 12:08:38 -08:00
Marcel Holtmann 4e77afffb3 drivers: Update copyright information 2011-10-10 13:39:48 -07:00
Marcel Holtmann 703d0a1237 speedup: Add support for retrieving PIN retry counters 2011-08-04 17:00:05 +02:00
Marcel Holtmann 4c8ae3f9ec atmodem: Add Speedup vendor quirk to SIM file reading 2011-08-04 15:54:26 +02:00