Skip to content

Conversation

clobrano
Copy link
Contributor

@clobrano clobrano commented Oct 3, 2017

No description provided.

dcbw and others added 15 commits June 23, 2017 16:57
Reports bogus current TX/RX rates on my Huawei E397 though.
qmi-compat.h defines a few deprecated enumerators as an alias to their
equivalence using macros and annotates those macros with
G_DEPRECATED_FOR, which may be expanded to
`__attribute__((deprecated))'.

Neither gcc nor clang supports `__attribute__((deprecated))' on macros.
Thus, a G_DEPRECATED_FOR annotation before a macro definition is
actually associated with the next identifier found after the macro
definition, which is incorrect.

Alternatively, the G_DEPRECATED_FOR annotation can be used on the
deprecated enumerators. But only gcc 6 or above supports enumerator
attributes.

To address the issue, this patch defines the deprecated enumerators as
`static const int' values, which can then be annotated with
G_DEPRECATED_FOR.
Commit c96725e "libqmi-glib: fix G_DEPRECATED_FOR annotations"
replaced macro defintions with `static const int' definitions for those
deprecated enumerators. However, gtk-doc doesn't seem to document
`static const int' defintions. This patch works around the issue by
adding a macro defintion on top of a `static const int' defintion.
If e.g. qmi-proxy is started by ModemManager and we send a Ctrl+C to
it, the signal would be propagated to the qmi-proxy process and we
would kill it right away, while leaving ModemManager still around
wondering why the socket to the proxy got a HUP.

Avoid this, by making sure the qmi-proxy gets its own process group.
Usually the canonicalize_file_name() GNU extension is preferred to the
POSIX realpath(), as it covers some of the limitations the latter has.
But this extension isn't available in lots of platforms or in other
c library implementations (e.g. musl), so just default to the POSIX
method to improve portability.

Note that the check for canonicalize_file_name() availability during
configure isn't as trivial as adding a new AC_CHECK_FUNCS(), and
importing a gnulib module seems overkill just for this one liner.

https://bugs.freedesktop.org/show_bug.cgi?id=99944
Remove the need to run `gtkdocize' when building from git; this should
be an operation done by the maintainer when modernizing the gtk-doc
setup (think of e.g. gettextize), no need to do it unconditionally.

This makes it easier for platforms without gtk-doc to build from git.

When trying to build with documentation enabled and gtk-doc isn't
found, we get some nice warnings and errors in the configure report:

    checking for gtk-doc... no
    configure: WARNING:
      You will not be able to create source packages with 'make dist'
      because gtk-doc >= 1.0 is not found.
    checking for gtkdoc-check... no
    checking for gtkdoc-check... no
    checking for gtkdoc-rebase... no
    checking for gtkdoc-mkpdf... no
    checking whether to build gtk-doc documentation... yes
    configure: error:
      You must have gtk-doc >= 1.0 installed to build documentation for
      ModemManager. Please install gtk-doc or disable building the
      documentation by adding '--disable-gtk-doc' to './configure'.

Files generated with gtkdocize (gtk-doc) 1.26.1.
Even when cloning a git checkout, as we have m4/compiler-warnings
under version control.
Using an intermediate constant variable breaks compilation with C
compilers, as these variables cannot be used as initializers.

Instead, define a deprecated type and cast all deprecated symbols to
that type. We lose the information about what the new replacement
symbol is, but we don't break compilation.

Also, add QMI_DISABLE_DEPRECATED guards around deprecated symbols. So
that when this symbol is defined, e.g. via CFLAGS, building a program
that uses the libmbim API will fail if the program references
deprecated symbols. For now we just use it to keep gtk-doc-scan happy
and avoid unnecessary warnings.

Equivalent to ModemManager commits eedd4ab4457 and f0bb6ef856.
Section titles are used to generate unique ids in the documentation,
so avoid generating the same title if both a request/response and an
indication have the same message name.

    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Activate-Config.
    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Activate-Config.
    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Deactivate-Config.
    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Deactivate-Config.
    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Get-Config-Info.
    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Get-Config-Info.
    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Get-Selected-Config.
    Warning: multiple "IDs" for constraint linkend: libqmi-glib-PDC-Get-Selected-Config.
    ....
Don't generate title names with a '/' or we'll end up creating
directories, which the default gtk-doc rules don't expect.

    make[4]: Entering directory '~/libqmi/qmi-1-18/build/docs/reference/libqmi-glib'
    make  \
      top_distdir="../../../libqmi-1.18.1" distdir="../../../libqmi-1.18.1/docs/reference/libqmi-glib" \
      dist-hook
    make[5]: Entering directory '~/libqmi/qmi-1-18/build/docs/reference/libqmi-glib'
    cp: omitting directory ‘./html/libqmi-glib-DMS-Activate-Automatic-request’
    cp: omitting directory ‘./html/libqmi-glib-DMS-Activate-Manual-request’
    cp: omitting directory ‘./html/libqmi-glib-DMS-Delete-Stored-Image-request’
    cp: omitting directory ‘./html/libqmi-glib-DMS-Get-Activation-State-request’
    cp: omitting directory ‘./html/libqmi-glib-DMS-Get-Alt-Net-Config-request’
    cp: omitting directory ‘./html/libqmi-glib-DMS-Get-Band-Capabilities-request’
    ...

Fixes 90a3a40.
@aleksander0m
Copy link
Collaborator

This has been merged to git master already

cbchan pushed a commit to cbchan/libqmi that referenced this pull request Aug 1, 2019
    #0  0x00007ffff7c0f577 in qmi_endpoint_close (self=0x0, timeout=0, cancellable=0x0, callback=0x7ffff7c0a670 <endpoint_close_ready>, user_data=0x55555570acc0) at qmi-endpoint.c:236
    linux-mobile-broadband#1  0x00007ffff7c0a78b in qmi_device_close_async (self=0x55555578a0f0, timeout=0, cancellable=0x0, callback=0x0, user_data=0x0) at qmi-device.c:2076
    linux-mobile-broadband#2  0x00007ffff7c01da2 in qmi_device_close (self=0x55555578a0f0, error=0x0) at qmi-compat.c:737
    #3  0x000055555565faf3 in port_open_step (task=0x55555574d340) at mm-port-qmi.c:528
    #4  0x000055555565f181 in qmi_device_open_second_ready (qmi_device=0x55555578a0f0, res=0x7fffe8011ec0, task=0x55555574d340) at mm-port-qmi.c:251
    #5  0x00007ffff77670dc in  () at /usr/lib/libgio-2.0.so.0
    #6  0x00007ffff7767ab5 in  () at /usr/lib/libgio-2.0.so.0
    #7  0x00007ffff7c099be in endpoint_ready (endpoint=0x55555578a1e0, res=0x55555570a9c0, task=0x7fffe8011ec0) at qmi-device.c:1731
    #8  0x00007ffff77670dc in  () at /usr/lib/libgio-2.0.so.0
    #9  0x00007ffff7767ab5 in  () at /usr/lib/libgio-2.0.so.0
    #10 0x00007ffff7c0fdec in internal_proxy_open_ready (client_ctl=0x5555556fa6f0, res=0x55555574d100, task=0x55555570a9c0) at qmi-endpoint-qmux.c:131
    #11 0x00007ffff77670dc in  () at /usr/lib/libgio-2.0.so.0
    #12 0x00007ffff7767ab5 in  () at /usr/lib/libgio-2.0.so.0
    #13 0x00007ffff7c2971c in internal_proxy_open_ready (device=0x55555578a0f0, res=0x55555578cd00, task=0x55555574d100) at qmi-ctl.c:4166
    #14 0x00007ffff7780439 in g_simple_async_result_complete () at /usr/lib/libgio-2.0.so.0
    #15 0x00007ffff77804cf in  () at /usr/lib/libgio-2.0.so.0
    #16 0x00007ffff75867b1 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
    #17 0x00007ffff7588869 in  () at /usr/lib/libglib-2.0.so.0
    #18 0x00007ffff75897f2 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
    #19 0x0000555555599eb0 in main (argc=2, argv=0x7fffffffeab8) at main.c:181
aleksander0m added a commit that referenced this pull request Dec 3, 2019
If we attempt to run qmi-firmware-update on the MC7455, we first need
to detect that the device is NOT a sahara device, and in order to do
that we'll just try to create a QfuSaharaDevice.

During this process, we will try to read from the ttyUSB0 the 'hello'
message that the device sends to us, but it may happen that the device
does not send anything at all and we would end up reading 0 bytes. If
this happens, we should treat it as an indication that this is not a
sahara device right away. If we don't do this, the protocol runner
sahara_device_run_protocol_step() method will return STEP_UNKNOWN
without any error set, which ends up making sahara_device_initialize()
return FALSE without error, and that will make initable_init() wrongly
succeed.

  [14 Aug 2019, 20:28:08] [Debug] [qfu-sahara-device] opening TTY: /dev/ttyUSB0
  [14 Aug 2019, 20:28:08] [Debug] [qfu-sahara-device] setting terminal in raw mode...
  [14 Aug 2019, 20:28:08] [Debug] [qfu-sahara-device] waiting time for device to boot properly...
  [14 Aug 2019, 20:28:10] [Debug] [qfu-sahara-device] initializing sahara protocol...
  [14 Aug 2019, 20:28:13] [Debug] [qfu-updater] selected file 'SWI9X30C_02.26.01.00.cwe' (64480431 bytes)
  downloading cwe image: SWI9X30C_02.26.01.00.cwe (64.5 MB)...
  Floating point exception (core dumped)

  #0  0x0000000000410a8b in qfu_sahara_device_firehose_setup_download (self=0x2110680, image=0x2124dc0, n_blocks=0x7ffc3baf5838,cancellable=0x211c240, error=0x7ffc3baf5860) at qfu-sahara-device.c:573
  #1  0x0000000000407b89 in download_image_firehose (device=0x2110680,#image=0x2124dc0, cancellable=0x211c240, error=0x7ffc3baf5860) at qfu-updater.c:691
  #2  0x00000000004080d9 in run_context_step_download_image (task=0x2125840) at qfu-updater.c:808
  #3  0x0000000000408595 in run_context_step (task=0x2125840) at qfu-updater.c:1490
  #4  0x00000000004077c9 in run_context_step_cb (task=0x2125840) at qfu-updater.c:366
  #5  0x00007fd1e0f0becc in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
  #6  0x00007fd1e0f0c238 in g_main_context_iterate.isra () from /usr/lib/libglib-2.0.so.0
  #7  0x00007fd1e0f0c492 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
  #8  0x00000000004067c8 in operation_update_run (updater=0x211c210, images=0x211b1f0) at qfu-operation-update.c:108
  #9  0x0000000000406862 in qfu_operation_update_download_run (images=0x211b1f0,#device_selection=0x211b820) at qfu-operation-update.c:163
  #10 0x0000000000405f3f in main (argc=1, argv=0x7ffc3baf5bf8) at qfu-main.c:726
aleksander0m added a commit that referenced this pull request Jul 25, 2020
  #0  qmi_endpoint_is_open (self=0x0) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-endpoint.c:180
  #1  0x00007ffff7caf275 in qmi_device_command_abortable (self=self@entry=0x7fffe8006f00, message=message@entry=0x5555557e7330, message_context=message_context@entry=0x0, timeout=timeout@entry=30,
      abort_build_request_fn=abort_build_request_fn@entry=0x0, abort_parse_response_fn=abort_parse_response_fn@entry=0x0, abort_user_data=0x0, abort_user_data_free=0x0, cancellable=0x5555557e8a50,
      callback=0x7ffff7caf620 <transaction_abort_ready>, user_data=0x1120016) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:2301
  #2  0x00007ffff7caf87b in qmi_device_command_full (self=self@entry=0x7fffe8006f00, message=message@entry=0x5555557e7330, message_context=message_context@entry=0x0, timeout=timeout@entry=30,
      cancellable=<optimized out>, callback=callback@entry=0x7ffff7caf620 <transaction_abort_ready>, user_data=0x1120016) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:2375
  #3  0x00007ffff7caf966 in transaction_abort (self=0x7fffe8006f00, tr=tr@entry=0x7fffe0009800, abort_error_take=0x5555557fc3b0) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:361
  #4  0x00007ffff7cafaf5 in transaction_timed_out (ctx=0x5555557b8690, ctx@entry=<error reading variable: value has been optimized out>) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:385
  #5  0x00007ffff7809f94 in g_timeout_dispatch (source=0x5555558116b0, callback=<optimized out>, user_data=<optimized out>) at ../glib-2.60.7/glib/gmain.c:4678
  #6  0x00007ffff78094ef in g_main_dispatch (context=0x55555570c670) at ../glib-2.60.7/glib/gmain.c:3189
  #7  g_main_context_dispatch (context=context@entry=0x55555570c670) at ../glib-2.60.7/glib/gmain.c:3854
  #8  0x00007ffff78098c0 in g_main_context_iterate (context=0x55555570c670, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib-2.60.7/glib/gmain.c:3927
  #9  0x00007ffff7809bd3 in g_main_loop_run (loop=0x5555557233e0) at ../glib-2.60.7/glib/gmain.c:4123
  #10 0x000055555559bbc0 in main (argc=<optimized out>, argv=<optimized out>) at ../../ModemManager-1.12.8/src/main.c:206

Fixes https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/issues/37
aleksander0m added a commit that referenced this pull request Jul 25, 2020
  #0  qmi_endpoint_is_open (self=0x0) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-endpoint.c:180
  #1  0x00007ffff7caf275 in qmi_device_command_abortable (self=self@entry=0x7fffe8006f00, message=message@entry=0x5555557e7330, message_context=message_context@entry=0x0, timeout=timeout@entry=30,
      abort_build_request_fn=abort_build_request_fn@entry=0x0, abort_parse_response_fn=abort_parse_response_fn@entry=0x0, abort_user_data=0x0, abort_user_data_free=0x0, cancellable=0x5555557e8a50,
      callback=0x7ffff7caf620 <transaction_abort_ready>, user_data=0x1120016) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:2301
  #2  0x00007ffff7caf87b in qmi_device_command_full (self=self@entry=0x7fffe8006f00, message=message@entry=0x5555557e7330, message_context=message_context@entry=0x0, timeout=timeout@entry=30,
      cancellable=<optimized out>, callback=callback@entry=0x7ffff7caf620 <transaction_abort_ready>, user_data=0x1120016) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:2375
  #3  0x00007ffff7caf966 in transaction_abort (self=0x7fffe8006f00, tr=tr@entry=0x7fffe0009800, abort_error_take=0x5555557fc3b0) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:361
  #4  0x00007ffff7cafaf5 in transaction_timed_out (ctx=0x5555557b8690, ctx@entry=<error reading variable: value has been optimized out>) at ../../../libqmi-1.24.8/src/libqmi-glib/qmi-device.c:385
  #5  0x00007ffff7809f94 in g_timeout_dispatch (source=0x5555558116b0, callback=<optimized out>, user_data=<optimized out>) at ../glib-2.60.7/glib/gmain.c:4678
  #6  0x00007ffff78094ef in g_main_dispatch (context=0x55555570c670) at ../glib-2.60.7/glib/gmain.c:3189
  #7  g_main_context_dispatch (context=context@entry=0x55555570c670) at ../glib-2.60.7/glib/gmain.c:3854
  #8  0x00007ffff78098c0 in g_main_context_iterate (context=0x55555570c670, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib-2.60.7/glib/gmain.c:3927
  #9  0x00007ffff7809bd3 in g_main_loop_run (loop=0x5555557233e0) at ../glib-2.60.7/glib/gmain.c:4123
  #10 0x000055555559bbc0 in main (argc=<optimized out>, argv=<optimized out>) at ../../ModemManager-1.12.8/src/main.c:206

Fixes https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/issues/37

(cherry picked from commit ee61c03)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants