Skip to content

Commit

Permalink
lpac: add uqmi backend
Browse files Browse the repository at this point in the history
This adds an additional OpenWrt specific backend to use lpac with the
uqmi tooling used by OpenWrt to manage QMI based modems.

This allows lpac to manage eUICC chips without the need for other,
potentially bigger, software using the installed modem.

Also set this backend as the new default, as users probably expect being
able to download profiles using their cellular modem.

Profile-Switching
-----------------
With some eUICC modem combinations you might require to powercycle the
UIM slot using uqmi after changing the active profile. To do this,
simply execute

$ uqmi -d /dev/cdc-wdm0 --uim-power-off --uim-slot=1
$ uqmi -d /dev/cdc-wdm0 --uim-power-on --uim-slot=1

Note
----
SM-DP+ might use encryption parameters which are incompatible with
mbedtls which cURL is by default compiled for.

This was observed when attempting to download a profile from
Vodafone DE.

If you encounter issues in that regard, try to install a version of
libcurl which is compiled with OpenSSL support.

Signed-off-by: David Bauer <[email protected]>
  • Loading branch information
David Bauer authored and blocktrron committed Aug 28, 2024
1 parent a5db1d3 commit 53184ef
Show file tree
Hide file tree
Showing 5 changed files with 371 additions and 7 deletions.
6 changes: 6 additions & 0 deletions utils/lpac/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ config LPAC_WITH_AT
help
Compile LPAC with APDU AT Backend support.

config LPAC_WITH_UQMI
bool "Include APDU uqmi Backend support"
default y
help
Compile LPAC with APDU uqmi Backend support.

endmenu
1 change: 1 addition & 0 deletions utils/lpac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ TARGET_CFLAGS += $(FPIC)
CMAKE_OPTIONS += \
-DLPAC_WITH_APDU_PCSC=$(if $(CONFIG_LPAC_WITH_PCSC),ON,OFF) \
-DLPAC_WITH_APDU_AT=$(if $(CONFIG_LPAC_WITH_AT),ON,OFF) \
-DLPAC_WITH_APDU_UQMI=$(if $(CONFIG_LPAC_WITH_UQMI),ON,OFF) \
-DLPAC_WITH_APDU_QMI_QRTR=OFF

define Package/lpac/install
Expand Down
18 changes: 12 additions & 6 deletions utils/lpac/files/lpac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

. /lib/config/uci.sh

APDU_BACKEND="$(uci_get lpac global apdu_backend at)"
APDU_BACKEND="$(uci_get lpac global apdu_backend uqmi)"
APDU_DEBUG="$(uci_get lpac global apdu_debug 0)"

HTTP_BACKEND="$(uci_get lpac global http_backend curl)"
HTTP_DEBUG="$(uci_get lpac global http_debug 0)"

AT_DEVICE="$(uci_get lpac at device /dev/ttyUSB2)"
AT_DEBUG="$(uci_get lpac at debug 0)"

export LPAC_HTTP="$HTTP_BACKEND"
if [ "$HTTP_DEBUG" -eq 1 ]; then
export LIBEUICC_DEBUG_HTTP="1"
Expand All @@ -21,7 +18,16 @@ if [ "$APDU_DEBUG" -eq 1 ]; then
export LIBEUICC_DEBUG_APDU="1"
fi

export AT_DEVICE="$AT_DEVICE"
export AT_DEBUG="$AT_DEBUG"
if [ "$APDU_BACKEND" = "at" ]; then
AT_DEVICE="$(uci_get lpac at device /dev/ttyUSB2)"
AT_DEBUG="$(uci_get lpac at debug 0)"
export AT_DEVICE="$AT_DEVICE"
export AT_DEBUG="$AT_DEBUG"
elif [ "$APDU_BACKEND" = "uqmi" ]; then
UQMI_DEV="$(uci_get lpac uqmi device /dev/cdc-wdm0)"
UQMI_DEBUG="$(uci_get lpac uqmi debug 0)"
export LPAC_QMI_DEV="$UQMI_DEV"
export LPAC_QMI_DEBUG="$UQMI_DEBUG"
fi

/usr/lib/lpac "$@"
6 changes: 5 additions & 1 deletion utils/lpac/files/lpac.uci
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
config global global
option apdu_backend 'at'
option apdu_backend 'uqmi'
option http_backend 'curl'
option apdu_debug '0'
option http_debug '0'

config at at
option device '/dev/ttyUSB2'
option debug '0'

config uqmi uqmi
option device '/dev/cdc-wdm0'
option debug '0'
Loading

0 comments on commit 53184ef

Please sign in to comment.