A Cure for the Moble Data Blues (KDE Community Edition)
#8
Ok, I believe I have things working now:
Code:
#!/bin/bash
COLUMNS=15
PS3="Select the action: "
options=(Mobile_on Mobile_off Data_on Data_off quit)
select opt in "${options[@]}"
do

WWAN="wwan0"

case $opt in
Mobile_on)
    status=$(sudo systemctl status eg25-manager | grep running)
    if [ "$status" = "" ]; then
        echo "    Starting eg25-manager..."
        sudo systemctl start eg25-manager
        sleep 20
    fi
    echo "    Modem powering on and going online..."
    sudo ofonoctl poweron
    sudo ofonoctl online
    sleep 5
        ofonoctl
        break
        ;;

Mobile_off)
        echo "  Modem going offline and powering off..."
    sudo ofonoctl offline    
        sudo ofonoctl poweroff
        echo "  Stopping eg25-manager..."
        sudo systemctl stop eg25-manager
        ofonoctl
        break
        ;;

Data_on)
    status=$(sudo systemctl status eg25-manager | grep running)
        if [ "$status" = "" ]; then
                echo "  Starting eg25-manager..."
                sudo systemctl start eg25-manager
                sleep 20
        fi
        echo "  Modem powering on and going online..."
    sudo ofonoctl poweron
        sudo ofonoctl online
    sleep 5
    sudo ip link set dev $WWAN down
        sudo ip link set dev $WWAN up
    #str=$(ofonoctl wan | grep $WWAN)
    #echo "str=["$str"]"
    echo "    Running ofonoctl wan --connect"
        sudo ofonoctl wan --connect
    ip_addr=$(ip a | grep $WWAN | awk '/inet / {gsub("addr:","",$2); print $2}')
    #echo "ip_addr="$ip_addr
    ip_route=$(ip r | grep $WWAN | grep default)
    #echo "ip_route="$ip_route
    sudo ip r del $ip_route
    echo "    Adding route "$ip_route" proto dhcp metric 900"
    sudo ip r add $ip_route proto dhcp metric 900
    echo "ip a:"
    ip a | grep $WWAN
    echo "ip r:"
       ip r | grep $WWAN
        break
        ;;

Data_off)
    ip_addr=$(ip a | grep $WWAN | awk '/inet / {gsub("addr:","",$2); print $2}')
    sudo ip link set dev $WWAN down
    sudo ip a del $ip_addr dev $WWAN
    echo "    Deleting route and ip address"
    echo "ip a:"
    ip a | grep $WWAN
    echo "ip r:"
        ip r | grep $WWAN
    break
    ;;

quit)
        break
        exit
        ;;

"")
        echo "Invalid input."
        ;;
esac
done

read -p "Press enter to exit."

Note that I get several clicks when stopping eg25-manager.
I haven't bothered dealing with the ofonoctl status as I don't believe it makes any difference (as in if powered / online).
You can safely ignore the output of ofonoctl wan --connect if you run Data on multiple times, it still works.


Let me know if you're having any issues.
Pinephone v1.2 UBports CE. Adelaide, Australia using Amaysim SIM (Optus network, VoLTE enabled) with Mobian SD card. VoLTE working also with Felix / Vodafone AU and Aldimobile / Telstra AU.
Manjaro Plasma Mobile on EMMC.
  Reply


Messages In This Thread
RE: A Cure for the Moble Data Blues (KDE Community Edition) - by dcinoz - 02-25-2021, 08:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  debugging issue realted to iso image wth extra data eror penguins_rule 1 107 03-21-2024, 07:30 PM
Last Post: penguins_rule
  Manjaro Plasma Beta and Cellular Data Service Fred Zyphal 7 4,877 03-17-2022, 05:50 PM
Last Post: Fred Zyphal
  No incoming SMS. Outgoing SMS, calls and data working. HardwarePunk 3 2,931 11-20-2021, 12:53 AM
Last Post: HardwarePunk
  No mobile data working itwurketnet 3 2,415 10-14-2021, 09:04 AM
Last Post: itwurketnet
  PinePhone Beta Edition will not boot from MicroSD card Timothy_Ecc 8 7,060 04-30-2021, 03:42 PM
Last Post: Timothy_Ecc
  Plasma Mobile - no data connection KNERD 9 8,460 02-25-2021, 03:44 AM
Last Post: dcinoz
  Anbox on KDE Community Edition (Manjaro) neil2ball 8 6,714 02-21-2021, 08:53 PM
Last Post: neil2ball
  Mobile Data toggle not retained after reboot Shane 0 1,410 12-23-2020, 07:42 AM
Last Post: Shane
  Todays Manjaro CE Update Broke my AT&T Data cyberbillp 4 3,924 12-14-2020, 06:39 PM
Last Post: cyberbillp
Exclamation PinePhone Manjaro Edition, does not boot vdiazroa 2 3,023 11-28-2020, 02:00 PM
Last Post: bcg7

Forum Jump:


Users browsing this thread: 1 Guest(s)