Skip to content
Snippets Groups Projects

Draft: intel: support for RPC-powered xmm7360 (legacy)

Closed Thomas Vogt requested to merge tuxor1337/ModemManager:port-xmm7360 into main

Note that work on this continues in the new clean MR !1235

This MR adds support for Intel XMM7360 (e.g. Fibocom L850) modems to the intel plugin.

This includes modem initialization, enabling (including PIN unlock), registration, connecting, and disconnecting. Some SIM managing features (like disabling/enabling PIN or changing the PIN) work, as well. The following parts (possibly among others) do not work:

  • The modem might freeze in certain situations, e.g. after waking up from suspend. ModemManager will not be able to reset it to a usable state. Only rebooting will solve this for the average user (cold-resetting/power-cycling the PCI interface would be an alternative). Often, even rebooting and/or power cycling doesn't help, but a cold boot of the computer is required to revive the device. This is not caused by this implementation, but must be related to the kernel-side. I don't know whether it would make sense to implement power-cycling of the device in ModemManager. This involves removing the PCI device, and triggering a rescan on the PCI port.
  • No IPv6 connection to the internet, only IPv4.
  • One user reported that the device yields slower download speeds when used with this driver under Ubuntu, compared to using it under a parallel installation of Windows with the OEM driver.

Isn't the XMM7360 already supported via MBIM?

XMM7360 devices that are connected via a PCI interface will only expose an RPC and no MBIM port. Hence, support for XMM7360 in ModemManager is currently limited to setups where the device is connected via an USB interface. Forcing the device to use the USB instead of the PCI interface is not an option for many users (e.g. ThinkPad T495 laptops).

Why are some features missing, and can they be added in the context of this MR?

