Commit Graph

2730 Commits

Author SHA1 Message Date
James Prestwood f972ba88f1 simfs: read files from specific AID's
The simfs atom could not read EF's that did not exist on the
'default' ADF directory. This implements a new way to read EF's
that exist on a given AID. A new fs object/context can be
initialized for a given AID. Using this fs context with
the existing read file API will read from that AID rather than
the default ADF.
2017-11-06 16:12:19 -06:00
James Prestwood d0865cbf6e sim: AID session management
Accessing an AID requires opening a channel to that application.
This patch implements session management API's so that other atoms
can access a given AID. Now any atom can get a session ID from the
sim atom. This will either reuse an existing session or open a new
channel. Once done, the atom should release the session which will
automatically close the channel when no atoms are using it.

The major functional change to the sim atom is the AID discovery
phase of initialization. Now, the sim atom is not 'ready' until AID
discovery finishes where before, the sim was 'ready' after the IMSI
had been obtained. If application discovery is not supported then
the the sim atom behaves as it did before.
2017-11-03 17:51:04 -05:00
Denis Kenzior f58e7685b0 voicecall: Fix up dial_last_callback error paths
Error conditions were not properly handled
2017-11-03 13:25:04 -05:00
Philippe De Swert f5857fdd23 voicecallmanager: Handle last number dialled DBUS call
Handle the new DialLast method on the voicecallmanager interface
2017-11-03 13:18:00 -05:00
James Prestwood 11bcd0cef7 simutil: Added ISIM elementary file ID's 2017-11-02 11:39:01 -05:00
James Prestwood 671fb793fa simutil: Made UMTS/GSM authenticate more consitent
The Le parameter in the AUTHENTICATE command was not being
set for GSM authentication. This did work, but explicitly
setting it to 0 as UMTS does was more consitent.
2017-11-02 11:37:53 -05:00
Slava Monich 30c742439d sim: Move atom registration to the end of ofono_sim_register
The state needs to be checked prior to calling __ofono_atom_register
because atom registration calls OFONO_ATOM_WATCH_CONDITION_REGISTERED
callbacks each of which may call ofono_sim_inserted_notify. Should
that happen, by the time __ofono_atom_register returns, ofono_sim
will be in OFONO_SIM_STATE_INSERTED state and sim_initialize will
be called twice if the initial state was OFONO_SIM_STATE_NOT_PRESENT.
If nothing else, that results in memory leaks like this one (because
IMSI will be queried twice, among other things):

==3017== 16 bytes in 1 blocks are definitely lost in loss record 187 of 475
==3017==    at 0x483F380: malloc (vg_replace_malloc.c:296)
==3017==    by 0x4AFB0DF: g_malloc (gmem.c:94)
==3017==    by 0x4B12185: g_strdup (gstrfuncs.c:363)
==3017==    by 0xF79D3: sim_imsi_obtained (sim.c:1535)
==3017==    by 0xF7BB3: sim_imsi_cb (sim.c:1594)
==3017==    by 0x66C23: at_cimi_cb (sim.c:441)
==3017==    by 0xA6B53: at_chat_finish_command (gatchat.c:459)
==3017==    by 0xA6D9F: at_chat_handle_command_response (gatchat.c:521)
==3017==    by 0xA70AF: have_line (gatchat.c:600)
==3017==    by 0xA76DF: new_bytes (gatchat.c:759)
==3017==    by 0xABACF: received_data (gatio.c:122)
==3017==    by 0xAD093: watch_dispatch (gatmux.c:461)
==3017==    by 0xAC5D3: dispatch_sources (gatmux.c:180)
==3017==    by 0xAC98F: received_data (gatmux.c:265)
==3017==    by 0x4AF606F: g_main_dispatch (gmain.c:3154)
==3017==    by 0x4AF606F: g_main_context_dispatch (gmain.c:3769)
==3017==    by 0x4AF631D: g_main_context_iterate.isra.4 (gmain.c:3840)
==3017==    by 0x4AF658F: g_main_loop_run (gmain.c:4034)
==3017==    by 0xBE8AF: main (main.c:261)
2017-10-27 08:56:10 -05:00
Denis Kenzior 3b951d20f4 voicecall: expand synthesize_outgoing_call
synthethize_outgoing_call was only used once from dial_handle_result.
So move all the logic of registering the call to D-Bus and adding it to
the voicecalls list to that function.

This will allow synthethize_outgoing_call to be used from other
callbacks where the dial callback is guaranteed to return before any
call state notifications, e.g. in the case of +BLDN.
2017-10-26 10:23:47 -05:00
James Prestwood 2bc262b3af simauth: Fixed incorrect AUTS length
The initial SimAuth implementation incorrectly parsed
the AUTS value as 16 bytes, not 14.
2017-10-20 14:08:57 -05:00
James Prestwood 95e795b62d simauth: fixup adding more dbus return checks 2017-10-16 11:16:27 -05:00
James Prestwood 5ba90f6b09 sim-auth: implementation of core sim-auth atom
The sim-auth module atom can now be used for SIM application discovery
and authentication. The atom will automatically discover SIM
applications available on the SIM and register a new DBus object under
the modem, whos name is the AID string e.g.

/modem1/A0000000871004FFFFFFFF8906190000

A list of discovered AID object paths and types can be retrieved by
calling GetApplications() under the modems (new)
org.ofono.SimAuthentication interface which returns "a{oa{sv}}" where

o = path (e.g. above)

and the dictionary contains the following properties:

Type: "Umts" or "Ims"
Name: "USim" or "ISim"

The Type signifies which interfaces the AID object will have:

