NEW: WWAN Controller

This commit is contained in:
Gwendolin Kummer 2020-09-26 16:52:06 +02:00
parent db643dc38d
commit a2bbebbe23
4 changed files with 79 additions and 0 deletions

72
Scripts/wwan.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
## wwan controller
modulePath=/home/gwen/.local/share/xmm7360-pci
enableWwan(){
#disable wlan
nmcli radio wifi off
#build module
cd $modulePath
sudo make clean
sudo make
#load module
sudo make load
#start wwan
sudo python rpc/open_xdatachannel.py --apn gprs.swisscom.ch
cd -
}
disableWwan(){
#disable wwan
sudo ip link set wwan0 down
#unload module
cd $modulePath
sudo make unload
#enable wlan
nmcli radio wifi on
cd -
}
usage(){
echo "Usage: $0
-u enable Wwan
-d disable Wwan
-h help" 1>&2; exit 1;
}
if [[ $# -eq 0 ]]
then
wwanCheck=$(ip a | grep wwan0)
if [ -n "$wwanCheck" ]
then
displayer dunstify -a "wwanController" "Disable WWAN"
disableWwan
else
displayer dunstify -a "wwanController" "Enable WWAN"
enableWwan
fi
fi
while getopts 'udh' flag
do
case "${flag}" in
u)
enableWwan
;;
d)
disableWwan
;;
h | *)
usage
;;
esac
done

2
acpi/events/wwan Executable file
View File

@ -0,0 +1,2 @@
event=button/wlan
action=/etc/acpi/handlers/wwan

3
acpi/handlers/wwan Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/usr/bin/wwan.sh

View File

@ -139,6 +139,8 @@ then
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/volume.sh\" '/bin/volume.sh'"
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/scrotMenu.sh\" '/bin/scrotMenu.sh'"
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/monitorMenu.sh\" '/bin/monitorMenu.sh'"
linker "$dotfiles/Scripts/wwan.sh" ~/bin/wwan.sh
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/wwan.sh\" '/bin/wwan.sh'"
fi
## WM