Commit Graph
228 Commits
Author SHA1 Message Date
Eric Caruso 1800983b6c mm-modem-helpers: add low_nybble_first argument to mm_bcd_to_string
All BCD-encoded strings used by MM currently have the low nybble
of each byte come before the high nybble, but some strings (such
as the EID string returned by QMI Get Slot Status) are meant to
be read in order with the high nybble before the low one. As such,
extend mm_bcd_to_string to decode both.
2020-10-16 11:22:37 -07:00
Aleksander Morgado 599f545c0d sms-part-3gpp: allow sending UTF-16 as if it were UCS-2
Despite 3GPP TS 23.038 specifies that Unicode SMS messages are
encoded in UCS-2, UTF-16 encoding is commonly used instead on many
modern platforms to allow encoding code points that fall outside the
Basic Multilingual Plane (BMP), such as Emoji.

Update the logic to always use UTF-16 instead of UCS-2 when creating
or parsing PDUs (even if we always report as sending or receiving
UCS-2). For all purposes, UCS-2 is considered a subset of UTF-16
(assuming that code points out of the [U+0000,U+D7FF] and
[U+E000,U+FFFF] ranges are not applicable in UCS-2).

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/250
2020-08-20 18:15:37 +02:00
Aleksander Morgado eb5443b197 charsets: add UTF-16BE as a possible modem charset
Just as an implementation detail to be taken as an extension of
UCS2BE, never really to be used as a real modem charset.
2020-08-20 18:13:18 +02:00
Aleksander Morgado a399c7e42a charsets: take_and_convert() methods should support GSM encoding
The iconv() operation would fail because we wouldn't give any proper
charset string to convert to/from. Use our custom GSM encoding support
instead.
2020-05-26 15:05:52 +02:00
Aleksander Morgado c994576953 charsets,test: extend UCS2->UTF-8 testing for the reverse operation 2020-05-26 15:05:52 +02:00
Aleksander Morgado 0926031119 Revert "charsets: don't warn in unlikely case of needing to convert to HEX from UTF-8"
This reverts commit 6a7dd87f30.