Umts = org.ofono.USimApplication
Ims = org.ofono.ISimApplication

These interfaces will contain the supported USIM/ISIM authentication
algorithms. Where:

org.ofono.USimApplication has:
    GetProperties()
    GsmAuthenticate()
    UmtsAuthenticate()

org.ofono.ISimApplication has:
    GetProperties()
    ImsAuthenticate()
2017-10-12 15:28:40 -05:00
James Prestwood a8f609727d sim: new API to check for a UST service only
The existing service check API takes both SST and UST services
and could inadvertently return success on a service if one
(SST or UST) service did not exist. This adds an API specifically
for checking for a UST service, and if the UST dir is not available
it will return FALSE, rather than possibly returning true on some
other SST service.
2017-10-11 10:31:10 -05:00
James Prestwood 2a1982e8c0 simutil: Added authenticate builder/parser API
Used to compose/parse non-TLV formatted authenticate commands
for GSM and UMTS authentication.
2017-10-11 10:29:13 -05:00
James Prestwood eb2915e231 simutil: Added app type to application parser
Parsing a SIM application only copied the 16 byte AID
portion, which included the application type. Parsing out
the type makes sorting much easier for modules using the
parser.
2017-10-11 10:26:24 -05:00
Denis Kenzior 8a09ad56fe ims: Rework initialization
We should bootstrap the registration status prior to registering the
interface with D-Bus
2017-10-09 11:35:46 -05:00
Denis Kenzior b002a79f4b ims: Remove logic checking presence of SIM atom
This part is not required
2017-10-09 11:35:05 -05:00
Ankit Navik 32d7596ff4 ims: add implementation for IMS atom
This implementation includes:
* D-Bus interface
* interaction with driver
2017-10-09 11:23:04 -05:00
Slava Monich 61bbbb0d7a modem: Implement ofono_modem_get_sim 2017-10-05 11:22:54 -05:00
Denis Kenzior e6268d1eb7 devinfo: Implement ofono_devinfo_get_modem 2017-10-05 11:08:38 -05:00
Denis Kenzior 8dc66c11bd build: Add optional ell dependency 2017-10-05 11:08:38 -05:00
Jonas Bonn 3796744b5e Fix out of tree build 2017-09-12 12:48:23 -05:00
Nishanth V 76c3dcec11 netmonagent: fix unnecessary function declaration 2017-09-12 12:29:24 -05:00
Alexander Couzens e98f683309 network.c: notify_status_watches: check for NULL
In rare cases when ofono_netreg_status_notify() is called before
ofono_netreg_register() netreg->status_watches is NULL.
2017-09-11 10:39:17 -05:00
Denis Kenzior 25db45daaa netmonagent: Fix typo 2017-09-09 10:21:20 -05:00
Nishanth V bcc37ad77f netmon: core changes for network monitor agent
Added implementation for RegisterAgent and UnregisterAgent in
NetworkMonitor interface and added netmonagent source file for agent
implemention.
2017-09-08 15:06:10 -05:00
Alexander Couzens 8e6ac330a5 voicecall: use ofono_call_status_name in DBG messages
status names are more readable then integer values.
2017-09-07 17:29:46 -05:00
Alexander Couzens 9b16b2c23c voicecall,common: move call_status_to_string() to common
call_status_to_string() is useful for debug output.
Change signature to contain enum call_status
Replace default case to get compiler warning when new enums added
2017-09-07 17:29:42 -05:00
Alexander Couzens d08a6043a3 gprs: use registration_status_to_string in debug messages 2017-09-07 16:50:51 -05:00
Alexander Couzens 7d27ccea5e common: move strlen(apn) check into is_valid_apn() 2017-09-05 10:41:05 -05:00
Slava Monich d9b2dbbd0b sms: Pass const pointer to dispatch_app_datagram 2017-08-21 11:36:32 -05:00
Slava Monich 980bb705d1 ussd: Switch the state from USER_ACTION to IDLE
... when a USSD notification is received. Some networks
send 0 (no further user action required) after the response
timeout expires. That should result in the user input form
getting removed from the ME screen.
2017-08-07 14:50:57 -05:00
John Ernberg 8ad77d5e10 radio-settings: Fix typo in radio_band_umts_from_string 2017-06-29 09:11:11 -05:00
Marcel Holtmann 9b7a6425bd phonebook: Add missing fall through statement 2017-07-11 10:45:48 -07:00
Marcel Holtmann 9fa6f20a6f voicecall: Reword fall through statement to avoid compiler warning 2017-07-11 10:45:19 -07:00
Marcel Holtmann 38a6826228 stk: Add missing break statement for inkey duration 2017-07-11 10:44:53 -07:00
Slava Monich 00613b5bbc radio-settings: Fix memory leaks in radio_load_settings
Errors returned by g_key_file_get_integer have to be deallocated
by the caller to avoid leaks like these:

==13330== 104 (24 direct, 80 indirect) bytes in 2 blocks are definitely lost
==13330==    at 0x483F3EC: malloc (vg_replace_malloc.c)
==13330==    by 0x4B020DF: g_malloc (gmem.c)
==13330==    by 0x4B17F51: g_slice_alloc (gslice.c)
==13330==    by 0x4AE80B9: g_error_new_valist (gerror.c)
==13330==    by 0x4AE830B: g_set_error (gerror.c)
==13330==    by 0x4AF5681: g_key_file_get_value (gkeyfile.c)
==13330==    by 0x4AF6817: g_key_file_get_integer (gkeyfile.c)
==13330==    by 0x10CFE3: radio_load_settings (radio-settings.c)
==13330==    by 0x10D2E3: ofono_radio_settings_register (radio-settings.c)
2017-06-02 10:42:30 -05:00
Slava Monich 440c9bec88 simfs: Prevent a crash in sim_fs_notify_file_watches
If no file watchers have ever been added, context->file_watches
is NULL and sim_fs_notify_file_watches() should take that into
account.
2017-05-12 14:37:26 -05:00
Denis Kenzior d9cb969dcf gprs: Don't use pri_set_apn for auto activated cids
There are two problems with using pri_set_apn.  The first issue is that
this function was built to be used by the set_property handler and
assumes the presence of a pending DBusMessage.

