Downloading eSIM profiles through a USB Modem

If you have a USB modem, you might be able to download and configure eSIM profiles through the USB modem without a smart card reader.

Overview

To download a new eSIM profile to an eSIM adapter, we'll

Instructions

Below are detailed instructions.

  1. Using your linux distribution's package manager install prerequisite libraries and header files. For example,

# Arch/EndeavorOS/Manjaro
sudo pacman -S pcsclite pcsc-tools libcurl-compat
# Fedora/Rocky/Alma
sudo dnf install libcurl libcurl-devel pcsc-lite-devel pcsc-lite-libs pcsc-lite pcsc-tools
# Debian/Ubuntu
apt-get install build-essential libpcsclite-dev libcurl4-openssl-dev zip
  1. Download/unzip or clone the lpac source code. (Even if your linux distribution has a pre-built lpac package, it probably hasn't been built with the option to use the AT APDU.)

  2. Change directory to the source directory lpac-main
  3. Configure the source with

cmake . -DLPAC_WITH_APDU_AT=1
  1. If you have a Quectel modem, complete the steps in the section called Patching for Quectel below before building lpac.

  2. Build with

make
  1. Attach the USB modem and find which serial devices it adds. The most likely useful devices are /dev/ttyUSB2 or /dev/ttyACM2. If it's not clear, detach the modem, run sudo dmesg -w and then plug in the modem. The serial devices will be listed in the dmesg output.

  2. Find the group ownership of the serial device. For example

ls -l /dev/ttyUSB2
crw-rw---- 1 root uucp 166, 0 Oct 31 18:46 /dev/ttyUSB2
  1. Add yourself to the group of this device (e.g. uucp or dialout)

sudo usermod -aG user uucp
  1. Logout and login (or run su - user where user is your linux username)

  2. Run groups to verify that your current shell reflects uucp or dialout group membership

  3. In this step we'll stop the ModemManager from accessing the modem so that lpac can

sudo systemctl stop ModemManager
  1. Check whether lpac is able to access the modem using the AT ADPU. Ensure no errors are output from the following command.

LPAC_APDU=at AT_DEVICE=/dev/ttyUSB2 output/lpac chip info | jq
  1. If there are any errors, it might help to add debug variables.

  2. Connect to the internet using a different interface than the USB modem (e.g. wifi or ethernet). This is only needed for downloading an eSIM profile. Since we stopped the ModemManager service, the modem won't provide internet connectivity. If a separate internet connection is not available, see the instructions for Downloading an eSIM profile for a USB modem without a second network device.

  3. Run the usual lpac commands to list, download, enable and nickname eSIM profiles including the "at" variables

LPAC_APDU=at AT_DEVICE=/dev/ttyUSB2 output/lpac profile download -s "smdp.io" -m "K2-GH4JFI-D9JI"

Tip Instead of typing the AT variables for every command, export them to the environment with export LPAC_APDU=at AT_DEVICE=/dev/ttyUSB2.


CategoryHomepage

eSIM Adapter/lpac via USB modem (last edited 2024-322 03:35:22 by unn-169-150-203-10)