Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QMI-over-QRTR APDU backend for running on Qualcomm SoCs #70

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

z3ntu
Copy link

@z3ntu z3ntu commented Apr 26, 2024

On modern smartphones the communication happens using the QMI protocol via the QRTR transport to communicate with the modem.

Add support for such devices by wrapping libqrtr-glib and libqmi-glib and using those APIs to provide an APDU backend for lpac.

Fixes #41


Depends on this libqmi MR which hasn't been merged yet: https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/376

#include <libqrtr-glib.h>
#include "qmi_qrtr_helpers.h"

#define UIM_SLOT 2 // TODO: Make this runtime-configurable
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a suggestion how to handle the dual-SIM situations, where one wants to set the slot to 1 or 2 (or in theory slot 3 and higher could also exist)?

One idea is adding an environment variable UIM_SLOT=1 to lpac invocation but this wouldn't be nice in my opinion.

On modern smartphones the communication happens using the QMI protocol
via the QRTR transport to communicate with the modem.

Add support for such devices by wrapping libqrtr-glib and libqmi-glib
and using those APIs to provide an APDU backend for lpac.
@AndySchroder
Copy link

I have a Quectel EM120R-GL (https://www.quectel.com/wp-content/uploads/2021/05/Quectel_EM120R-GLEM160R-GL_Hardware_Design_V1.1.pdf), is that device I could test this with? It supports eSIM, and I think it has a Qualcomm chip. It says it supports QMI and QRTR.

@AndySchroder
Copy link

If you have multiple modems, how does it know which one to use?

@AndySchroder
Copy link

Explain to me the purpose of this feature exactly. We already have ports like /dev/wwan0at1 and /dev/ttyUSB3 for running AT commands on the modem. Can we not just use those ports with at APDU backend?

@z3ntu
Copy link
Author

z3ntu commented May 5, 2024

The modems on Qualcomm smartphones don't do AT commands, you communicate with them through QMI.

But for curiosity, does anything show up with qrtr-lookup (from https://github.com/linux-msm/qrtr) with your Quectel modem?

@AndySchroder
Copy link

AndySchroder commented May 5, 2024

But for curiosity, does anything show up with qrtr-lookup (from https://github.com/linux-msm/qrtr) with your Quectel modem?

Not sure how to get that installed. There aren't any build instructions. I'm running on ubuntu 22.04.

I don't think I'm running a SoC, it's just a cellular radio. Started my troubleshooting of it here though: #73 . I'm thinking I should be able to use both approaches.

@z3ntu
Copy link
Author

z3ntu commented May 5, 2024

@AndySchroder git clone https://github.com/linux-msm/qrtr && cd qrtr && meson setup builddir && meson compile -C builddir && ./builddir/src/qrtr-lookup should work, but yeah if it's an external modem then this PR is probably not applicable.

What I know is that some external modems use MBIM so you can check z3ntu/lpac-libqmi-wrapper#1 or even better https://github.com/stich86/lpac-libmbim-wrapper but I don't know any more about eSIM on external modems than that :)

@AndySchroder
Copy link

$ ./builddir/src/qrtr-lookup
ERROR qrtr-lookup: sock(AF_QIPCRTR): Address family not supported by protocol
$

@AndySchroder
Copy link

The data sheet for the EM120R-GL says QMI/MBIM. Also, mmcli reports drivers: option, cdc_mbim and ports: cdc-wdm0 (mbim), ttyUSB0 (qcdm).

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.

Qualcomm QMI/QRTR backend?
3 participants