Commit Graph

1822 Commits

Author SHA1 Message Date
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
Marcel Holtmann 77398ff772 rilmodem: Use pragma to mask restrict buffer warnings
In file included from drivers/rilmodem/network-registration.c:40:
drivers/rilmodem/network-registration.c: In function ‘ril_cops_list_cb’:
./gril/gril.h:98:11: error: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Werror=restrict]
   sprintf(print_buf, x);  \
           ^~~~~~~~~
drivers/rilmodem/network-registration.c:583:3: note: in expansion of macro ‘g_ril_append_print_buf’
   g_ril_append_print_buf(nd->ril, "%s [lalpha=%s, salpha=%s, "
   ^~~~~~~~~~~~~~~~~~~~~~
./gril/gril.h:98:11: error: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Werror=restrict]
   sprintf(print_buf, x);  \
           ^~~~~~~~~
drivers/rilmodem/network-registration.c:593:2: note: in expansion of macro ‘g_ril_append_print_buf’
  g_ril_append_print_buf(nd->ril, "%s}", print_buf);
  ^~~~~~~~~~~~~~~~~~~~~~

In file included from drivers/rilmodem/call-forwarding.c:41:
drivers/rilmodem/call-forwarding.c: In function ‘ril_query_call_fwd_cb’:
./gril/gril.h:98:11: error: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Werror=restrict]
   sprintf(print_buf, x);  \
           ^~~~~~~~~
drivers/rilmodem/call-forwarding.c:114:3: note: in expansion of macro ‘g_ril_append_print_buf’
   g_ril_append_print_buf(fd->ril, "%s [%d,%d,%d,%s,%d]",
   ^~~~~~~~~~~~~~~~~~~~~~
./gril/gril.h:98:11: error: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Werror=restrict]
   sprintf(print_buf, x);  \
           ^~~~~~~~~
drivers/rilmodem/call-forwarding.c:124:2: note: in expansion of macro ‘g_ril_append_print_buf’
  g_ril_append_print_buf(fd->ril, "%s}", print_buf);
  ^~~~~~~~~~~~~~~~~~~~~~
2018-06-14 15:19:16 +02: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
Christophe Ronco beed2aee9e qmi: report SIM not inserted when unable to get PIN type 2018-04-19 10:29:40 -05:00
Christophe Ronco 8af406a45d qmi: report failure or retry in case of invalid pin type
QMI_UIM_GET_CARD_STATUS is retried in more error cases
when trying to get password type.
In case of failure, driver report an error instead of
OFONO_SIM_PASSWORD_INVALID. This avoids a crash.
2018-04-19 10:27:32 -05:00
Christophe Ronco bfa0ac979e qmi: use right slot and application during SIM detection
Use right slot and application to get card status, PIN status and PIN
retries. Without this patch, SIMs where selected application and slot
numbers are different are not detected.
2018-04-19 10:24:50 -05:00
Jonas Bonn 88d9b1a32d qmi: make services always shared 2018-04-04 10:03:13 -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 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 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
Mariem Cherif ce37f864f3 gemalto: acquire the network technology 2018-03-16 09:24:42 -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
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 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 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
Jonas Bonn e29f9511b1 xmm7modem: drop executable bit from C source file 2018-02-05 10:19:44 -06:00
Alexander Couzens f7544d87a3 qmi: add USSD support for MO services 2018-01-16 11:32:03 -06:00
Alexander Couzens 23dc3cb701 add qmimodem/voice.h to add USSD defines
USSD is part of the QMI voice service.
2018-01-16 11:17:14 -06:00
Alexander Couzens 070608b899 qmimodem: convert register_net_cb errors into CMEs
Certain modems doesn't support manual registering (gobi 2000).
Translate the error code into ofono error to report a
more detailed debug error message.
2017-12-05 22:06:44 -06:00
Alexander Couzens 5066a45762 qmimodem: add translator qmi_error_to_ofono_cme()
Translates qmi error codes into ofono cme errors
2017-12-05 22:06:44 -06:00
Alexander Couzens 85a0c9b595 qmimodem: add define CALLBACK_WITH_CME_ERROR(cb, err, args..) 2017-12-05 22:06:44 -06:00
Alexander Couzens 78ab13470a qmi: implement the control sync command
The sync command resets the QMI interface state. It will flushs all
previous assigned sessions and transactions.
2017-12-05 22:04:15 -06:00
Alexander Couzens f02363181f qmi: include the CTL in the debug output
The CTL version is important for certain calls. This is
a useful information for debugging.
2017-12-05 22:04:15 -06:00
Alexander Couzens 5f33ec2d5d qmi/discovery: remove useless code 2017-12-05 22:04:15 -06:00
Denis Kenzior 22c625080e mbimmodem: fix crash
==12340== Invalid read of size 1
==12340==    at 0x4C2F9A0: __strncpy_sse2_unaligned (vg_replace_strmem.c:548)
==12340==    by 0x4A3520: strncpy (string3.h:126)
==12340==    by 0x4A3520: mbim_current_operator_cb (network-registration.c:178)
==12340==    by 0x49DC5D: dispatch_command_done (mbim.c:529)
==12340==    by 0x49DC5D: dispatch_message (mbim.c:594)
==12340==    by 0x49DC5D: command_read_handler (mbim.c:701)
2017-11-13 21:24:37 -06:00
Denis Kenzior a004120a99 mbimmodem: Add provisioned context query (debug only) 2017-11-13 21:24:37 -06:00
Denis Kenzior 2abfd90edd mbimmodem: Add gprs-context driver 2017-11-13 21:24:37 -06:00
Denis Kenzior f43341af2f mbim: Add IPv4/v6 Element & Address extractors
The IP Configuration data structure does not match any of the existing
data structure serialization conventions in the rest of the MBIM
specification.  So add IPv4 / v6 specific extractors for IPV4 address
and IPV4 Element structures.
2017-11-13 21:24:37 -06:00
Denis Kenzior 2690d1c8dd mbim: Add mbim context type UUIDs 2017-11-13 21:24:37 -06:00
Denis Kenzior 2d164c38c4 mbimmodem: Add GPRS atom driver 2017-11-13 21:24:37 -06:00
Denis Kenzior f7bd6900c3 mbim: Properly write values in little endian format 2017-11-13 21:24:37 -06:00
Denis Kenzior cc196e6503 mbim: Add support for 64-bit integers 2017-11-13 21:24:37 -06:00
Denis Kenzior f8b4730d4f mbimmodem: Move available_data_classes_to_tech
to util.[ch] so it can be used from other drivers
2017-11-09 11:39:43 -06:00
Denis Kenzior 47b562b91c mbim: Silence unused variable warning 2017-11-09 11:39:07 -06: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
Denis Kenzior bd0ba8bf3b mbim: Support variable struct signatures in arrays
DEVICE_SUBSCRIBE_LIST uses an array of structures.  The structure
contains the UUID of the service and then a variable number of CIDs that
are enabled.
2017-11-08 21:41:34 -06:00
Denis Kenzior 3ed0a1e077 mbimmodem: Add SMS atom 2017-11-08 21:41:34 -06:00
Denis Kenzior 529d522a00 mbim: Support embedded databuffers
SMS_SEND uses an embedded databuffer inside MBIM_SET_SMS_SEND which
wants to use a local offset (local to the databuffer structure) as
opposed to the offset from the start of the static buffer.
2017-11-08 21:41:31 -06:00
Denis Kenzior 5ef333b363 mbim: Fix incorrectly generating arrays 2017-11-08 21:02:22 -06:00
Denis Kenzior bae2843eac mbim: Add additional sanity checking
For zero element arrays we might inadvertently run past the end of the
iov buffer.  Fix this by adding additional checks that n_elem > 0 and
don't call _iter_get_data unless needed.
2017-11-08 21:02:22 -06:00
Denis Kenzior dc8574ba55 mbim: Support appending byte arrays 2017-11-08 21:02:22 -06:00
Denis Kenzior 79ebe4beb9 mbim: Fix iterator advance logic 2017-11-08 21:02:22 -06:00
Denis Kenzior 2ec8ed30bf mbimmodem: Add netreg driver 2017-11-08 21:02:22 -06:00
Denis Kenzior 689ebc808f mbim: Add MBIM_DATA_CLASS enum 2017-11-08 21:02:22 -06:00
Denis Kenzior 0222e657a0 mbimmodem: Support PIN/PUK operations 2017-11-08 21:02:22 -06:00
Denis Kenzior ecc6332e28 mbim: Fix comment typo 2017-11-08 21:02:22 -06:00
Denis Kenzior 9315d73f62 mbim: Add support for registering to notifications 2017-11-08 21:02:22 -06:00
Denis Kenzior 286e1b0952 hfpmodem: Make sure to NULL terminate 2017-11-08 21:02:22 -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
Philippe De Swert 57b1afc2e7 hfpmodem: Send last call dialled request
Handle the last call dialled request and send the required AT+BDLN command
for bluetooth HFP profile.
2017-11-03 13:27:22 -05:00
Christophe Ronco 5be941c608 qmi: remove request when it timeouts
When modem does not answer or answers slowly to a discovery request,
a timeout occurs.
In timeout callback, request should be removed from queues to avoid
treating answer if it arrives later.
2017-10-30 09:03:59 -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
Jonas Bonn 35636752ad qmi: support SMS receive on Quectel EC21
The Quectel EC21 does not provide the SMS PDU on the message event
notification.

This patch adds a call to 'raw read' on the message ID from the event
notification if the event notification does not already contain the
message data.

The message data begins with the SMSC length, type, and address so
the TPDU length is adjusted accordingly in the raw_read callback.  This
differs from the way the raw message data is handled in the case
that it is included in the event notification itself.  As I don't have
access to any other QMI modem at this time, I'm can not confirm that
this difference is reasonable.
2017-10-17 09:35: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
Denis Kenzior 92296924ff mbim: Add basic SIM driver 2017-10-09 16:37:39 -05:00
Ankit Navik 2518c0e9d2 xmm7modem: Add ims atom driver 2017-10-09 11:39:03 -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 94cefc7cff mbim: Add CIDs from the specification 2017-10-05 11:08:38 -05:00
Denis Kenzior f0c1bdcf88 mbim: Support all types in _mbim_message_build 2017-10-05 11:08:38 -05:00
Denis Kenzior 978752bcd6 mbim: Add devinfo driver
Querying Manufacturer and Model is still not supported
2017-10-05 11:08:38 -05:00
Denis Kenzior cc90b1f71e mbim: Add mbim_device_cancel_group 2017-10-05 11:08:38 -05:00
Denis Kenzior db42e75a9c mbim: Add mbim_device_cancel 2017-10-05 11:08:38 -05:00
Denis Kenzior b5512b2775 mbim: Implement receiving responses 2017-10-05 11:08:38 -05:00
Denis Kenzior f92ca542e7 mbim: Implement sending commands 2017-10-05 11:08:38 -05:00
Denis Kenzior c995e657f4 mbim: Close IO in an idle event 2017-10-05 11:08:38 -05:00
Denis Kenzior 65d6d7d199 mbim: Add is_ready flag 2017-10-05 11:08:38 -05:00
Denis Kenzior b1a089eb0f mbim: Add message_assembly utilities 2017-10-05 11:08:38 -05:00
Denis Kenzior 1d16d4ac4e mbim: Add header & body accessors for mbim-message 2017-10-05 11:08:38 -05:00
Denis Kenzior 0c8199dca5 mbim: Implement MBIM_CLOSE_MSG 2017-10-05 11:08:38 -05:00
Denis Kenzior 076faf21d7 mbim: Implement MBIM_OPEN_MSG 2017-10-05 11:08:38 -05:00
Denis Kenzior 4e058ece2c mbim: Add mbim_device_set_ready_handler 2017-10-05 11:08:38 -05:00
Denis Kenzior d8686704e7 mbim: Rework constructor 2017-10-05 11:08:38 -05:00
Denis Kenzior d8485cb5f4 mbim: Get rid of fd and close_on_unref members
l_io already does this for us
2017-10-05 11:08:38 -05:00
Denis Kenzior fb1641c539 mbim: Add mbim_device_set_max_outstanding 2017-10-05 11:08:38 -05:00
Denis Kenzior 684be2760c mbim: Add mbim_message_get_uuid 2017-10-05 11:08:38 -05:00
Denis Kenzior a12f3c73ac mbim: Add mbim_message_get_cid 2017-10-05 11:08:38 -05:00
Denis Kenzior d9b0bbf69b mbim: Rework mbim_message_new 2017-10-05 11:08:38 -05:00
Denis Kenzior 8c0caf5715 mbim: Add mbim_message_get_error 2017-10-05 11:08:38 -05:00
Denis Kenzior 5f6a0147ba unit: Add phonebook read build test 2017-10-05 11:08:38 -05:00
Denis Kenzior 75993d8edc mbim: Add mbim_message_set_arguments 2017-10-05 11:08:38 -05:00
Denis Kenzior 1ed919c368 mbim: Support for building variable-sized structs 2017-10-05 11:08:38 -05:00
Denis Kenzior 54ff05956c mbim: Add support for building arrays 2017-10-05 11:08:38 -05:00
Denis Kenzior 9ed20413cc mbim: Add _mbim_message_to_bytearray 2017-10-05 11:08:38 -05:00
Denis Kenzior 76c97996f5 mbim: Add _mbim_message_set_tid 2017-10-05 11:08:38 -05:00
Denis Kenzior f66c2fe982 mbim: Add _mbim_message_new_command_done
This is for unit testing purposes
2017-10-05 11:08:38 -05:00
Denis Kenzior 76811bb326 mbim: Add basic message builder support 2017-10-05 11:08:38 -05:00
Denis Kenzior 397079cc13 mbim: Add MBIM service UUID constants 2017-10-05 11:08:38 -05:00
Denis Kenzior 99501a7d1d mbim: Support parsing structures 2017-10-05 11:08:38 -05:00
Denis Kenzior db1a61cd27 mbim: Add support for arrays of fixed-size elements
Variable-sized arrays are handled by using an Element Count followed by
OL_PAIR_LIST.  For fixed size arrays, an Offset followed by Length is
used.
2017-10-05 11:08:38 -05:00
Denis Kenzior 506e77053b mbim: Don't assume 4-byte alignment
This change would make it possible to read individual bytes from ay type
structures.
2017-10-05 11:08:38 -05:00
Denis Kenzior a64b5453e8 mbim: Parse variable sized item arrays 2017-10-05 11:08:38 -05:00
Denis Kenzior b9de1d999f mbim: Add mbim_message_get_arguments 2017-10-05 11:08:38 -05:00
Denis Kenzior 3ee2343803 mbim: Handle extraction of strings 2017-10-05 11:08:38 -05:00
Denis Kenzior 60c9225169 mbim: add _mbim_information_buffer_length_offset 2017-10-05 11:08:38 -05:00
Denis Kenzior f854c8d193 mbim: Add basic message payload parser 2017-10-05 11:08:38 -05:00
Denis Kenzior 3ddbdda745 mbim: Add skeleton mbim-message class 2017-10-05 11:08:38 -05:00
Denis Kenzior 2d4093ae27 mbim: Add MBIM descriptor utilities
Used to find MBIM Functional and MBIM Extended Functional descriptors
2017-10-05 11:08:38 -05:00
Denis Kenzior 1bfa2749cd mbim: Add skeleton mbim_device object 2017-10-05 11:08:38 -05:00
Denis Kenzior ab58196e31 mbimmodem: Add skeleton driver 2017-10-05 11:08:38 -05:00
Christophe Ronco 22adf6402c huawei: add LTE support
Huawei LTE modems use AT^SYSCFGEX and AT^SYSINFOEX instead of
AT^SYSCFG and AT^SYSINFO.
If we want to be able to attach on LTE with this modem, we must use
AT^SYSCFGEX to configure rat mode and band. Using AT^SYSCFG, mode any
means UMTS or GSM.
2017-09-14 20:05:54 -05:00
Denis Kenzior 9405c9733c ifxmodem: Fix minor style issues 2017-09-13 10:28:56 -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
Jonas Bonn fd453816cc qmi: add NetworkMonitor interface
This is a rudimentary implementation that contains technology and RSSI
and BitErrorRate, plus RSRQ/RSRP for LTE networks.  More data can be
added as needed.

This implementations uses the 'Get Signal Strength' QMI method to retrieve
the data.  Operator fields (MNC, LAC, etc) can be gotten from the 'Serving
Cell' method if needed, but since this data is already provided in the
NetworkRegistration object it doesn't seem necessary to repeat it here
when an additional communication to the modem is required.
2017-09-12 12:52:42 -05:00
Joey Hewitt d80b3da897 qmimodem: implement SIM write functions 2017-09-12 12:39:26 -05:00
Alexander Couzens a18c892c64 qmimodem: register callbacks after netreg_register
When registering callbacks before ofono_netreg_register(), callbacks
will use the netreg api which might lead into undefined behaviour,
because certain fields aren't yet initilized.
2017-09-11 10:41:14 -05:00
Nishanth V 4590c695e0 rilmodem: netmon fix missing notify for g_ril_send 2017-09-11 10:37:52 -05:00
Clayton Craft cbac15cdd9 isimodem: Use correct callback for pin status 2017-09-11 10:37:06 -05:00
Nishanth V 25347b9e83 rilmodem: driver changes for netmon agent
Rilmodem driver updated to handle enabling
and disabling periodic serving cell updates
2017-09-08 15:07:06 -05:00
Denis Kenzior 0f2d1278c4 qmimodem: Fix whitespace issue 2017-09-08 09:56:32 -05:00
Jonas Bonn 054323d4ba qmi: provide AvailableTechnologies in radio-settings
This provides the list of available technologies in the radio-settings
atom.  The list is queried by the DMS Get Capabilities method; ofono
takes care of caching the available technologies for us so we don't need
to worry about this method being called excessively.
2017-09-08 09:48:42 -05:00
Alexander Couzens b81bdfe456 qmimodem: extract network time from serving system 2017-09-07 16:50:14 -05:00
Alexander Couzens 8d74986d6e qmimodem: add strength (in %) to the debug output 2017-09-07 16:49:00 -05:00
Jonas Bonn 76689b81d4 qmi: add helper to get int16_t result 2017-09-07 11:57:31 -05:00
Jonas Bonn 4ac537394e qmi: implement RAT selection
The QMI radio-settings atom was just a skeleton and did not even implement
the mandtory property TechnologyPreference.  As such, it probably should
never even have been registered for the modem.  Nonetheless, this patch
puts this mandatory property into place.

This is implemented via the 'Set System Selection' method by way of the
'mode' parameter.  This seems to best reflect the intention of the Ofono
API and works as expected when tested with a Quectel EC21.

Some notes:
i)  There is an alternative function called 'Set Technology Preference'
    which provides similar functionality.  This 'technology preference'
    is updated automatically when the 'system selection mode' is modified
    so everything seems to be in order.
ii) For the EC21, switching the underlying technology works seamlessly.
    There are indications, however, that some modems _might_ require a
    reset before changes take effect; that bridge will need to be crossed
    if reached.
2017-09-07 11:54:25 -05:00
Christophe Ronco b3e4837641 atmodem: correctly report lte bearer for huawei modems 2017-09-07 11:41:01 -05:00
Ankit Navik 2640e0a882 Add support for Intel xmm7xxx series modem driver
This adds driver as xmm7modem for radio-settings
2017-09-05 10:48:00 -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
Alexander Couzens fb17995721 qmi/sms: require WMS version >= 1.2 for bearer calls
I've never seen a major 0 service. The gobi2000 comes with
WMS 1.0 and doesn't support the bearer command. Guessing
it's 1.2 required.
2017-08-22 10:38:14 -05:00
Alexander Couzens 49a7d0aa1b qmimodem: use a default RAT when registering
When registering to an operator ofono uses the old RAT.
In the case the modem is not connected to any network, this would use
QMI_NAS_NETWORK_RAT_NONE which results in the error OP_DEVICE_UNSUPPORTED.

Use QMI_NAS_NETWORK_RAT_NO_CHANGE instead to not define any preference.
2017-08-07 13:50:03 -05:00
Marcel Holtmann 9cdcf72994 ifxmodem: Fix GPRS activation command string buffer size 2017-07-11 10:43:59 -07:00
Marcel Holtmann 339e874212 telitmodem: Fix GPRS activation command string buffer size 2017-07-11 10:43:23 -07:00
Marcel Holtmann 6c936db4ae atmodem: Fix missing break statement for ublox driver 2017-07-11 10:42:59 -07:00
Alexander Couzens 417af0eaf2 qmimodem/sms: don't check for free ME space on receive
If the ME storage is full, the modem will reject new messages
with a SMPP RP-Error 'Protocol error, unspecific'.
It seems the qmimodem is first checking the ME storage for
free space, then deliver the SMS via QMI and not saving it
to the ME anyway.
Using QMI_WMS_STORAGE_TYPE_NONE it doesn't check for free space.

Tested-on: Quectel EC20
2017-05-30 17:31:25 -05:00