Commit Graph
142 Commits
Author SHA1 Message Date
Lubomir Rintel ad74320c05 qcdm: fix order of calloc() arguments
GCC 14 is unhappy. Not sure why does this matter, maybe it just does
not. Let's silence the warning at the very least:

  libqcdm/src/result.c: In function ‘val_new_string’:
  libqcdm/src/result.c:76:25: warning: ‘calloc’ sizes specified with
    ‘sizeof’ in the earlier argument and not in the later argument
    [-Wcalloc-transposed-args]
     76 |     v = calloc (sizeof (Val), 1);
        |                         ^~~
2024-07-08 12:37:12 +02:00
Aleksander Morgado f419f56628 build: drop autotools 2022-11-07 14:26:02 +00:00
Pablo Barciela 7c713b53a4 libqcdm, errors: fix format specifier for integer 2022-02-15 10:33:55 +01:00
Pablo Barciela 513fbaff61 libqcdm, errors: Fix argument order 2022-02-15 09:42:08 +01:00
Pablo Barciela a5cee46ba9 libqcdm,commands: 'const' instead 'static' in 'char' variable 2022-02-14 12:44:51 +01:00
Iñigo Martínez 93a1d7a60d build,meson: Improve libqcdm build
`libqcdm`'s meson build files have been improved slightly by
removing unnecessary variables shortening their contents.
2021-09-10 08:39:37 +00:00
Iñigo Martínez 77d1c24361 build: Port to meson
meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.
2021-09-07 10:55:43 +00:00
Aleksander Morgado 689769467a libqcdm: plug leak in qcdm_cdm_log_config_new()
==748616== 37 bytes in 1 blocks are definitely lost in loss record 2,850 of 4,938
   ==748616==    at 0x48435FF: calloc (vg_replace_malloc.c:1117)
   ==748616==    by 0x249CCF: qcdm_cmd_log_config_new (commands.c:1742)
   ==748616==    by 0x24A321: qcdm_cmd_log_config_set_mask_new (commands.c:1901)
   ==748616==    by 0x1DAE12: modem_cdma_setup_cleanup_unsolicited_events (mm-broadband-modem.c:8643)
   ==748616==    by 0x1DAF21: modem_cdma_setup_unsolicited_events (mm-broadband-modem.c:8671)
   ==748616==    by 0x1AE49F: interface_enabling_step (mm-iface-modem-cdma.c:1627)
   ==748616==    by 0x1AE680: mm_iface_modem_cdma_enable (mm-iface-modem-cdma.c:1693)
   ==748616==    by 0x1E2DF6: enabling_step (mm-broadband-modem.c:11756)
   ==748616==    by 0x1E204E: iface_modem_3gpp_ussd_enable_ready (mm-broadband-modem.c:11606)
   ==748616==    by 0x4F03533: g_task_return_now (gtask.c:1219)
   ==748616==    by 0x4F07078: UnknownInlinedFun (gtask.c:1289)
   ==748616==    by 0x4F07078: g_task_return (gtask.c:1245)
   ==748616==    by 0x1AA323: interface_enabling_step (mm-iface-modem-3gpp-ussd.c:702)
2021-07-27 00:10:02 +02:00
Aleksander Morgado a1f2429790 libqcdm,reset: fix warnings with -Wdiscarded-qualifiers
reset.c: In function ‘main’:
  reset.c:238:17: warning: passing argument 1 of ‘putenv’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    238 |         putenv ("QCDM_DEBUG=1");
        |                 ^~~~~~~~~~~~~~
  In file included from reset.c:22:
  /usr/include/stdlib.h:647:26: note: expected ‘char *’ but argument is of type ‘const char *’
    647 | extern int putenv (char *__string) __THROW __nonnull ((1));
        |                    ~~~~~~^~~~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado 305d927ee0 libqcdm,reset: fix warnings with -Wsign-compare
reset.c: In function ‘print_buf’:
  reset.c:47:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
     47 |     for (i = 0; i < len; i++) {
        |                   ^
  reset.c: In function ‘qcdm_wait_reply’:
  reset.c:168:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    168 |     } while (total < sizeof (readbuf));
        |                    ^
2020-01-30 11:59:14 +01:00
Aleksander Morgado 47a380a2ae libqcdm,ipv6pref: fix warnings with -Wdiscarded-qualifiers
ipv6pref.c: In function ‘main’:
  ipv6pref.c:288:11: warning: passing argument 1 of ‘putenv’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    288 |   putenv ("QCDM_DEBUG=1");
        |           ^~~~~~~~~~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado 07fe3bed65 libqcdm,ipv6pref: fix warnings with -Wsign-compare
ipv6pref.c: In function ‘print_buf’:
  ipv6pref.c:46:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
     46 |  for (i = 0; i < len; i++) {
        |                ^
  ipv6pref.c: In function ‘qcdm_wait_reply’:
  ipv6pref.c:167:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    167 |  } while (total < sizeof (readbuf));
        |                 ^
2020-01-30 11:59:14 +01:00
Aleksander Morgado c135c66684 libqcdm,modepref: fix warnings with -Wdiscarded-qualifiers
modepref.c: In function ‘main’:
  modepref.c:539:11: warning: passing argument 1 of ‘putenv’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    539 |   putenv ("QCDM_DEBUG=1");
        |           ^~~~~~~~~~~~~~
  In file included from modepref.c:21:
  /usr/include/stdlib.h:647:26: note: expected ‘char *’ but argument is of type ‘const char *’
    647 | extern int putenv (char *__string) __THROW __nonnull ((1));
        |                    ~~~~~~^~~~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado 17a00ce1fc libqcdm,modepref: fix warnings with -Wsign-compare
modepref.c: In function ‘print_buf’:
  modepref.c:46:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
     46 |  for (i = 0; i < len; i++) {
        |                ^
  modepref.c: In function ‘qcdm_wait_reply’:
  modepref.c:167:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    167 |  } while (total < sizeof (readbuf));
        |                 ^
2020-01-30 11:59:14 +01:00
Aleksander Morgado 4fa669b894 test-qcdm-com: fix warnings with -Wdouble-promotion
test-qcdm-com.c: In function ‘test_com_pilot_sets’:
  test-qcdm-com.c:1085:59: warning: implicit conversion from ‘float’ to ‘double’ when passing argument to function [-Wdouble-promotion]
   1085 |         g_message ("      EC/IO     %d  (%.1f dB)", ecio, db);
        |                                                           ^~
  /usr/include/glib-2.0/glib/gmessages.h:333:32: note: in definition of macro ‘g_message’
    333 |                                __VA_ARGS__)
        |                                ^~~~~~~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado 45c0015c08 test-qcdm-com: fix warnings with -Wsign-compare
test-qcdm-com.c: In function ‘print_buf’:
  test-qcdm-com.c:273:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Wsign-compare]
    273 |     for (i = 0; i < len; i++) {
        |                   ^
  test-qcdm-com.c: In function ‘wait_reply’:
  test-qcdm-com.c:367:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    367 |     } while (total < sizeof (readbuf));
        |                    ^
2020-01-30 11:59:14 +01:00
Aleksander Morgado 06567283b1 libqcdm,logs: fix warnings with -Wdouble-promotion
logs.c: In function ‘qcdm_log_item_evdo_pilot_sets_v2_get_pilot’:
  logs.c:179:94: warning: implicit conversion from ‘float’ to ‘double’ to match other operand of binary expression [-Wdouble-promotion]
    179 |     *out_rssi_dbm = (int32_t) (-110.0 + ((float) MAX (le16toh (pilot->pilot_energy) - 50, 0) / 14.0));
        |
2020-01-30 11:59:14 +01:00
Aleksander Morgado 3c19b48f8c libqcdm,commands: fix warnings with -Wdouble-promotion
commands.c: In function ‘qcdm_cmd_pilot_sets_result_get_pilot’:
  commands.c:756:33: warning: implicit conversion from ‘float’ to ‘double’ to match other operand of binary expression [-Wdouble-promotion]
    756 |     *out_db = (float) set->ecio * -0.5;
        |                                 ^
