Commit Graph

8444 Commits

Author SHA1 Message Date
Jonas Bonn 88d9b1a32d qmi: make services always shared 2018-04-04 10:03:13 -05:00
Jonas Bonn c0527a211c gobi: Update to the new version_list changes 2018-04-04 09:59:53 -05:00
Jonas Bonn 6485522c91 qmi: make version_list private 2018-04-04 09:59:44 -05:00
Jonas Bonn 76471964e2 qmi: assume version_list is up to date
The way things are currently coded, the gobi plugin calls
qmi_device_discover and does nothing else until it succeeds.  As such,
we can safely assume that the version_list is set up when we go to
create a service.
2018-04-04 09:56:22 -05:00
Jonas Bonn 81180147cf qmi: drop header output parameter from request_alloc
The only thing this output parameter is being used for now is for
getting the transaction ID.  Return the TID directly from
__submit_requesta and drop the 'head' parameter altogether.
2018-04-04 09:55:56 -05:00
Jonas Bonn a357565377 qmi: request_alloc has no meaningful failure path
The only way request_alloc can fail is if one of the memory allocation
routines fail to allocate memory.  However, Linux memory allocation
doesn't really fail in this manner; memory can be overcommited and the
out-of-memory reaper will take care of re-establishing the balance when
excess memory is actually accessed.

Given this, request_alloc will never return anything other than success
and the failure paths will never be exercised.
2018-04-04 09:55:21 -05:00
Jonas Bonn 093bdda7be qmi: unify common request header setup
The service and control requests differ slightly in their headers, but
this difference is minor enough that we can handle it directly in the
request submission routine.  This patch unifies the header setup for the
two request types.
2018-04-04 09:55:13 -05:00
Jonas Bonn 4ef8814215 qmi: remove headroom parameter from req_alloc
The headroom can be established from the service type, so it's redundant
to pass it as a parameter.
2018-03-29 09:54:39 -05:00
Jonas Bonn 4846c26948 qmi: remove unused fields of service_send_data
After setting up the request structure, qmi_service_send makes no
further use of the 'param' and 'service' fields of the service_send_data
structure.  This patch removes those fields and frees 'param'
immediately after the request has been allocated and the parameter data
thereby copied into the send buffer.
2018-03-29 09:52:22 -05:00
Denis Kenzior 8b8a760644 simfs: Fix crash in sim_fs_op_free
If an operation is in progress and an operation is canceled, we don't
actually destroy it, but simply clear out the callback.  In the case of
a context being destroyed, the operation is left on the simfs op_q with
a dangling pointer to the already freed context.  So the current logic
in sim_fs_op_free tries to access invalid memory.

