Commit Graph

99 Commits

Author SHA1 Message Date
Aleksander Morgado
9f4c738d1f test,mmsmspdu: add support for MSG log level 2023-09-27 11:21:26 +00:00
Lubomir Rintel
c40876de95 port-serial-at: make mm_port_serial_at_command_finish() transfer ownership
This will make it slightly easier to port mm_port_serial_at_command() to
use GTask, since we won't have to keep a pointer to the result in GTask
after _finish() has been called.

In most cases the caller needs the value anyway, so this doesn't add too
much hasle.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
1da5b81fef test: fix _mm_log() prototypes
GCC 13 is unhappy to cast a MMLogLevel to a guint32:

  [188/539] Compiling C object src/plugins/test-shared-icera.p/icera_tests_test-modem-helpers-icera.c.o
  In file included from ../src/plugins/icera/tests/test-modem-helpers-icera.c:27:
  ../src/mm-log-test.h:25:1: warning: conflicting types for ‘_mm_log’ due to enum/integer mismatch; have ‘void(void *, const gchar *, const gchar *, const gchar *, guint32,  const gchar *, ...)’ {aka ‘void(void *, const char *, const char *, const char *, unsigned int,  const char *, ...)’} [-Wenum-int-mismatch]
     25 | _mm_log (gpointer     obj,
        | ^~~~~~~
  In file included from ../src/mm-log-test.h:20:
  ../src/mm-log.h:61:6: note: previous declaration of ‘_mm_log’ with type ‘void(void *, const gchar *, const gchar *, const gchar *, MMLogLevel,  const gchar *, ...)’ {aka ‘void(void *, const char *, const char *, const char *, MMLogLevel,  const char *, ...)’}
     61 | void _mm_log (gpointer     obj,
        |      ^~~~~~~

That's perfectly fine, just use the enum type directly.
2023-04-10 09:21:46 +00:00
Lubomir Rintel
df4aea5ada mmtty: handle MM_LOG_LEVEL_MSG in _mm_log()
GCC 13 is unhappy about mixing enums and ints. However, if we fix the
type un mmtty's _mm_log() prototype, the compiler will find something
else to be irritiated about:

  [1/2] Compiling C object test/mmtty.p/mmtty.c.o
  ../test/mmtty.c: In function ‘_mm_log’:
  ../test/mmtty.c:283:5: warning: enumeration value ‘MM_LOG_LEVEL_MSG’ not handled in switch [-Wswitch-enum]
    283 |     switch (level) {
        |     ^~~~~~
  [2/2] Linking target test/mmtty

Fix that first.
2023-04-10 09:21:46 +00:00
Aleksander Morgado
7ec71020e7 test,mmsmspdu: fix verbose logging support 2023-03-30 20:14:44 +00:00
Aleksander Morgado
f419f56628 build: drop autotools 2022-11-07 14:26:02 +00:00
Bruce A. Johnson
91ed72aa29 core: switch bash shell scripts to use /bin/sh for use w/Busybox.
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/483
2022-01-05 10:26:16 +01:00
Iñigo Martínez
ec2e5403f1 build,meson: Make feature options boolean
Different options are set as `feature`, also every possible plugin,
but this may cause confusion.

All options set as `feature` but plugins have been made `boolean` to
avoid further confusions.

`help2man` is also installed in the CI image because is required to
build different libraries.
2021-11-08 09:28:55 +00:00
Aleksander Morgado
9f679d4cac core: replace 'dummy' with 'placeholder' 2021-11-04 22:44:20 +01:00
Yegor Yefremov
4875817f19 Tests: fix -Wformat compiler warning
Use G_GUINT64_FORMAT to properly format a guint64 type.
2021-09-17 12:10:31 +02:00
Aleksander Morgado
145bbb4010 test,lsudev: add attribute format to println()
../test/lsudev.c: In function ‘println’:
  ../test/lsudev.c:68:5: warning: function ‘println’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
     68 |     g_string_append_vprintf (output, fmt, args);
        |     ^~~~~~~~~~~~~~~~~~~~~~~
2021-09-07 10:55:43 +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
9b72ff0adf mmtty: new --spew-control option
So that we simulate enabling the spew control, as we do during
probing.
2021-03-31 13:55:52 +02:00
Aleksander Morgado
65e860439a mmtty: allow enabling LF with --send-lf 2021-03-31 13:55:52 +02:00
Aleksander Morgado
9d6ff2485a mmtty: fix printing logs with --verbose
The _mm_log() implementation provided in 'mm-log-test.h' relies on
g_test_verbose() to decide whether the logs are printed or not. We are
not running under the GTest setup in mmtty, so that would not work
properly.

Just provide a custom _mm_log() method that checks for the
verbose_flag instead.
2021-03-31 13:55:52 +02:00
Aleksander Morgado
3ca80d8e51 mmtty: make sure \r\n is removed from the user line 2021-03-31 13:55:47 +02:00
Aleksander Morgado
e956bac47b log: common logging method definition for all testers and helpers 2020-04-08 17:53:42 +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
f77deb75a5 test,mmsmspdu: fix warnings with -Wswitch-enum
mmsmspdu.c: In function ‘show_part_info’:
  mmsmspdu.c:86:5: error: enumeration value ‘MM_SMS_ENCODING_UNKNOWN’ not handled in switch [-Werror=switch-enum]
     86 |     switch (encoding) {
        |     ^~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
dce5dbeb9a test,mmrules: fix warnings with -Wswitch-default
mmrules.c: In function ‘print_rule’:
  mmrules.c:97:13: error: switch missing default case [-Werror=switch-default]
     97 |             switch (rule_match->type) {
        |             ^~~~~~
  mmrules.c:113:5: error: switch missing default case [-Werror=switch-default]
    113 |     switch (rule->result.type) {
        |     ^~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
6f433074e2 test,lsudev: fix warnings with -Wsign-compare
lsudev.c: In function ‘println’:
  lsudev.c:64:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
     64 |     for (i = 0; i < indent; i++)
        |                   ^
2020-01-31 15:18:35 +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
f9e26fb54b Revert "build: fix order of linked libs in test apps"
This reverts commit 3eb623e73b.

This change is plain wrong. The correct order was already fixed in
commit 42dab8e8.
2019-12-12 14:53:44 +01:00
Aleksander Morgado
3eb623e73b build: fix order of linked libs in test apps
Solving build issues with truly strict linkers, as in:
http://lists.busybox.net/pipermail/buildroot/2019-December/268817.html
2019-12-11 16:11:44 +01:00
Aleksander Morgado
42dab8e827 build,test: fix order of included libraries
Symbols are resolved forward, so if libhelpers depends on libmm-glib,
it needs to be specified first.
2019-11-15 08:55:28 +00:00
Ben Chan
bf54159e93 test: untabify 2019-07-31 22:27:45 -07:00
Aleksander Morgado
756480de6a test: new 'mmsmsmonitor' tool to monitor SMS messages
The tool monitors SMS message additions and SMS state updates, e.g.:

  $ sudo ./test/mmsmsmonitor
  [/org/freedesktop/ModemManager1/SMS/0] sms found: received
  [/org/freedesktop/ModemManager1/SMS/1] sms found: received
  [/org/freedesktop/ModemManager1/SMS/2] sms found: received
  [/org/freedesktop/ModemManager1/SMS/3] sms found: received
  [/org/freedesktop/ModemManager1/SMS/4] sms found: received
  [/org/freedesktop/ModemManager1/SMS/5] sms found: received
  [/org/freedesktop/ModemManager1/SMS/6] sms found: received
  [/org/freedesktop/ModemManager1/SMS/7] new sms: receiving
  [/org/freedesktop/ModemManager1/SMS/7] sms updated: received
2019-07-17 10:19:39 +02:00
Aleksander Morgado
4a4779729a test: new 'mmsmspdu' tool to parse PDUs given in hex 2019-07-15 13:49:49 +02:00
Ben Chan
31655bb5a5 glib: remove invocations of g_type_init()
g_type_init() has been deprecated (and also marked with the attribute
'deprecated') since glib 2.36 as the type system is automatically
initialized. Since the minimum version of glib required by ModemManager
is 2.36, calling g_type_init() isn't necessarily in the ModemManager
code.
2017-02-03 10:05:14 +01:00
Aleksander Morgado
58c955f5f2 core: allow building and running without udev
Instead of relying on the udev daemon and GUDev to manage the devices reported
by the kernel, we can now run ModemManager relying solely on the kernel events
reported via the new ReportKernelEvent() API. Therefore, the '--no-auto-scan'
option is implicit for the ModemManager daemon when udev is disabled in the
build.

Additionally, a new custom implementation of the kernel device object is
provided, which uses sysfs to load the properties and attributes required in
each kernel device, instead of using a GUdevDevice.

The udev rule files are kept in place, and a simple custom parser is provided
which preloads all rules in memory once and then applies them to the different
kernel objects reported via ReportKernelEvent(), e.g. to set port type hints.
A simple unit test setup is prepared to validate the udev rules during the
`check' Makefile target.
2016-09-29 15:43:05 +02:00
Aleksander Morgado
ae9ede926a core: use the kernel device object in the port object and the plugin interface
The mm_base_modem_grab_port() now receives a MMKernelDevice directly from the
plugin, which is then stored in the MMPort corresponding to the port.

This means that we have direct access to e.g. all properties set by udev rules
everywhere, and we don't need additional GUdevClient objects (e.g. like the one
used in the Huawei plugin to detect NDISDUP support during runtime).

For virtual ports (e.g. generated during unit tests), we have a new 'generic'
kernel device object which just provides the values from the kernel device
properties given during its creation.
2016-09-29 15:43:05 +02:00
Aleksander Morgado
3b8361eb06 build,core: update build rules
We try to combine in common envvars the compiler and linker flags shared by the
different components, and where possible, also re-using the implicit AM_CFLAGS
and AM_LDFLAGS variables that automake provides, and which apply to all objects
being built in the same Makefile.am.

The internal libmodem-helpers.la library is also renamed to libhelpers.la
2016-03-15 19:15:25 +01:00
Aleksander Morgado
ffde429843 core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncs 2015-12-02 17:07:39 +01:00
Aleksander Morgado
f4ec32e633 test: new 'mmtty' utility
The new tester allows to play with the AT-capable TTY using the same code as
ModemManager itself.

    $ sudo ./test/mmtty -d /dev/ttyHS0 --verbose
    opening serial port '/dev/ttyHS0'...
    (ttyHS0) opening serial port...
    (ttyHS0): port attributes not fully set
    (ttyHS0) device open count is 1 (open)
    flashing serial port '/dev/ttyHS0'...
    ready
    > AT+GCAP
    (ttyHS0): --> 'AT+GCAP<LF><CR>'
    (ttyHS0): <-- '<CR><LF>+GCAP: +CGSM,+DS,+ES<CR><LF><CR><LF>OK<CR><LF>'
    +GCAP: +CGSM,+DS,+ES
    > AT+GMI
    (ttyHS0): --> 'AT+GMI<LF><CR>'
    (ttyHS0): <-- '<CR><LF>Option N.V.<CR><LF><CR><LF>OK<CR><LF>'
    Option N.V.
    > ^C

    cancelling the main loop...

    (ttyHS0) device open count is 0 (close)
    (ttyHS0) closing serial port...
    (ttyHS0) serial port closed
    (ttyHS0) forced to close port
2015-02-11 19:58:12 +01:00
Aleksander Morgado
f3f499fcec test: remove testers of the old interface
Old python tests using the old ModemManager interface are removed, as mmcli
provides already a much nicer way to test the DBus interface.

Also, mm-test.py and the PPPD plugin get removed, which were also using the old
interface, and which were not very useful for testing newer non-PPP based
modems.

https://bugzilla.gnome.org/show_bug.cgi?id=702061
2013-06-18 16:30:26 +02:00
Aleksander Morgado
2da9474d0c test: new tester for the messaging capabilities of a modem, using `mmcli'
Usage:
  mmcli-test-sms [MODEM INDEX] [all|ucs2|gsm7|data] [NUMBER]"

If [NUMBER] is not given, a dummy number will be used and NO SMS will be sent.

If you give a proper [NUMBER], we will try to send the SMS.
2012-09-14 07:05:26 +02:00
Dan Williams
31d98a43c8 test: add utility to force a modem disconnect 2012-08-31 09:24:01 +02:00
Dan Williams
99b877ee68 test: ignore ESN errors in info.py 2012-05-30 12:11:25 -05:00
Aleksander Morgado
c52762ea67 build: require gudev >= 147
Since udev 147 the gudev API is no longer marked as experimental, and therefore
`G_UDEV_API_IS_SUBJECT_TO_CHANGE' is no longer needed.
2012-03-16 14:53:25 +01:00
Dan Williams
76c9b29415 test: (sms-get.py) don't fail if we don't get an SMSC 2012-02-02 21:12:17 -06:00
Dan Williams
70978d58a0 test: pretty-print SMS messages in sms-get.py 2012-02-01 10:45:28 -06:00
Dan Williams
346060efe8 test: add SMS get example/test 2012-01-26 12:35:30 -06:00
Dan Williams
b9037d1150 test: add missing examples to Makefile.am 2012-01-26 09:08:18 -06:00
Dan Williams
13d2eee6f1 test: rename SMS send example 2012-01-26 09:07:48 -06:00
Dan Williams
fc3fd7b983 test: print sent SMS message index on success 2012-01-18 18:07:45 -06:00
Dan Williams
e2306a0dd5 gsm: change SMS send validity from 5-minute units to minutes
Might as well keep it simple.
2012-01-18 16:30:15 -06:00
Dan Williams
c437da20ff test: enhance SMS send util to accept validity and SMSC address 2012-01-18 15:43:22 -06:00
Dan Williams
1655b3d323 test: print out error if sending SMS fails 2012-01-18 13:24:35 -06:00
Dan Williams
6789a87a58 tests: better handling of encodings in SMS test tool
Python usually uses Unicode, but often the shell encoding
will be in UTF-8, so Python needs some help converting the
message to Unicode.  Use LANG to do that if we can.
2012-01-18 13:00:50 -06:00