Reverting because the merge request was set to squash all together....
2020-05-26 15:04:20 +02:00
Giacinto Cifelli 6a7dd87f30 charsets: don't warn in unlikely case of needing to convert to HEX from UTF-8
This would really be an implementation detail, not a real use
case. Just don't warn in this case, as in the conversion in the
opposite direction.
2020-05-26 12:45:40 +00:00
Aleksander Morgado c7dee320c0 test-qcdm-serial-port: fix warnings with -Wsign-compare
test-qcdm-serial-port.c: In function 'wait_for_child':
  test-qcdm-serial-port.c:57:52: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
           if (d->child && (now.tv_sec - start.tv_sec > timeout)) {
                                                      ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado 426f69d64b tests,modem-helpers: regex number is index of an array, so starts at 0 2020-04-09 12:38:50 +00:00
Aleksander Morgado 8aec9e3889 test,modem-helpers: use MMModem3gppRegistrationState values in tests 2020-04-09 12:38:50 +00:00
Aleksander Morgado c78da3de7e broadband-modem: run +C5GREG state checks
The generic CREG parser is improved to also allow parsing +C5GREG
responses and URCs.
2020-04-09 12:38:50 +00:00
Aleksander Morgado 040eb3880c helpers: use generic number parsing methods in CREG parser
This fixes the s8500 wave unit test, which was incorrectly parsing the
Act field reported as 'B' as "GSM" (strtol(B)=0)

Also, given that the generic parsing methods are able to parse numbers
from quoted strings, this change allows us to remove the Thuraya
specific CREG matching that just took into consideration quoted
strings. The Thuraya unit tests are also fixed up to provide proper
testing of the logic.
2020-04-09 12:38:50 +00:00
Aleksander Morgado 40b36a25ca test,modem-helpers: remove obsolete comments in u-blox CREG tests
We already support "SMS only" registration state.
2020-04-09 12:38:50 +00:00
Aleksander Morgado e956bac47b log: common logging method definition for all testers and helpers 2020-04-08 17:53:42 +02:00
Aleksander Morgado a2b57474dc error-helpers: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado bca5c5e423 modem-helpers-qmi: port qmi capabilities parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 7004f97093 modem-helpers: make cpms test parser return error on failure 2020-04-08 16:35:09 +02:00
Aleksander Morgado 105cb31e8c modem-helpers: port ccwa service query parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado ecd766796a modem-helpers: port cesq response parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado ef1a570afe modem-helpers: port creg response parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 39dd4c166d modem-helpers: port clcc list parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 78cad902ef modem-helpers: remove unused supported capabilities filter 2020-04-08 16:35:09 +02:00
Aleksander Morgado 5b1b33a894 modem-helpers: port cmer test parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 740827bde1 modem-helpers: parse cgdcont test parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado f76489cd81 modem-helpers: port cid selection helper to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 2b23ef3fa6 modem-helpers: port cops test parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado fb61243b7d modem-helpers: port ifc test parser to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 0f708daf0b modem-helpers: port supported modes filtering to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado fd1464cff0 modem-helpers: port device identifier to use object logging and autoptr 2020-04-08 16:35:09 +02:00
Aleksander Morgado b682d7ec67 tests,test-sms-part-cdma: remove explicit logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 72efb1b28d sms-part-cdma: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 3186a498c1 sms-part-3gpp: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 9bcadea172 log: new object logging support
So that we can provide the specific object id in every log associated
to a given object.
2020-04-08 16:35:08 +02:00
Aleksander Morgado 7075e852ca test-error-helpers: fix warnings with -Wsign-compare
test-error-helpers.c: In function ‘test_error_helpers_connection_error’:
  test-error-helpers.c:36:39: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
     36 |       for (i = enum_class->minimum; i <= enum_class->maximum; i++) {        \
        |                                       ^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7125a86e04 test-qcdm-serial-port: fix warnings with -Wsign-compare
test-qcdm-serial-port.c: In function ‘print_buf’:
  test-qcdm-serial-port.c:79:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
     79 |     for (i = 0; i < len; i++) {
        |                   ^
  test-qcdm-serial-port.c: In function ‘server_wait_request’:
  test-qcdm-serial-port.c:163:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
    163 |     } while (total < sizeof (readbuf));
        |                    ^
2020-01-31 14:52:49 +01:00
Aleksander Morgado 9ad6e1f633 test-modem-helpers: fix warnings with -Wswitch-enum
test-modem-helpers.c: In function ‘test_cgev_indication’:
  test-modem-helpers.c:2165:9: error: enumeration value ‘MM_3GPP_CGEV_UNKNOWN’ not handled in switch [-Werror=switch-enum]
   2165 |         switch (type) {
        |         ^~~~~~
  cc1: all warnings being treated as errors
2020-01-31 14:52:49 +01:00
Aleksander Morgado a27c957dc5 test-modem-helpers: fix warnings with -Wsign-compare
test-modem-helpers.c: In function ‘test_creg_match’:
  test-modem-helpers.c:1127:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   1127 |     for (i = 0; i < array->len; i++) {
        |                   ^
2020-01-31 14:52:49 +01:00
Aleksander Morgado 6dcbda1c80 test-modem-helpers: fix warnings with -Wdiscarded-qualifiers
test-modem-helpers.c: In function ‘test_cmgl_response_generic’:
  test-modem-helpers.c:294:20: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    294 |             .pdu = "07914306073011F00405812261F700003130916191314095C27"
        |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ...
2020-01-31 14:52:49 +01:00
Aleksander Morgado a16ac01604 tests,at-serial-port: fix warnings with -Wdiscarded-qualifiers
test-at-serial-port.c:29:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     29 |     { "\r\n", "\r\n" },
        |       ^~~~~~
  test-at-serial-port.c:29:15: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     29 |     { "\r\n", "\r\n" },
        |               ^~~~~~
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
Aleksander Morgado 6c80577bec tests,charsets: full gsm7/pack/unpack/utf8 sequence in tests 2020-01-24 09:56:53 +01:00
Aleksander Morgado 1722915f5e broadband-modem: +COPS=? response may give strings in UCS2
If the charset selected via CSCS is UCS2, the modem may decide to
return all the strings in the +COPS=? response in UCS2:

    <debug> (ttyACM0): --> 'AT+COPS=?<CR>'
    <debug> (ttyACM0): <-- '<CR><LF>+COPS: (2,"004D006F007600690073007400610072","004D006F007600690073007400610072","00320031003400300037",7)
    <debug> Found network '00320031003400300037' ('004D006F007600690073007400610072','004D006F007600690073007400610072'); availability: current, access tech: lte
2020-01-06 20:17:08 +00:00
Aleksander Morgado d83c018f98 core,tests: new test to make sure all error codes are supported
Defining the new error codes in the headers is not enough, we also
need to add support in the error helpers in order to create proper
GErrors with the expected error codes.
2019-12-17 10:52:13 +01:00
Aleksander Morgado d6f9d5e9ec sim: load emergency numbers from EF_ECC 2019-10-17 10:51:50 +02:00
Aleksander Morgado d5d0ed0b24 tests: print MM logs only on verbose test mode
Therefore, avoid needing ENABLE_TEST_MESSAGE_TRACES build symbol.
2019-10-14 15:30:27 +02:00
Aleksander Morgado 03223fe786 tests,sms: print PDUs only on verbose test mode
Therefore, avoid needing TEST_SMS_PART_ENABLE_TRACE build symbol.
2019-10-14 15:30:03 +02:00
Aleksander Morgado 3b18d21ba5 tests: avoid g_print() and use g_debug() instead
The debug-level logs won't be printed e.g. during 'make check', but
will be included when running the tester manually.
2019-10-14 15:30:03 +02:00
amol.lad 16145c29de sms-part-3gpp: SMS timestamp in ISO8601 format 2019-09-22 09:15:51 +02:00
Aleksander Morgado 137ece0f2f broadband-bearer: setup cid selection as a testable method
Rework how the broadband bearer runs CGDCONT? and CGDCONT=? and setup
a helper method to perform the CID selection logic.

Also, implement unit tests for the CID selection logic.
2019-09-13 18:13:26 +00:00
Aleksander Morgado f39dbe72e5 broadband-modem,voice: implement call waiting status setup/query with +CCWA 2019-07-19 17:47:51 +02:00