The second issue is that it touches the settings store.

In the case of auto-activated contexts no pending message exists.  Also,
we should not be touching the settings store as the APN might
potentially be a value that has not been provisioned.  Or in some cases
bogus.
2017-05-09 11:33:07 -05:00
Denis Kenzior 24f36da04d gprs: Return after releasing pri_ctx 2017-05-09 11:33:07 -05:00
Luiz Augusto von Dentz 27afa421cf handsfree-audio: Add Acquire implementation
This adds Acquire method which can be used by agents that require
pulling the fd directly instead of waiting a NewConnection.
2017-05-04 12:34:31 -05:00
Jonas Bonn 526b30b7ec ofono: add missing header inclusions
This is a "leaf" header and doesn't even have header guards, but
it still seems natural that the header should pull in its own declarations
rather than relying on the including source file to ensure that they
are included.
2017-04-18 09:47:42 -05:00
Jonas Bonn 0167c3339c gprs: set driver_attached when activating automatic contexts
The ofono_gprs_cid_activated attachment machinery cannot go through
ofono_gprs_status_notify for getting the attached property set because
that would result in the automatic contexts that were just set up
being released.  As such, it needs to call gprs_set_attached_property
manually.  Doing so, however, means that the driver_attached property
never gets set, resulting in all contexts being released when the
network transitions between registered states (roaming/non-roaming).
2017-04-14 17:43:13 -05:00
Jonas Bonn 1fd419e5b4 gprs: _cid_activated is an 'attaching' state
ofono_gprs_status_notify is an asynchronous notification that messes
with the 'attached' state of the GPRS atom.  This method is normally
prevented from running while an attach is in progress because the
attachment machinery wants to finish up and make it's own determination
of attach state.

When automatic context activation is relevant, as for LTE networks,
the ofono_gprs_cid_activated machinery replaces the usual set_attach
machinery for attaching to the network.  The cid_activated variant,
however, does not guard against simulatenous invocations of
ofono_gprs_status_notify.  This causes a race whereby status_notify
sets the state to 'attached' before the context is fully constructed
and set to active.  If the connection manager sees the 'attached'
state before there are any 'active' contexts, it may decide to
activate a context manually which is not the correct behaviour for
this type of network.

This patch makes the *_cid_activated machinery an 'attaching' state,
introducing the same guards that set_attached has to prevent
ofono_gprs_status_notify from running concurrently.
2017-04-14 17:28:46 -05:00
Jonas Bonn a722cef201 modem: set_online is valid for AlwaysOnline modems
Calling set_online(TRUE) for an AlwaysOnline modem should succeed; the
modem is, after all, in the requested state when the call returns.
Returning not_implemented is not necessarily wrong, but it's a bit ugly.
2017-04-03 09:23:53 -05:00
Christophe Ronco d43e48ae73 gprs: fix error check of gprs_cid_alloc function
When there is no context id available, idmap_alloc and
gprs_cid_alloc return max + 1.
2017-02-15 14:39:36 -06:00
Christophe Ronco c5fbfaa55f sim: backup driver read_imsi by IMSI via EF read
If read_imsi driver function fails, try to obtain IMSI via EF read
2017-01-09 12:25:00 -06:00
Slava Monich aaf70beb06 sim: Stop facility lock query sequence on removal
SIM card can be removed while the query is in progress. There's
still a remote possibility that SIM card is removed and inserted
back while the query is pending, that would start the second query
sequence and end up invoking sim_initialize() twice. But at least
these checks reduce the probability of something like that happening.
2017-01-06 12:25:48 -06:00
Slava Monich a1df13a3bc smsutil: Prevent invalid access in cbs_decode_text
Valgrind was complaining about it like this:

==18099== Conditional jump or move depends on uninitialised value(s)
==18099==    at 0x4C32281: strspn
==18099==    by 0x41286B: cbs_decode_text (smsutil.c:4140)
==18099==    by 0x40675C: test_cbs_encode_decode (test-sms.c:1417)
2016-12-30 18:19:21 -06:00
Djalal Harouni 9898cc5fad netmon: handle OFONO_NETMON_INFO_{EARFCN|EBAND|CQI} 2016-12-13 11:04:42 -06:00
Djalal Harouni d9c618fd94 netmon: handle NETMON_INFO_{RSCP|ECN0|RSRQ|RSRP}
Handle the newly added netmon info types.
2016-11-30 09:29:59 -06:00
Denis Kenzior c1cf5ae25e netmon: Fix style issue 2016-11-29 10:46:05 -06:00
Denis Kenzior 46c44a2b56 netmon: No need to initialize mcc/mnc 2016-11-29 10:45:19 -06:00
Dragos Tatulea c2b489dca8 gprs: lte: set attached after successful activation
Otherwise the attached state gets to be set before the actual LTE
automatic context is ready. This triggers a race between connman
and ofono: connman sees status attached before the context is active
so connman will try to activate another context with same apn and will
fail over and over again.
2016-11-22 10:51:09 -06:00
Dragos Tatulea 627b5df8a2 lte: fix early imsi free
storage_close was creating an empty sync file in /var/lib/ofono/lte
when it should have been closing the proper file
/var/lig/ofono/<imsi>/lte.
2016-11-22 10:03:10 -06:00
Slava Monich 52c2c401b4 smsutil: Fix receiving UTF-16 encoded messages
The spec supports UCS2, but in reality UTF-16 is used, which supports
4-byte characters, which could be split into different message
fragments. Accumulate the entire UTF-16 message before converting to
UTF8.

