How to set up MaxCarrier Modem for linux

I've got the Portenta x8 hooked up to the max carrier board, its getting 24V in the dc power jack, ive got an LTE antenna hooked up to the SMA connector and I've got a Hologram Sim card in the sim slot. I've made sure to update the OS (There isnt any specifics on how to set it up in the tutorials/documentation aside from directing me to ModemManager API. Ive run that and udevd, i dont see any errors, but I'm not sure how to proceed since its not showing up when I use sudo ip route how can I get it to automatically use the modem?? Here's my version info for the OS:

cat /etc/os-release
ID=lmp-xwayland
NAME="Linux-microPlatform XWayland"
VERSION="4.0.3-699-88"
VERSION_ID=4.0.3-699-88
PRETTY_NAME="Linux-microPlatform XWayland 4.0.3-699-88"
HOME_URL="https://foundries.io/"
SUPPORT_URL="https://support.foundries.io/"
DEFAULT_HOSTNAME="portenta-x8"
LMP_MACHINE="portenta-x8"
LMP_FACTORY="arduino"
LMP_FACTORY_TAG="devel"
IMAGE_ID=lmp-factory-image
IMAGE_VERSION=699

figured it out, be nice if arduino could be a LITTLE bit more detailed on how to setup their own hardware. here's a bash script:

#!/bin/sh

modemNum=$(mmcli -L | sed -n 's/^.*\/Modem\/\(.\).*/\1/p')
result=$(mmcli -m $modemNum --simple-connect='apn=hologram,ip-type=ipv4')
if [[ $result != *"successfully"* ]]; then
  echo "Unable to bring modem online"
  exit
fi
bearerNum=$(mmcli -m $modemNum | sed -n 's/^.*Bearer.*\/Bearer\/\(.*\).*/\1/p')
interface=$(mmcli -m $modemNum --bearer=$bearerNum | sed -n 's/^.*interface: \(.*\).*$/\1/p')
ipaddr=$(mmcli -m $modemNum --bearer=$bearerNum | sed -n 's/^.*address: \(.*\).*$/\1/p')
dns1=$(mmcli -m $modemNum --bearer=$bearerNum | sed -n 's/^.*dns: \(.*\).*$/\1/p')
dns2=$(echo $dns1 | sed -n 's/^.*,\(.*\).*$/\1/p')
dns1=$(echo $dns1 | sed -n 's/^\(.*\),.*$/\1/p')
mtuNum=$(mmcli -m $modemNum --bearer=$bearerNum | sed -n 's/^.*mtu: \(.*\).*$/\1/p')
sudo ip link set $interface up
sudo ip addr add $ipaddr/32 dev $interface
sudo ip link set dev $interface arp off
sudo ip link set dev $interface mtu $mtuNum
sudo ip route add default dev $interface metric 200
sh -c "echo 'nameserver $dns1' >> /etc/resolv.conf"
sh -c "echo 'nameserver $dns2' >> /etc/resolv.conf"
1 Like