2020-01-30 11:59:14 +01:00
Aleksander Morgado 9bc5d742dc libqcdm,commands: fix warnings with -Wswitch-default
commands.c: In function ‘nv_mode_pref_from_qcdm’:
  commands.c:109:5: warning: switch missing default case [-Wswitch-default]
    109 |     switch (qcdm) {
        |     ^~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado 1c078531a0 build: use AX_IS_RELEASE() and AX_COMPILER_FLAGS()
The autoconf macros AX_COMPILER_FLAGS_{CFLAGS|GIR|LDFLAGS} test
for compiler and linker support of various flags, and add the flags to
the generated output.

If the command-line option '--enable-compile-warnings' is specified to
'configure', a number of additional warning options is also added to the
output. This is the default.

This update requires the presence of the GNU autoconf-archive in the
system.
2020-01-30 11:59:14 +01:00
Ben Chan aa85aeae3d libqcdm: remove useless checks on always true condition
result.c: In function ‘qcdm_result_add_u8_array’:
result.c:338:36: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
     qcdm_return_if_fail (array_len >= 0);

result.c: In function ‘qcdm_result_add_u16_array’:
result.c:418:36: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
     qcdm_return_if_fail (array_len >= 0);
                                    ^
2018-10-27 10:09:51 +02:00
Ville Skyttä 90b89bb9f4 *: Spelling fixes 2018-01-25 09:52:12 +01:00
Dan Williams cec01fdaf6 libqcdm: fix WCDMA L1 Manager states
The enum was wrong.  There isn't actually an L1M_INIT state; the
enum should start with L1M_IDLE.  There should also be a
L1M_PCH_SLEEP state between DEACTIVATE and DEEP_SLEEP.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100000
2017-02-28 13:44:46 -06:00
Aleksander Morgado 905c8a48e9 libqcdm,libwmc: use C99 sized types from stdint.h 2016-11-23 19:27:09 +01:00
Dan Williams 5350b9f568 broadband-modem/libqcdm: add signal strength from QCDM EVDO Pilot Sets log messages
When a CDMA-only modem is registered with the EVDO network, its not possible to
read signal strength in the following cases:

1) while a data connection is active on single-AT-port modems, because the AT
port is used for PPP and not available for AT+CSQ, AT+CIND or vendor-specific
signal strength commands

2) when the modem reports only CDMA 1x signal strength with AT+CSQ

Now that we have a reasonable interpretation of RSSI from the QCDM
EVDO Pilot Sets V2 log messgae, use that when other means of getting
signal strength aren't available.
2016-07-27 10:44:43 -05:00
Lubomir Rintel 488992b010 qcdm: avoid upsetting the compiler with wrong aliasing
We shouldn't be accessiing u_int8_t * as u_int16_t *. Let's construct
the 16-bit value by or-ing the 8-bit halves directly; avoiding the
endianness conversion too.
2016-07-21 09:49:34 +02:00
Dan Williams 803caab80a libqcdm: add HDR Pilot Sets V2 log item structures
Apparently I was looking at this in 2012:
https://blogs.gnome.org/dcbw/2012/11/14/got-evdo-help-me-out/

So why not at least get the structures into libqcdm and figure
out a rough correlation between pilot energy and EC/IO.
2016-07-20 11:40:42 -05:00
Dan Williams 99ae677789 libqcdm: fix mixed whitespace in test-qcdm.c 2016-01-13 15:31:59 -06:00
Felix Janda 2a99bdfa00 Do not use obsolete XCASE terminal mode flag
The XCASE terminal mode flag because is no longer specified by POSIX
and has no effect on linux. Because of the latter fact we can remove
it. This fixes a compilation error with musl libc.
2015-11-27 15:11:40 +01:00
Jakub Sitnicki 7552030ef9 build: add code coverage support
Build all targets, except for CLI tools (mmcli, uml290), with special
flags needed for collecting code coverage information when the build has
been configured with --enable-code-coverage.