Author: Martin Jones <martin.jones@jolla.com>
2016-11-18 09:34:33 -06:00
Denis Kenzior b8d6828388 lte: If method is NULL, return not implemented 2016-11-15 13:43:15 -06:00
Denis Kenzior 872c1a82f1 lte: Relax condition to g_free imsi
imsi malloc is not directly tied to l_settings being valid
2016-11-15 13:39:44 -06:00
Dragos Tatulea 1b3c844040 lte: add implementation for LTE atom
This implementation can only get/set the default APN setting. But
anything expected for this atom is there:
* D-Bus interface
* sync-ing settings to/from file
* interaction with driver
2016-11-15 13:38:42 -06:00
Dragos Tatulea f750366261 src: add LTE atom define 2016-11-09 14:20:11 -06:00
Slava Monich 27a9428eec gprs: Check GPRS_FLAG_ATTACHED_UPDATE
... in pri_deactivate_callback

This prevents attached state from getting stuck at 0 like this:

1. Context deactivation is initiated over D-Bus, ctx->pending is set
2. Attached becomes FALSE, context is still marked as active
3. Attached becomes TRUE, gprs_attached_update sets GPRS_FLAG_ATTACHED_UPDATE
4. Deactivation completes, attached is 0, driver_attached is 1

Futher network status updates don't call gprs_attached_update because
driver_attached is still 1, so attached is staying 0 until we lose the
data registration again which may not happen for quite a long time.
2016-11-03 14:24:41 -05:00
Caiwen Zhang 20d8cf9495 gprs: fix crash removing a context being activated
If remove the context before context activation is completed, it may
cause a crash.
2016-11-01 11:29:37 -05:00
Slava Monich 5c486138ba netmon: Fix corner cases in serving cell info
Make sure we don't pass NULL message to g_dbus_send_message
Also that we don't lose the reply message.
2016-10-25 14:41:53 -05:00
Slava Monich 54fb56df24 main: Make -d option repeatable
Concatenating the patterns makes more sense than using the last
supplied value and leaking the previous allocated patterns.
2016-10-04 22:26:26 -05:00
Denis Kenzior 80a71f32cd handsfree-audio: Fix crash
For HFP 1.5 devices the driver is always set to NULL.  So if the AG
establishes the SCO connection first, we might crash.
2016-08-23 20:34:52 -05:00
Samrat Guha Niyogi 27f9da901f sim: remove locked_pin reset from sim_free_main_state 2016-08-08 21:17:22 -05:00
Denis Kenzior 3b5475d942 sim: Fix style 2016-08-06 10:52:30 -05:00
Samrat Guha Niyogi 162f6985e3 sim: query facility during initialization in chain manner
query facility during initialization is modified from back
to back invocation to chain manner to keep it inline with
RIL design. All vendor RIL does not support back to back
handling since RIL telephony framework sends the request
synchronously.
2016-08-06 10:50:27 -05:00
Denis Kenzior f4a90e5e0d sim: return false for SIM_PASSWORD_NONE 2016-07-20 16:26:42 -05:00
Slava Monich 103e8fd42e sim: Query the status of SC facility lock 2016-07-06 11:12:21 -05:00
Denis Kenzior 2859e0547c radio-settings: Fix style 2016-04-27 11:19:18 -05:00
Antara Borwankar d8b60d854c radio-settings: Init pending_band_{gsm|umts}
The set_band method takes two parameters for band settings, one for gsm
and one for umts.  When loaded from storage, and they are not set to
defaults, the band variables can get out of sync when setting the
GsmBand and UmtsBand properties.
2016-04-27 11:19:13 -05:00
Samrat Guha Niyogi 7b2f8b0f6e sim: Query the status of PS and PN facility locks 2016-04-27 11:01:09 -05:00
Denis Kenzior f92b763da4 radio-settings: Fix 80-character limit 2016-04-26 08:13:42 -05:00
Antara Borwankar e8c4e0f4c1 radio-settings: Store GSM and UMTS band settings 2016-04-26 08:12:19 -05:00
John Ernberg 65132868c8 stk: clean up undefined function pointer casts 2016-04-26 08:05:00 -05:00
John Ernberg 74e85341ce simfs: Remove explicit casts 2016-04-22 15:41:27 -05:00
John Ernberg d8821a48d0 sim: Remove explicit casts 2016-04-22 15:40:43 -05:00
John Ernberg 7ea76fb667 phonebook: Remove explicit casts
Casting between incompatible function pointer types is undefined.  So
remove such casts when possible.
2016-04-22 15:39:22 -05:00
John Ernberg 7cea20b680 voicecall: Use g_slist_free_full 2016-04-22 15:36:47 -05:00
John Ernberg 1326026c6d ussd: Use g_slist_free_full 2016-04-22 15:36:11 -05:00
John Ernberg c9be86ce1a stkutil: Use g_slist_free_full 2016-04-22 15:35:27 -05:00
John Ernberg f6446d60f9 smsutil: Use g_slist_free_full 2016-04-22 15:32:43 -05:00
John Ernberg 3b1496a84b sms: Use g_slist_free_full 2016-04-22 15:32:02 -05:00
John Ernberg a0a766678c simutil: Use g_slist_free_full 2016-04-22 15:31:27 -05:00
John Ernberg 43f9efc1fd network: Use g_slist_free_full 2016-04-22 15:30:01 -05:00
John Ernberg ea0999c626 modem: Use g_slist_free_full 2016-04-22 15:29:08 -05:00
John Ernberg 1e5725993b handsfree: Use g_slist_free_full 2016-04-22 15:28:43 -05:00
John Ernberg 3887e33e00 cdma-smsutil: Use g_slist_free_full 2016-04-22 15:28:05 -05:00
John Ernberg f987e0b311 cbs: use g_slist_free_full 2016-04-22 15:27:28 -05:00
John Ernberg a6847d0f7f voicecall: limit g_drivers variable exposure 2016-04-22 14:19:11 -05:00
John Ernberg 72570fffd8 voicecall: fix CreateMultiparty method introspection
This caused problems with stricter dbus wrappers such as dbus-c++.
2016-04-22 14:17:33 -05:00
Nishanth V b04f9e962c simutil: Add EFACL in elementary file db 2016-04-21 10:01:16 -05:00
Caiwen Zhang 66160f9b63 sim: fix crash when going into state LOCKED_OUT
After input PIN wrong 3 times, sim main state (include spn_watches)
is freed. but the watch id still be kept by other atoms (network and
gprs), when remove the atom, it will try to remove the watch from
spn_watches, ofono daemon will crash.
2016-04-20 21:28:10 -05:00
Denis Kenzior db7faf0ad3 log: Fix style 2016-04-18 10:02:20 -05:00
Harald Welte bafe8f2d83 log: Don't crash when addr2line output contains no newline 2016-04-18 10:01:22 -05:00
Denis Kenzior b708f9f6b3 radio-settings: Fix potential leak
rs->imsi is only freed when rs->settings is true.  So tweak the logic
inside radio_load_settings to only strdup the imsi when settings
creation has succeeded.
2016-04-07 09:19:13 -05:00
Denis Kenzior 77a3c58148 radio-settings: Fix minor style issues 2016-04-07 09:15:22 -05:00
Anirudh Gargi 07dff1916d radio-settings: Add RAT mode to ofono storage 2016-04-07 09:13:28 -05:00
Alfonso Sanchez-Beato 154f4aca65 gprs: Deactivate old contexts on attach
In some cases it is possible that a context is opened after a detach
event has been received, and right before an attach, depending on the
modem. We make sure that those contexts are removed to keep
consistency.
2016-04-04 14:48:05 -05:00
Denis Kenzior 6eeb896981 modem: Fix style 2016-03-31 10:16:23 -05:00
Samrat Guha Niyogi 93f3b200fc devinfo: Add support of IMEISV 2016-03-31 10:16:23 -05:00
Denis Kenzior 2d78909cce netmon: Fix minor style issues 2016-03-31 09:53:55 -05:00
Denis Kenzior 1b87247a11 netmon: Add ofono/netmon.h into ofono.h 2016-03-31 09:50:25 -05:00
Nishanth V 6ed9b55974 netmon: Add serving cell info support 2016-03-31 09:48:37 -05:00
Dragos Tatulea a4cfaa1b6c gprs: assume attached state when registered on LTE
LTE doesn't really use the concept of an attached state. However,
the oFono API needs it. ConnMan needs it as well.
2016-03-21 10:59:44 -05:00
Dragos Tatulea e71b3b265a gprs: implement ofono_gprs_cid_activated
It works by looking for a context with the same APN and tries to use
that. Otherwise it will create it's own.

