estkme-group / lpac

C-based eUICC LPA
GNU Affero General Public License v3.0
192 stars 51 forks source link

Feature request: Add MBIM APDU backend #94

Open bam80 opened 1 month ago

bam80 commented 1 month ago

Some e-SIM capable modems lack AT commands required for functioning AT APDU backend, or it's functionality is reduced. For these, alternative APDU backends could help, depending on the modems support:

@stich86 @z3ntu

z3ntu commented 1 month ago

I'd suggest once #70 is merged you can use that as template for MBIM support using libmbim, should be essentially replacing a few calls to libqrtr/libqmi with libmbim but I'd imagine the rest of the code should be pretty similar.

stich86 commented 1 month ago

I'd suggest once #70 is merged you can use that as template for MBIM support using libmbim, should be essentially replacing a few calls to libqrtr/libqmi with libmbim but I'd imagine the rest of the code should be pretty similar.

i'm asking an help of a friend because not an expert on C, but the way is this one, so we have everything inside lpac without external wrapper :)

bam80 commented 1 month ago

@stich86 as reference implementation exists, I think it could be good opportunity for you to improve your C knowledge :)

AndySchroder commented 1 month ago

So, https://github.com/estkme-group/lpac/pull/70 requires updates to ModemManager, which likely won't make it into operating system packages for quite some time, proving to be fairly inconvenient for some time. Does MBIM need any changes to ModemManager to work?

I am having the problem described here https://community.toradex.com/t/modem-manager-blocking-uart-for-at-commands/22221 with using the at APDU Backend and can't use it without stopping ModemManager. Wondering if a MBIM approach would be a workaround (if supported by the modem) for this issue and allow keeping ModemManager running all the time?

AndySchroder commented 1 month ago

Also, does MBIM use QMI or only QRTR uses QMI? Trying to understand if a modem supports both MBIM and QRTR which do we prefer to use? If QMI runs over MBIM, do we need https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/376 for MBIM to also work with lpac (also having the drawback I mention above about the change not making it into operating system packages for quite some time)?

AndySchroder commented 1 month ago

Okay, so I did some testing and found the answers to most of my questions. Most of it is documented in https://github.com/stich86/lpac-libmbim-wrapper/issues/4 . Basically, seems as though MBIM requires no updates to ModemManager. Also, you don't need to stop ModemManager to use MBIM with lpac, both can communicate with the modem at the same time.

robimarko commented 3 days ago

I made a PR to add support for using QMI directly: https://github.com/estkme-group/lpac/pull/131

It should work on any Qualcomm modem as they all should expose QMI in USB mode. For me it works great on Quectel RM520N.

bam80 commented 3 days ago

@robimarko could you make MBIM PR also?

robimarko commented 3 days ago

@bam80 Unfortunately, I dont have a use for MBIM currently at work, and no free time otherwise to figure out the libmbim glib-ism required.