Three new targets are available in the top build directory:

 - `check-code-coverage' runs the test suite and generates a code
   coverage report,

 - `code-coverage-capture' generates a code coverage report from already
   collected data, which can come in handy when one wants to see code
   paths touched by a particular test,

 - `code-coverage-clean' removes the collected coverage data and the
   generated reports.
2015-01-11 19:32:43 +01:00
Aleksander Morgado f6b0fd3f7b libqcdm: new 'reset' tester
Just like 'modepref', but not doing any mode changes, just OFFLINE+RESET.
2014-07-03 16:21:31 +02:00
Aleksander Morgado a691eec6ca build: avoid using 'INCLUDES' in Makefile.am
Avoids warnings during build; e.g.:
    warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2014-06-22 18:24:21 +02:00
Ben Chan 54b75e3bcd qcdm: fix memory leaks in tests 2014-05-29 10:05:45 +02:00
Yunlian Jiang c48b97b118 libqcdm: use NULL instead of 0 for empty pointer
When I use clang 3.5 to build it, I got

commands.c:1444:16: error: expression which evaluates to zero treated as a
null
      pointer constant of type 'QcdmResult *' (aka 'struct QcdmResult *')
      [-Werror,-Wnon-literal-null-conversion]
        return FALSE;
               ^~~~~
./utils.h:29:15: note: expanded from macro 'FALSE'
#define FALSE ((u_int8_t) 0)
              ^~~~~~~~~~~~~~
commands.c:1464:20: error: expression which evaluates to zero treated as a
null
      pointer constant of type 'QcdmResult *' (aka 'struct QcdmResult *')
      [-Werror,-Wnon-literal-null-conversion]
            return FALSE;
                   ^~~~~
./utils.h:29:15: note: expanded from macro 'FALSE'
#define FALSE ((u_int8_t) 0)
              ^~~~~~~~~~~~~~
2 errors generated.
make[3]: *** [libqcdm_la-commands.lo] Error 1
make[3]: *** Waiting for unfinished jobs....

Below is the patch that fixes it
2014-02-06 03:18:15 -06:00
Bjørn Mork f721c650d2 qcdm: add utility to display and set the "IPv6 enabled" variable
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2013-12-05 13:16:48 -06:00
Bjørn Mork fa0fa1c647 qcdm: add IPv6 nvram setting to test suite
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2013-12-05 13:16:12 -06:00
Bjørn Mork 13552aa8b6 qcdm: add IPv6 nvram setting
Some Qualcomm firmwares disable IPv6 unless this flag is set in nvram, at
least for the LTE default bearer. The firmware will happily let you
configure the IPV6 and IPV4V6 PDP types, also including the default
profile, but any attempt to connect will fail.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2013-12-05 13:16:09 -06:00
Aleksander Morgado 2a922f836d build: remove unneeded GLIB_CHECK_VERSION checks, 2.32 already required 2013-06-18 16:55:29 +02:00
Aleksander Morgado 2ad39277d2 build: setup gtester based tests 2013-06-18 16:50:47 +02:00
Ben Chan 1f99eaf80e qcdm: remove unnecessary NULL check on free()
This patch removes a few unnecessary NULL checks on free(), which also fixes
the following clang warnings:

result.c:59:27: error: if statement has empty body [-Werror,-Wempty-body]
        if (v->u.u8_array);
                          ^
result.c:59:27: note: put the semicolon on a separate line to silence this warning
result.c:62:28: error: if statement has empty body [-Werror,-Wempty-body]
        if (v->u.u16_array);
                           ^
result.c:62:28: note: put the semicolon on a separate line to silence this warning

Bug reported on https://code.google.com/p/chromium/issues/detail?id=219280
Patched by Yunlian Jiang <yunlian@chromium.org>
2013-04-25 08:46:00 +02:00
Dan Williams 9fa5b9001a qcdm: fix CDMA1x Pilot Sets pilot handling
The helper functions got the return code of qcdm_result_* wrong
and thus failed all requests for pilot sets.
2013-04-17 17:21:28 -05:00
Dan Williams 372a49bbf6 qcdm: add unsolicited signal level indication from Samsung Z810 2013-04-05 10:33:16 -05:00
Dan Williams b67a3948b5 qcdm: fix IM*I buffer sizes for GSM and WCDMA state info requests
Found by Enrico Murador.
2013-04-02 12:10:54 -05:00
Dan Williams 671d34cf92 qcdm: add auto-LTE modes for GSM and CDMA
as in, CDMA+EVDO+LTE and GSM+UMTS+LTE which were missing before.
2013-03-13 10:31:06 -05:00
Dan Williams dd4be407b2 qcdm: modepref: reset device after setting mode preference
Otherwise it doesn't actually take until you unplug/replug.
2013-03-12 16:50:49 -05:00
Dan Williams e390d21075 qcdm: add modepref utility
Sets and gets the NV "mode pref" item for allowed access
technologies.
2013-03-12 13:01:31 -05:00
Dan Williams 5efb1ceb5e qcdm: fix up NV Mode Pref item handling
While the QCDM and DIAG_NV are the same, in reality they shouldn't
be and there should be a mapping between them.  That wasn't happening,
so fix that up and add a few missing modes to the NV item defines.
2013-03-12 13:01:31 -05:00
Dan Williams 67fcac2541 qcdm: fix handling of active pilot set
Typo caused candidate or remaining sets to be treated as the
active pilot set.
2013-02-08 09:15:55 -06:00
Dan Williams 74e94e624d qcdm: add Novatel ERI subsystem support
Returns various ERI information like Indicator ID/Index, Icon
ID/Index, Icon Mode, and banner.
2013-02-06 11:57:00 -06:00
Dan Williams bf07f02cff qcdm: rename Novatel subsystem defines 2013-02-06 11:57:00 -06:00