Then it assigns a gprs context driver and calls it's read_settings if
it exists.
2016-03-18 10:08:08 -05:00
Dragos Tatulea 561a9f94a2 idmap: add api for finding a certain id in map 2016-03-18 09:40:29 -05:00
Dragos Tatulea 9173d7e2e4 gprs: pri_set_apn: make reply msg optional
Automatic context activation will set the apn by itself. No
dbus message to reply to.
2016-03-17 12:39:24 -05:00
Dragos Tatulea 02dcc2f36e gprs: custom cid for assign_context
It's optional though. If 0 a cid is picked up automatically from the
allowed range.
2016-03-17 12:27:17 -05:00
Slava Monich 5e4ce76bba sim: Implement ServiceProviderName property 2016-01-27 10:42:09 -06:00
John Ernberg c331d72d1d network: Fix crash caused by empty Scan() results
When issuing a Scan() in poor reception while attached to an operator it's
fully possible to get no results, which causes the attached operator to be
cleaned up. In certain scenarios this would cause a use-after-free as there
are still references to this operator.
Transfer the attached operator to the new list regardless of removal caused
by the Scan() results.
2016-01-07 10:31:10 -06:00
John Ernberg ff476aa06f gprs: Fix the ContextAdded() signal Introspection
This matches the behavior described by the documentation the signal
value returned by the code. This was causing a headache when using
stricter D-Bus wrappers like dbus-c++.
2015-12-22 10:23:44 -06:00
John Ernberg e43a006c7b cbs: Resolve a use-after-free
In situations where location changes rapidly, a use-after-free condition
can occur.  What happens is that the timeout leaks and then the cbs
struct with the callback is cleaned up, resulting in a SIGSEGV when the
callback occurs from the glib loop.
2015-12-21 17:53:43 -06:00
Denis Kenzior 68e4007d7b modem: Don't move to pre-sim state in case of failure
In ofono_modem_reset, if the enable() callback fails, do not
proceed to the pre-sim state
2015-12-15 17:17:00 -06:00
Denis Kenzior 133165b5ca gprs: Implement ofono_gprs_context_get_type 2015-12-13 22:20:58 -06:00
Denis Kenzior 6fbb1e18f8 gprs: Implement ofono_gprs_get_modem 2015-12-03 13:23:28 -06:00
Simon Fels 06480bdf53 voicecall: don't dereference a supplied null value
When the voicecall atom is unregistered we remove all HFP support as
well but were supplying a zero as value to the emulator status
callbacks which caused the process to crash as we were dereferencing
the supplied value always and not respecting a zero as indicator to
reset.
2015-11-29 16:01:26 -06:00
Denis Kenzior 418ca19f25 gprs: Allow synchronous callbacks for set_attached 2015-11-13 16:08:32 -06:00
Denis Kenzior bb9a1954ea radio-settings: Implement get_modem() 2015-11-05 20:50:12 -06:00
Simon Fels 046f032b32 emulator: add codec negotiation support 2015-10-26 11:43:04 -05:00
Tony Espy f2f279b28d src: make bearer/operator enums public
Move enums for operator_status and packet_bearer to common.h to avoid
duplication in drivers.
2015-10-13 16:00:17 -05:00
Denis Kenzior c8eb4e384e emulator: Add ofono_emulator_set_handsfree_card 2015-10-06 09:04:12 -05:00
Simon Fels 5a7410e9e4 handsfree-audio: add type for our audio cards
When registering audio cards for the handsfree and gateway roles we
need a way for our users to differentiate between both to decide which
of them they start using for their purpose.
2015-10-05 11:46:30 -05:00
Alfonso Sanchez-Beato 51fc828c5e sms: Add trace when datagram is not delivered 2015-09-08 09:14:03 -05:00
Alfonso Sanchez-Beato ac14de37ca smsutil: Do not check the origin port
Do not check if the origin port is reserved, as some operators use that
range of values.
2015-09-08 09:14:03 -05:00
Denis Kenzior 9ec8d03c7c voicecall: Don't accept USSD strings in Dial() 2015-08-06 17:16:03 -05:00
Denis Kenzior 8be0245664 cdma-connman: Make static analysis tools happy
The kernel simply puts a null terminator at index 15 prior to ifr_name
processing.  So we do the same.

Original report by:
Sabas Rosales, Blanca E <blanca.e.sabas.rosales@intel.com>

 Buffer not null terminated (BUFFER_SIZE_WARNING) buffer_size_warning:
 Calling strncpy with a maximum size argument of 16 bytes on destination
 array ifr.ifr_ifrn.ifrn_name of size 16 bytes might leave the
 destination string unterminated.

  92        strncpy(ifr.ifr_name, interface, IFNAMSIZ);
2015-07-28 10:18:26 -05:00
Denis Kenzior dbb3ec13e5 gprs: Try re-attaching when we switch cells 2015-07-20 13:51:29 -05:00
Alfonso Sanchez-Beato 1b3302322a message-waiting: Fix reading EF_MWIS records 2015-07-16 20:22:38 -05:00
Alfonso Sanchez-Beato cd76f913f0 message-waiting: Update properly EF_MWIS SIM file 2015-07-16 20:17:27 -05:00
Denis Kenzior 35ebbf4c97 handsfree: Mark GetProperties method ASYNC 2015-07-06 04:06:45 -05:00
Sergey Alirzaev 4a937b96aa build: make ofono build against musl
ifdef away GNU libc extensions and use a POSIXly correct pointer type
2015-07-01 08:09:53 -05:00
Denis Kenzior fceb5a41c2 handsfree: Fix potential buffer overflow
Function: ag_features_list
 static const char *list[10];  (Out of bounds write, line 75)
  Incrementing i the value is now 10, for “hf-indicators”

Reported by: blanca.e.sabas.rosales@intel.com
2015-06-30 16:58:36 -05:00
Denis Kenzior 48da783732 sim: Fix up whitespace issues 2015-06-18 14:59:06 -05:00
Tommi Kenakkala eebe2f3ac2 Emit LockedPins after pin_type is queried
Fixes property change not being emited when hot-swapping a
PIN-enabled card.
2015-06-18 14:56:05 -05:00
Tommi Kenakkala 4677729502 sim: Reset pin_type on card remove
Fixes PinRequired not being emitted when a card is inserted
2015-06-17 23:09:03 -05:00
Alfonso Sanchez-Beato e70afdd9dc gprs: Add comment to gprs_reset_contexts 2015-05-18 12:13:04 -05:00
Alfonso Sanchez-Beato 946b568f43 gprs: Refactor to remove forward declaration 2015-05-18 09:08:33 -05:00
Alfonso Sanchez-Beato 444611c086 gprs: Add DBus method to reset contexts
Add DBus method that removes the current contexts and re-provisions
using the APN database.
2015-05-18 09:08:13 -05:00
Denis Kenzior fdba39b8ed handsfree-audio: Call sco_connected_hint 2015-05-13 09:57:52 -05:00
Denis Kenzior 1c2987670d handsfree-audio: Add additional debugs 2015-05-13 09:57:52 -05:00
Denis Kenzior e2398b4dfa smsutil: Add additional sanity check
We make sure that after performing the UTF8 -> GSM conversion, the
number of GSM bytes is not greater than 11, which is the maximum
payload.
2015-02-13 09:59:59 -06:00
Tommi Kenakkala 2af3c733b7 sms: Fix alphanumeric TP-OA handling
TP-OA max length comparisons were incorrect because TP-OA's 7-bit
coded octets transport eleven 8-bit chars.  The current code assumed
only 10 chars were possible.

The patch
- increases the array size to 23, (maximum of 22 bytes for UTF8
  encoding + null terminator)
- Updates the sanity check to account for the correct maximum
- For encoding, checks the maximum length in UTF8 characters instead of
  bytes
2015-02-13 09:49:39 -06:00
Tommi Kenakkala 04218d3a86 handsfree-audio: Refactor manager init / cleanup 2015-02-02 09:28:34 -06:00
Tommi Kenakkala 41fadd3787 main: Remove handsfree_audio_manager init/cleanup
Init allocates a SCO audio socket always. oFono should do that
with bluez5 but not with bluez4.  This patch starts the refactoring of
the handsfree_audio_manager init/cleanup functionality.
2015-02-02 09:26:58 -06:00
Alfonso Sanchez-Beato 10f173981c radio-settings: Show all available technologies
Not all possible futures technologies were being showed on the DBus
interface.
2014-12-12 08:54:14 -06:00
Denis Kenzior 95482cb84a radio-settings: Always query available rats
If fast dormancy query is not implemented the available rats are not
queried.
2014-12-10 11:03:16 -06:00
Denis Kenzior fce95b767a radio-settings: Add additional sanity check 2014-12-10 11:03:16 -06:00
Denis Kenzior 44049f064a radio-settings: rework AvailableTechnologies logic
Take advantage of the new enum structure to future proof and simplify
the logic of generating the AvailableTechnologies property
2014-12-10 11:03:16 -06:00
Alfonso Sanchez-Beato 5210b85c22 src: Implement RAT list property 2014-12-10 11:03:16 -06:00
Denis Kenzior 7dca0a7315 sim: Fix pin retries bogus values on some arch-es
On some architectures the SimManager.Retries property was getting bogus
values.  This is because we were sending an array which pointed to int
values instead of the expected unsigned char values.

This fix allocates a temporary array of unsigned chars to hold the
actual D-Bus values being sent.  Additionally, the dictionary array is
changed to point to the temporary unsigned char based values instead of
the raw 'int' based retry values.
2014-12-04 08:57:48 -06:00
Denis Kenzior 6c4ac05fbc emulator: Refine +BIND support 2014-10-20 13:40:29 -05:00
Denis Kenzior f9d5ee5fa9 emulator: Implement new API 2014-10-20 13:40:28 -05:00
Denis Kenzior d3560b3784 handsfree: Be extra pedantic with booleans 2014-10-20 13:40:28 -05:00
Denis Kenzior de02f68a2e handsfree: Don't try to send a method return
When we are simply updating the AG of HF indicator changes, do not try
to send a method return message.
2014-10-20 13:40:28 -05:00
Denis Kenzior 6c0f90fc1b handsfree: Implement new HF indicators API 2014-10-20 13:40:28 -05:00
Denis Kenzior 7166aebd51 emulator: Refactor data types 2014-10-20 13:40:28 -05:00
Denis Kenzior ab5b6d1217 handsfree: Skeleton implementation of DDR
Distracted Driving Reduction or Enhanced Safety is implemented using HF
indicator 0x0001
2014-10-20 13:40:28 -05:00
Denis Kenzior 66cf2a30fa handsfree: Implement new Features property value 2014-10-20 13:40:28 -05:00
Denis Kenzior 43e83852dc emulator: Enable HF Indicator feature 2014-10-20 13:40:28 -05:00
Denis Kenzior 36a21da227 emulator: Extend BRSF bitmap
The current check of 8 bits is not enough with HFP 1.7
2014-10-20 13:40:28 -05:00
Denis Kenzior bef4d610a3 emulator: Add +BIEV implementation 2014-10-20 13:40:28 -05:00
Denis Kenzior 2d158167c2 emulator: Add +BIND implementation 2014-10-20 13:40:27 -05:00
Denis Kenzior 02c5b73f6e emulator: Fix CHLD=? not treated as part of SLC 2014-10-20 13:40:27 -05:00
Denis Kenzior 0727da1d5b emulator: Improve SLC establishment logic 2014-10-20 13:40:27 -05:00
Denis Kenzior d292e0e0ed hfp: Add enum for known HF Indicators 2014-10-20 13:40:27 -05:00
Denis Kenzior 881207ce18 hfp: Update for new HFP 1.7 values 2014-10-20 13:40:27 -05:00
Marcel Holtmann 8ebb17977b handsfree-audio: Fix broken coding style in switch statement 2014-09-20 16:13:45 +02:00
Philip Paeps c144fadca6 gprs: provision the authentication method 2014-06-24 12:46:18 -05:00
Denis Kenzior 3e13676766 gprs: Make the code a bit easier to read 2014-06-21 12:02:05 -05:00
Philip Paeps 73831c3d76 gprs: make PPP authentication method configurable
Add a new "AuthenticationMethod" property to select between "pap"
and "chap" PPP authentication, defaulting to "chap" (i.e.: previous
behaviour).
2014-06-21 11:58:03 -05:00
Andrew Earl 9bbc98651f handsfree: correct crash on connect of hfp 2014-04-22 13:10:32 -05:00
Denis Kenzior 8cfcfa4519 handsfree: Rename variable 2014-04-10 09:43:47 -05:00
Denis Kenzior ca3ae87d0a handsfree: Reflow logic 2014-04-10 09:43:44 -05:00
Denis Kenzior 02138901d3 handsfree: Remove function
No need for one line functions that are only used once
2014-04-10 09:43:41 -05:00
Denis Kenzior 24e87d2580 handsfree: Rename function
No need for the ofono_ prefix here
2014-04-10 09:31:58 -05:00
Denis Kenzior 057c4d788f handsfree: Remove unneeded variable 2014-04-10 09:29:32 -05:00
Denis Kenzior 805c3068be handsfree: Remove unneeded variable i 2014-04-10 09:29:11 -05:00
Denis Kenzior eb4fd9f5aa handsfree: style fixes for previous commit 2014-04-10 09:25:30 -05:00
Andrew Earl 8327d528a9 hfp: Add subscriber number to handsfree properties 2014-04-10 09:21:23 -05:00
Denis Kenzior 5705a0078e handsfree: Fixup variable names 2014-03-19 10:19:35 -05:00
Krzysztof Wilk b2b3943717 hfp: extend Features to three way calling and CHLD 2014-03-19 10:15:55 -05:00
Krzysztof Wilk 2e78ea1830 hfp: Define hfp_ag_chld_feature 2014-03-19 10:12:16 -05:00
Alfonso Sanchez-Beato 46de4df677 simutil: Fix EF_PNN access
EF_PNN was not being read properly (see TS 24.008, section 10.5.3.5a,
for network names format), which affected the displayed PLMN name for
some MVNOs. Some modems already read the file and return the right
string: these do not show the problem.
2014-03-14 12:24:26 -05:00
Tony Espy 201d34b0a1 idmap: use UL for bitshift literals
The current bitshift logic in idmap incorrectly uses
the literal 1 for the value to shift in idmap_alloc(),
idmap_take(), and idmap_alloc_next().  This causes the
resulting value to be an int instead of a long, which
results in the wrong bit being set once the number of
bits to shift operand exceeds sizeof(int).  Also
on some platforms, the behavior of the left bitshift
operator is undefined when this overflow occurs.
2014-03-05 08:49:50 -06:00
Slava Monich c2e58405ee include: Be more const-correct in ofono_dbus_* 2014-01-13 10:19:54 -06:00
Denis Kenzior d6af339c99 git: Fixup messed up permissions 2013-12-21 13:39:54 -06:00
Krzysztof Wilk 5c11e13019 siri: Add atom implementation 2013-12-18 00:07:47 -06:00
Vinicius Costa Gomes 51982e7b13 handsfree-audio: Don't listen() if no defer_setup
As we won't allow any card to be registered when the kernel doesn't
support defer_setup, we don't need to have the listening SCO socket
open in this case.
2013-09-12 13:17:40 -05:00
Vinicius Costa Gomes 6d08a47ec3 handsfree-audio: Don't register if no defer_setup
If the kernel doesn't support defer_setup for SCO, we shouldn't allow
cards to be registered, because in that case we won't be able to
properly send the file descriptor to the Agent.
2013-09-12 13:17:40 -05:00
Vinicius Costa Gomes e84bd27b99 handsfree-audio: Set socket parameters
In the AG case, the voice setting needs to be set before we can
use Transparent SCO mode, which is necessary for Wideband speech
support.
2013-09-12 13:17:40 -05:00
Vinicius Costa Gomes ff16aed8bd handsfree-audio: Detect transparent SCO in kernel
Deferred SCO setup is not enough for HFP 1.6 wideband codec support.
Wideband speech also requires Transparent SCO to be enabled in the
kernel.
2013-09-12 13:17:40 -05:00
Denis Kenzior e574d44d00 handsfree-audio: Tweak logic a bit 2013-09-12 13:17:40 -05:00
Vinicius Costa Gomes 0de0f496cb handsfree-audio: Add setting SCO air mode 2013-09-12 13:17:40 -05:00
Denis Kenzior 394069cb59 voicecall: Implement ofono_voicecall_mpty_hint 2013-09-12 13:17:39 -05:00
Denis Kenzior d7ba153737 smsutil: Make sure to return 1/0
So the value might be used directly for D-Bus property emission.
Otherwise D-Bus asserts and screws itself with:
ofonod[7427]: src/sms.c:handle_mwi()
process 7427: arguments to dbus_message_iter_append_basic() were
incorrect, assertion "*bool_p == 0 || *bool_p == 1" failed in file
../../dbus/dbus-message.c line 2549.
2013-09-03 22:58:59 -05:00
Vinicius Costa Gomes 8a11d38983 bluetooth: Add define for SCO voice settings
Add defines for SCO voice setting (Air Coding). Air mode "Transparent
Data" shall be supported if wide band speech is supported.
2013-08-19 12:14:39 -05:00
Denis Kenzior 9e112379b5 handsfree-audio: Make sure to reset has_wideband
When Agent is unregistered we do not know whether the wideband speech is
supported.  Default to false.
2013-08-07 16:37:23 -05:00
Lucas De Marchi 53a0fa8c7c common: Fix parsing SS control string
It's not possible to be both greater than '9' and less than '0'. This
would lead to accepting things like "#$33#" as activation and "*$33#" as
deactivation, even though the string makes no sense.
2013-05-22 21:40:19 -05:00
Lucas De Marchi 874a9ee285 stk: Fix sizeof on memcpy
src/stk.c: In function ‘__ofono_cbs_sim_download’:
src/stk.c:283:45: error: argument to ‘sizeof’ in ‘memcpy’ call is the
same expression as the source; did you mean to dereference it?
[-Werror=sizeof-pointer-memaccess]
  memcpy(&e.cbs_pp_download.page, msg, sizeof(msg));
                                               ^
2013-05-22 21:37:52 -05:00