The reason is that the RPC interface is not officially documented anywhere, but our knowledge about it is solely based on reverse engineering efforts by James Wah (https://github.com/xmm7360/reversing). Therefore, this will probably never be as stable as the MBIM interface. In principle, it would be possible to get more information about the interface by reverse engineering the Windows drivers. However, I will not work on this in the context of this MR.

Who contributed to this implementation?

Some open questions from my side

  • During probing, both AT ports are probed even though one of them will never respond. Is there a way to speed up this process somehow, e.g. by cancelling the probing if at least one responsive AT port has been found? I mean, only for the XMM7360 - not in general.

Some remarks about coding style and structure

I tried to follow the style and structure of code in similar pre-existing parts of the ModemManager code as closely as possible. For example, I created the file src/plugins/intel/mm-broadband-modem-xmm7360-rpc.c by copying and adapting the code in src/mm-base-modem-at.c. Also, the structure of the file src/plugins/intel/mm-port-serial-xmmrpc-xmm7360.c has notable similarities with src/mm-port-serial-at.c.

How to compile and test this

See my note below with instructions on how to compile and test the version of ModemManager from this MR on Ubuntu or Fedora.

Edited by Thomas Vogt

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Thomas Vogt mentioned in issue #612

    mentioned in issue #612

  • Thomas Vogt changed the description

    changed the description

  • Thomas Vogt changed the description

    changed the description

  • Thomas Vogt added 1 commit

    added 1 commit

    • 581f6cae - intel: implement support for RPC-powered xmm7360

    Compare with previous version

  • Thomas Vogt added 89 commits

    added 89 commits

    • 581f6cae...79b0696a - 86 commits from branch mobile-broadband:main
    • 562042b7 - port-probe: detect XMMRPC ports
    • 9aac3c45 - intel: mark XMM7360 as unsupported
    • 816278aa - intel: implement support for RPC-powered xmm7360

    Compare with previous version

  • Thomas Vogt added 1 commit

    added 1 commit

    • 06975355 - intel: implement support for RPC-powered xmm7360

    Compare with previous version

  • Thomas Vogt added 1 commit

    added 1 commit

    • b3fd613f - intel: implement support for RPC-powered xmm7360

    Compare with previous version

  • Thomas Vogt added 1 commit

    added 1 commit

    • 5dc209e1 - intel: implement support for RPC-powered xmm7360

    Compare with previous version

    • Resolved by Thomas Vogt

      Hmm... Something fails on my system. Don't understand why:

      This is git lg

      • 5dc209e1 - (34 hours ago) intel: implement support for RPC-powered xmm7360 - Thomas Vogt (HEAD -> ModemManager-port-xmm7360)
      • 9aac3c45 - (10 days ago) intel: mark XMM7360 as unsupported - Thomas Vogt
      • 562042b7 - (10 days ago) port-probe: detect XMMRPC ports - Thomas Vogt
      • 79b0696a - (9 days ago) Revert "fibocom: disable CPOL features in NL668" - Aleksander Morgado (origin/main, origin/HEAD, main)

      Seems proper, does it not?

      This is the build FAILURE:

      [192/205] Compiling C object src/plugins/libmm-shared-fibocom.so.p/fibocom_mm-port-mbim-fibocom.c.o
      FAILED: src/plugins/libmm-shared-fibocom.so.p/fibocom_mm-port-mbim-fibocom.c.o 
      cc -Isrc/plugins/libmm-shared-fibocom.so.p -Isrc/plugins -I../src/plugins -I. -I.. -Isrc -I../src -I../src/kerneldevice -Ilibmm-glib -I../libmm-glib -Iinclude -I../include -Ilibmm-glib/generated -I../libmm-glib/generated -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/libmbim-glib -I/usr/include/gio-unix-2.0 -I/usr/include/libqmi-glib -I/usr/include/libqrtr-glib -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu89 -O0 -g -DHAVE_CONFIG_H -Wno-unused-parameter -Wno-cast-function-type -Wno-packed -Wno-float-equal -Wno-missing-field-initializers -fno-strict-aliasing -Waggregate-return -Wcast-align -Wdeclaration-after-statement -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wformat=2 -Wformat-nonliteral -Wformat-security -Winit-self -Winline -Wjump-misses-init -Wlogical-op -Wnested-externs -Wmaybe-uninitialized -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnull-dereference -Wpointer-arith -Wredundant-decls -Wrestrict -Wreturn-type -Wshadow -Wstrict-prototypes -Wsuggest-attribute=format -Wswitch-default -Wswitch-enum -Wundef -Wunused-but-set-variable -Wwrite-strings -fPIC -pthread -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_56 '-DMM_MODULE_NAME="shared-fibocom"' -MD -MQ src/plugins/libmm-shared-fibocom.so.p/fibocom_mm-port-mbim-fibocom.c.o -MF src/plugins/libmm-shared-fibocom.so.p/fibocom_mm-port-mbim-fibocom.c.o.d -o src/plugins/libmm-shared-fibocom.so.p/fibocom_mm-port-mbim-fibocom.c.o -c ../src/plugins/fibocom/mm-port-mbim-fibocom.c
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c: In function ‘iface_port_at_check_support’:
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:64:66: error: ‘MBIM_SERVICE_FIBOCOM’ undeclared (first use in this function); did you mean ‘MBIM_SERVICE_GOOGLE’?
         64 |         if (!mm_port_mbim_supports_command (MM_PORT_MBIM (self), MBIM_SERVICE_FIBOCOM, MBIM_CID_FIBOCOM_AT_COMMAND)) {
            |                                                                  ^~~~~~~~~~~~~~~~~~~~
            |                                                                  MBIM_SERVICE_GOOGLE
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:64:66: note: each undeclared identifier is reported only once for each function it appears in
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:64:88: error: ‘MBIM_CID_FIBOCOM_AT_COMMAND’ undeclared (first use in this function)
         64 |         if (!mm_port_mbim_supports_command (MM_PORT_MBIM (self), MBIM_SERVICE_FIBOCOM, MBIM_CID_FIBOCOM_AT_COMMAND)) {
            |                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c: In function ‘at_command_ready’:
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:138:10: warning: implicit declaration of function ‘mbim_message_fibocom_at_command_response_parse’; did you mean ‘mbim_message_atds_location_response_parse’? [-Wimplicit-function-declaration]
        138 |         !mbim_message_fibocom_at_command_response_parse (
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |          mbim_message_atds_location_response_parse
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:138:10: warning: nested extern declaration of ‘mbim_message_fibocom_at_command_response_parse’ [-Wnested-externs]
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c: In function ‘iface_port_at_command’:
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:226:15: warning: implicit declaration of function ‘mbim_message_fibocom_at_command_set_new’ [-Wimplicit-function-declaration]
        226 |     request = mbim_message_fibocom_at_command_set_new (buffer->len, (const guint8 *)buffer->data, NULL);
            |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:226:15: warning: nested extern declaration of ‘mbim_message_fibocom_at_command_set_new’ [-Wnested-externs]
      ../src/plugins/fibocom/mm-port-mbim-fibocom.c:226:13: warning: assignment to ‘MbimMessage_autoptr’ {aka ‘struct _MbimMessage *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
        226 |     request = mbim_message_fibocom_at_command_set_new (buffer->len, (const guint8 *)buffer->data, NULL);
            |             ^
      [200/205] Generating libmm-glib/ModemManager-1.0.gir with a custom command (wrapped by meson to set env)
      ninja: build stopped: subcommand failed.
      [user@host ModemManager]$ 

      Don't understand why it cannot find these identifiers.

      Edited by Piotr Świątkiewicz
    • Well, both MBIM_SERVICE_FIBOCOM as well as MBIM_CID_FIBOCOM_AT_COMMAND can be found only once in the entire source tree. Why is that?

    • Author Developer

      The error message you posted is not related to the changes introduced in this MR. The reason for your issue is that the current development version of ModemManager depends on the most recent development version of libmbim. Here is how I test it:

      1. Install the build dependencies:
      $ # for Fedora 40
      $ sudo dnf builddep ModemManager libmbim libqmi
      $ 
      $ # for Ubuntu 24.04 and later
      $ # first, uncomment lines starting with "deb-src" in `/etc/apt/sources.list`.
      $ sudo apt update && sudo apt upgrade
      $ sudo apt build-dep modemmanager libmbim libqmi
      1. Clone the ModemManager, libmbim, and libqmi git repositories and check out my branch:
      $ git clone https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git/
      $ git clone https://gitlab.freedesktop.org/mobile-broadband/libmbim.git/
      $ git clone https://gitlab.freedesktop.org/mobile-broadband/libqmi.git/
      $ cd ModemManager
      $ git fetch https://gitlab.freedesktop.org/tuxor1337/ModemManager.git/ port-xmm7360
      $ git checkout -b 'ModemManager-port-xmm7360' FETCH_HEAD
      1. Configure and compile libmbim and libqmi:
      $ cd ../libmbim
      $ meson setup build --buildtype=debug --prefix=$PWD/dist/ 
      $ ninja -C build install
      
      # for Fedora
      $ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/dist/lib64/pkgconfig"
      $ export CFLAGS="-I$PWD/dist/include/libmbim-glib"
      $ export LDFLAGS="-L$PWD/dist/lib64"
      
      # for Ubuntu
      $ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/dist/lib/x86_64-linux-gnu/pkgconfig"
      $ export CFLAGS="-I$PWD/dist/include/libmbim-glib"
      $ export LDFLAGS="-L$PWD/dist/lib/x86_64-linux-gnu"

      Similar for libqmi:

      $ cd ../libqmi
      $ meson setup build --buildtype=debug --prefix=$PWD/dist/ 
      $ ninja -C build install
      
      # for Fedora
      $ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/dist/lib64/pkgconfig"
      $ export CFLAGS="-I$PWD/dist/include/libqmi-glib"
      $ export LDFLAGS="-L$PWD/dist/lib64"
      
      # for Ubuntu
      $ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/dist/lib/x86_64-linux-gnu/pkgconfig"
      $ export CFLAGS="-I$PWD/dist/include/libqmi-glib"
      $ export LDFLAGS="-L$PWD/dist/lib/x86_64-linux-gnu"
      1. Configure and compile ModemManager:
      $ cd ../ModemManager
      $ meson setup build --buildtype=debug --prefix=$PWD/dist/ --sysconfdir=$PWD/dist/etc -Dudevdir=$PWD/dist/lib/udev 
      $ ninja -C build install
      1. Enable the FCC unlock script:
      $ sudo chown root:root ./dist/share/ModemManager/fcc-unlock.available.d/8086:7360
      $ sudo ln -s $PWD/dist/share/ModemManager/fcc-unlock.available.d/8086:7360 ./dist/etc/ModemManager/fcc-unlock.d/
      $ sudo ln -s $PWD/dist/share/ModemManager/fcc-unlock.available.d/8086:7360 ./dist/lib64/ModemManager/fcc-unlock.d/
      1. Stop and Disable ModemManager with the following commands:
      $ sudo systemctl stop ModemManager.service
      $ sudo systemctl disable ModemManager.service
      1. Make sure the iosm kernel module is loaded.
      $ sudo modprobe iosm
      1. Run ModemManager in debug mode:
      $ sudo ./build/src/ModemManager --debug
      1. Set up a broadband connection with NetworkManager. Disable Wifi (and LAN) check whether you are connected to the internet with your broadband modem, e.g. by opening some websites.
      2. If it doesn't work for you, make sure to give it another try after a fresh reboot of your computer because your previous setup might have screwed up your modem device.
      Edited by Thomas Vogt
    • Please register or sign in to reply
  • Thomas Vogt changed the description

    changed the description

    • Resolved by Thomas Vogt

      Dear Thomas,

      thank you so much for your explanation. In fact, I was trying to find out how I could tell the package manager ( pacman - I use Arch Linux) on my system to make sure all the necessary dependencies for MM development are satisfied. If there was a dedicated mm package (thinking: *-devel) it would probably happen automagically.

      So, OK - I shall clone and build libmbim and make another attempt at your MR. Will keep you posted.

      Edited by Piotr Świątkiewicz
    • Resolved by Thomas Vogt

      Ahhh.... Dammit: I have:

      [user@host libmbim-glib]$ pikaur -Ss libmbim
      Searching... [###]
      extra/libmbim 1.30.0-1 [installed] 
          MBIM modem protocol helper library    
      [user@host libmbim-glib]$ 

      Unfortunately (excerpt from mbim-uuid.h):

       * @MBIM_SERVICE_FIBOCOM: Fibocom specific service. Since 1.32.
       * @MBIM_SERVICE_COMPAL: Compal specific service. Since 1.32.
       * @MBIM_SERVICE_LAST: Internal value.
       *
       * Enumeration of the generic MBIM services.
       *
       * Since: 1.0
       */

      Unfortunately, /usr/include (.....libmbim-glib) preceeds this latetest location on the include list. So, the error is still there. Not sure if I can easily revert the order so that the correct header (and lib) is taken in the MM build.

  • Thomas Vogt added 1 commit

    added 1 commit

    • f8490fc3 - intel: implement support for RPC-powered xmm7360

    Compare with previous version

  • Thomas Vogt changed the description

    changed the description

    • Resolved by Aleksander Morgado

      Just tested. Looks good:

      [root@host ~]# ip a
      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
          inet 127.0.0.1/8 scope host lo
             valid_lft forever preferred_lft forever
          inet6 ::1/128 scope host noprefixroute 
             valid_lft forever preferred_lft forever
      3: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
          link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
      4: wlp0s20f3: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
          link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff permaddr xx:xx:xx:xx:xx:xx
      5: enp64s0u1u2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
          link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
      6: wwan0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
          link/none 
          inet xxx.xxx.xxx.xxx/0 brd 255.255.255.255 scope global noprefixroute wwan0
             valid_lft forever preferred_lft forever

      speedtest.net result: https://www.speedtest.net/result/16439259882 (not the best part of the city to get better speed)

      Would you be interested in a debug log from MM?

      By the way: do I correctly understand that, in order to fire up modem-manager-gui I would have to build it against this test version of the lib and modem-manager I am using for the test?

      Edited by Piotr Świątkiewicz
  • Thomas Vogt changed the description

    changed the description

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading