#format wiki = 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 * Insert the eSIM adapter into the USB modem * Configure lpac to use the AT commands instead of PC/SC * Build lpac * Run lpac to download the profile == Instructions == Below are detailed instructions. 1. Using your linux distribution's package manager install prerequisite libraries and header files. For example, {{{#!sh # 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 [[https://github.com/estkme-group/lpac|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.) 1. Change directory to the source directory lpac-main 1. Configure the source with {{{#!sh cmake . -DLPAC_WITH_APDU_AT=1 }}} 1. If you have a Quectel modem, complete the steps in the section called [[/PatchingForQuectel|Patching for Quectel]] below before building lpac. 1. Build with {{{#!sh 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 {{{#!sh 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) {{{#!sh sudo usermod -aG user uucp }}} 1. Logout and login (or `run su - user` where `user` is your linux username) 1. Run `groups` to verify that your current shell reflects uucp or dialout group membership 1. In this step we'll stop the ModemManager from accessing the modem so that lpac can {{{#!sh 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. {{{#!sh LPAC_APDU=at AT_DEVICE=/dev/ttyUSB2 output/lpac chip info | jq }}} 1. If there are any errors, it might help to add [[https://github.com/estkme-group/lpac/blob/main/docs/ENVVARS.md|debug variables]]. 1. 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 [[/eSIM Adapter/lpac via USB modem without internet|Downloading an eSIM profile for a USB modem without a second network device]]. 1. Run the [[/eSIM Adapter/lpac|usual lpac commands to list, download, enable and nickname eSIM profiles]] including the "at" variables {{{#!sh LPAC_APDU=at AT_DEVICE=/dev/ttyUSB2 output/lpac profile download -s "smdp.io" -m "K2-GH4JFI-D9JI" }}} {{{#!wiki tip '''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