Fix this by performing the watch operations in sim_fs_end_current
instead and setting the context pointer appropriately.
2018-03-29 09:46:22 -05:00
Bassem Boubaker db9b292f92 gemalto: Clarify supported modem family name
Some gemalto modem family share almost the same base except some very
specific AT command and some hardware changes like ALSx and PXSx family
2018-03-19 12:11:12 -05:00
Mariem Cherif 1c83dc18c4 gemalto: handle sim is inserted or removed URCs 2018-03-19 12:08:52 -05:00
Denis Kenzior 501de60ec0 qmi: Fix uninitialized value use
==2870== Conditional jump or move depends on uninitialised value(s)
==2870==    at 0x4C2ED31: __memcmp_sse4_1 (vg_replace_strmem.c:972)
==2870==    by 0x4F451A: sim_pin_retries_query_cb (sim.c:462)
==2870==    by 0x459BDD: query_pin_retries_cb (sim.c:544)
==2870==    by 0x45544A: service_send_callback (qmi.c:2143)
==2870==    by 0x452D00: handle_packet (qmi.c:815)
==2870==    by 0x452E85: received_data (qmi.c:863)
==2870==    by 0x508DB6C: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508DF47: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508E271: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x4C680B: main (main.c:256)
==2870==  Uninitialised value was created by a stack allocation
==2870==    at 0x459B1A: query_pin_retries_cb (sim.c:531)
==2870==
==2870== Conditional jump or move depends on uninitialised value(s)
==2870==    at 0x4F451D: sim_pin_retries_query_cb (sim.c:462)
==2870==    by 0x459BDD: query_pin_retries_cb (sim.c:544)
==2870==    by 0x45544A: service_send_callback (qmi.c:2143)
==2870==    by 0x452D00: handle_packet (qmi.c:815)
==2870==    by 0x452E85: received_data (qmi.c:863)
==2870==    by 0x508DB6C: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508DF47: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508E271: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x4C680B: main (main.c:256)
==2870==  Uninitialised value was created by a stack allocation
==2870==    at 0x459B1A: query_pin_retries_cb (sim.c:531)
==2870==
==2870== Conditional jump or move depends on uninitialised value(s)
==2870==    at 0x4F3DFB: get_pin_retries (sim.c:278)
==2870==    by 0x4F4553: sim_pin_retries_query_cb (sim.c:467)
==2870==    by 0x459BDD: query_pin_retries_cb (sim.c:544)
==2870==    by 0x45544A: service_send_callback (qmi.c:2143)
==2870==    by 0x452D00: handle_packet (qmi.c:815)
==2870==    by 0x452E85: received_data (qmi.c:863)
==2870==    by 0x508DB6C: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508DF47: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508E271: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x4C680B: main (main.c:256)
==2870==  Uninitialised value was created by a stack allocation
==2870==    at 0x459B1A: query_pin_retries_cb (sim.c:531)
==2870==
==2870== Conditional jump or move depends on uninitialised value(s)
==2870==    at 0x4F3E65: get_pin_retries (sim.c:288)
==2870==    by 0x4F4553: sim_pin_retries_query_cb (sim.c:467)
==2870==    by 0x459BDD: query_pin_retries_cb (sim.c:544)
==2870==    by 0x45544A: service_send_callback (qmi.c:2143)
==2870==    by 0x452D00: handle_packet (qmi.c:815)
==2870==    by 0x452E85: received_data (qmi.c:863)
==2870==    by 0x508DB6C: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508DF47: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x508E271: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1)
==2870==    by 0x4C680B: main (main.c:256)
==2870==  Uninitialised value was created by a stack allocation
==2870==    at 0x459B1A: query_pin_retries_cb (sim.c:531)
2018-03-19 12:01:05 -05:00
Denis Kenzior a99c0be535 simfs: Fix crash
0  0x00007ffff7b20517 in g_queue_is_empty () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
1  0x00005555556adcdd in sim_fs_op_free (pointer=0x5555559cb990) at src/simfs.c:101
2  0x00007ffff7b205fc in g_queue_foreach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
3  0x00007ffff7b2065b in g_queue_free_full () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
4  0x00005555556add81 in sim_fs_free (fs=0x5555559c0780) at src/simfs.c:125
5  0x00005555556828f3 in sim_remove (atom=0x5555559cb000) at src/sim.c:3175
6  0x000055555564f16f in flush_atoms (modem=0x555555a8fb00, new_state=MODEM_STATE_POWER_OFF) at src/modem.c:432
7  0x000055555564f3bd in modem_change_state (modem=0x555555a8fb00, new_state=MODEM_STATE_POWER_OFF)
    at src/modem.c:510
8  0x000055555564ff99 in set_powered (modem=0x555555a8fb00, powered=0) at src/modem.c:896
9  0x000055555565074c in modem_set_property (conn=0x55555596c8d0, msg=0x55555596e460, data=0x555555a8fb00)
    at src/modem.c:1120
2018-03-19 11:50:13 -05:00
Denis Kenzior ad86c7e529 qmi: Fix memory leak
==14399== 28 bytes in 4 blocks are definitely lost in loss record 151 of 390
==14399==    at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==14399==    by 0x209065: convert_gsm_to_utf8_with_lang (util.c:651)
==14399==    by 0x2091D1: convert_gsm_to_utf8 (util.c:690)
==14399==    by 0x22DDA7: ussd_decode (smsutil.c:4738)
==14399==    by 0x18BF71: qmi_ussd_request (ussd.c:233)
==14399==    by 0x2183EA: ussd_initiate (ussd.c:614)
==14399==    by 0x27B6C8: process_message (object.c:259)
==14399==    by 0x27D1CD: generic_message (object.c:1070)
==14399==    by 0x5170732: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.14)
==14399==    by 0x5161D83: dbus_connection_dispatch (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.14)
==14399==    by 0x27907C: message_dispatch (mainloop.c:72)
==14399==    by 0x4E826A9: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
2018-03-19 11:49:42 -05:00
Denis Kenzior 452a6e5421 qmi: Fix memory leak
==14399== 16 bytes in 8 blocks are definitely lost in loss record 132 of 390
==14399==    at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==14399==    by 0x59E03D9: strndup (strndup.c:43)
==14399==    by 0x18277E: qmi_result_get_string (qmi.c:1794)
==14399==    by 0x184221: get_ids_cb (devinfo.c:129)
==14399==    by 0x18353B: service_send_callback (qmi.c:2286)
==14399==    by 0x18093C: handle_packet (qmi.c:831)
==14399==    by 0x180ADD: received_data (qmi.c:880)
==14399==    by 0x4E826A9: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
==14399==    by 0x4E82A5F: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
==14399==    by 0x4E82D81: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
==14399==    by 0x201900: main (main.c:306)
2018-03-19 11:48:34 -05:00
Gabriel Lucas 50ad43dbe5 gemalto: support ALS3 in gemalto's plugin
Force serial port opening options
Wait for modem to be ready to start
initializing it
Handle LTE
2018-03-19 10:24:02 -05:00
Bassem Boubaker 76b5a4044f gemalto: Add more details in setup_gemalto comment
ALS3, PLS8-E and PLS8-X have same vid/pid with same enumeration process
2018-03-16 12:39:56 -05:00
Denis Kenzior cc0a04d16e AUTHORS: Mention Bassem's contributions 2018-03-16 10:26:06 -05:00
Bassem Boubaker 4e908bfcf4 cdma-netreg: Fix emission of PropertyChanged 2018-03-16 10:24:57 -05:00
Denis Kenzior e5da2bd37a AUTHORS: Mention Mariem's contributions 2018-03-16 09:25:25 -05:00
Mariem Cherif ce37f864f3 gemalto: acquire the network technology 2018-03-16 09:24:42 -05:00
Gabriel Lucas 245d6a8a77 gemalto: add detection of ALS3 modem
The product ID is added to the list of
modems to be detected by Ofono.
The gemalto plugin is used to handle the
ALS3 modem.
2018-03-15 11:54:33 -05:00
Denis Kenzior 5d346349fb plugins: Update to the new LTE API 2018-03-12 09:37:58 -05:00
Denis Kenzior 3e657c4e75 ubloxmodem: Update to the new LTE API 2018-03-12 09:37:58 -05:00
Denis Kenzior 3c128f18af rilmodem: Update to the new LTE API 2018-03-12 09:37:58 -05:00
Denis Kenzior 375aa5efbb qmimodem: Update to the new LTE API 2018-03-12 09:37:58 -05:00
Denis Kenzior 4103f81846 atmodem: Update to the new lte API 2018-03-12 09:37:58 -05:00
Denis Kenzior 158159ecb0 lte: update to the new API 2018-03-12 09:37:58 -05:00
Denis Kenzior 0cbddaf98b include: Add missing vendor parameter to lte atom 2018-03-12 09:37:58 -05:00
Marcel Holtmann 8766cedac6 Release 1.23 2018-03-10 17:15:06 +01:00
Jonas Bonn b4aff8549d qmimodem: release DMS service on radio-settings atom removal 2018-03-07 10:13:32 -06:00
Jonas Bonn 924f37b4b5 qmimodem: release WDS service on GPRS atom removal 2018-03-07 10:13:29 -06:00
Jonas Bonn b7b0b4ab73 qmimodem: get LTE default bearer APN from modem
When an LTE modem registers with the network, a default bearer is
automatically established.  The APN used for this bearer is taken from
whatever default settings the modem has.

The LTE atom takes cares of setting up the default context/profile with
the APN to use.  From there, a default bearer will be established when
the modem registers with the network.  This results in a call to 'Get
LTE Attach Parameters' which tells us what APN the gateway negotiated
with us.

If we can't get the APN, we do what the AT driver does:  pretend the
bearer wasn't established.  This is a reasonable fallback, currently,
because connman can't handle zero-length APN's anyway; the previous
approach of setting the APN to 'automatic' breaks connman badly when it
needs to switch between LTE and non-LTE networks.
2018-03-05 11:33:26 -06:00
Jonas Bonn 12a943866a gobi: add LTE atom
This atom needs to be created in post_sim so that the APN can be
written to the default profile before the modem attempts to use the
setting to connect to the network.
2018-03-05 11:32:47 -06:00
Jonas Bonn f2e38a6b42 qmi: add LTE atom driver
This patch adds an LTE atom for QMI modems.

This atom sets the APN that the LTE default bearer should use when
establishing its PDP context.  This APN needs to be set on the 'default'
profile so the atom queries which profile is the default and resets
it before allowing the APN to be set.

Once configured, the default profile settings are used when the
modem connects to the network; for this reason, the LTE atom needs
to be instantiated in post_sim, before the modem is set online.
2018-03-05 11:32:30 -06:00
Denis Kenzior dca9071ffe sim-auth: Improve pending cleanup on sim_auth_remove 2018-02-28 11:28:54 -06:00
Denis Kenzior d65a2fc377 sim: Do not leak aid_list
==31530== 366 (48 direct, 318 indirect) bytes in 3 blocks are definitely lost in loss record 165 of 186
==31530==    at 0x4C2BF8F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==31530==    by 0x50BB3A3: g_malloc (gmem.c:94)
==31530==    by 0x50D62B4: g_slice_alloc (gslice.c:1025)
==31530==    by 0x50D7A1E: g_slist_prepend (gslist.c:254)
==31530==    by 0x4DD0B3: sim_parse_app_template_entries (simutil.c:1590)
==31530==    by 0x4D2242: discover_apps_cb (sim.c:1509)
==31530==    by 0x45E364: at_discover_apps_cb (sim.c:1579)
==31530==    by 0x49CB5F: at_chat_finish_command (gatchat.c:459)
==31530==    by 0x49DAC7: at_chat_handle_command_response (gatchat.c:521)
==31530==    by 0x49DAC7: have_line (gatchat.c:600)
==31530==    by 0x49DAC7: new_bytes (gatchat.c:759)
==31530==    by 0x49FCEF: received_data (gatio.c:122)
==31530==    by 0x510C2F3: g_io_unix_dispatch (giounix.c:165)
==31530==    by 0x50B2D44: g_main_dispatch (gmain.c:3203)
2018-02-28 11:22:46 -06:00
Denis Kenzior dc59351de6 sim-auth: Do not leak nai
==31530== 88 bytes in 2 blocks are definitely lost in loss record 132 of 186
==31530==    at 0x4C2BF8F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==31530==    by 0x5847B97: vasprintf (in /lib64/libc-2.23.so)
==31530==    by 0x510AE38: g_vasprintf (gprintf.c:316)
==31530==    by 0x50D8BDF: g_strdup_vprintf (gstrfuncs.c:514)
==31530==    by 0x50D8CAA: g_strdup_printf (gstrfuncs.c:540)
==31530==    by 0x4F706B: build_nai (sim-auth.c:660)
==31530==    by 0x4F706B: sim_auth_register (sim-auth.c:738)
==31530==    by 0x4F706B: ofono_sim_auth_create (sim-auth.c:768)
==31530==    by 0x4ACBB4: modem_change_state (modem.c:525)
==31530==    by 0x4AD0CD: sim_state_watch.part.5 (modem.c:720)
==31530==    by 0x4CF6D0: call_state_watches (sim.c:366)
==31530==    by 0x4CF6D0: sim_set_ready (sim.c:1475)
==31530==    by 0x4CF6D0: sim_imsi_obtained (sim.c:1577)
==31530==    by 0x45D868: at_cimi_cb (sim.c:453)
==31530==    by 0x49CB5F: at_chat_finish_command (gatchat.c:459)
==31530==    by 0x49DAC7: at_chat_handle_command_response (gatchat.c:521)
==31530==    by 0x49DAC7: have_line (gatchat.c:600)
==31530==    by 0x49DAC7: new_bytes (gatchat.c:759)
2018-02-28 11:21:45 -06:00
Denis Kenzior 497e38f237 unit: Use sim_app_record_free to avoid memleaks 2018-02-28 11:08:29 -06:00
Denis Kenzior 134b163182 simutil: Add sim_app_record free 2018-02-28 11:08:16 -06:00
Denis Kenzior 984d88492d sim: Fix crash
aid_sessions was not properly reset to NULL when freed:

Program received signal SIGSEGV, Segmentation fault.
__ofono_watchlist_free (watchlist=0x0) at src/watch.c:91
91		for (l = watchlist->items; l; l = l->next) {
(gdb) bt
    func=0x4ceca0 <aid_session_free>, user_data=0x0)
    at /var/tmp/portage/dev-libs/glib-2.50.3-r1/work/glib-2.50.3/glib/gslist.c:878
    free_func=0x4ceca0 <aid_session_free>)
    at /var/tmp/portage/dev-libs/glib-2.50.3-r1/work/glib-2.50.3/glib/gslist.c:172
    at src/sim.c:2605
    user_data=<optimized out>) at plugins/phonesim.c:511
    func=0x49c8a0 <at_notify_call_callback>, user_data=0x7fffffffdbc0)
    at /var/tmp/portage/dev-libs/glib-2.50.3-r1/work/glib-2.50.3/glib/gslist.c:878
    chat=0x7b70b0) at gatchat/gatchat.c:417
2018-02-28 10:44:26 -06:00
Slava Monich b5ad34faab phonebook: Fixed double deletion of merge_list 2018-02-22 09:48:23 -06:00
Christophe Ronco 1df92289d4 udevng: Add modem string SystemPath 2018-02-20 11:09:25 -06:00
Christophe Ronco 895ca91d85 modem: Add SystemPath dbus property 2018-02-20 11:09:11 -06:00
Christophe Ronco 4b1609c2d7 doc: Add SystemPath to Modem interface 2018-02-20 11:08:46 -06:00
Philippe De Swert 31e9b73238 doc: add new DialMemory method to VoicecallManager 2018-02-13 13:09:14 -06:00
Denis Kenzior 1a57d8a92e hfpmodem: Don't use strcat 2018-02-13 13:08:52 -06:00
Philippe De Swert 96508d1e2c hfpmodem: Add memory dialling support
Handle the request to dial from a memory index and send the
correct ATD> sequence to make it happen.
2018-02-13 13:08:33 -06:00
Philippe De Swert 2de1aff6bd voicecall: Add memory location dialing
Implement functionality to allow to  dial favourites/quick contacts over
bluetooth.
2018-02-13 13:05:53 -06:00