[HowTo]: Script to enable tethering (hotspot) on SailfishX
asked 2017-10-19 01:17:14 +0200
This post is a wiki. Anyone with karma >75 is welcome to improve it.
As tethering is a needed prerequisite for me to use my JollaX as a daily driver, I've tinkered this tiny script based on this zendesk-article: https://jolla.zendesk.com/hc/en-us/articles/115013777068 Feel free to use it yourself or to improve it! (This is a Wiki-Article)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root (type devel-su first)"
exit 1
fi
if [[ $1 == "off" ]]; then
echo "Best way to turn off hotspot at the moment is restarting your device..."
exit 0
elif [[ $1 == "on" ]]; then
echo "Switch Tethering ON.."
echo 2 > /sys/module/bcmdhd/parameters/op_mode
sleep 1
echo "Now restart WLAN from UI (\"Settings > WLAN\") and enable hotspot (\"Settings > Internet sharing\")"
read -p "Done with the instruction above? Then press [Enter] to continue..."
ip link set dev wlan0 master tether
sleep 1
echo "Enjoy tethering on your Xperia X!;)"
exit 0
else
echo "USAGE: $0 <on><off>"
exit 1
fi
Nice, thank you. But why do you have to restart to turn it off? Does
Sokinama ( 2017-10-20 20:24:15 +0200 )editecho 1 > /sys/module/bcmdhd/parameters/op_mode
not work?hey Sokinama! Disable tethering as in your suggestion lead to problems reconnecting to known wlan networks in my case. had no time so far to digg deeper, but feel free to improve if you can help!;)
joschobart ( 2017-10-23 23:58:56 +0200 )editFor the 'noobs' with us, you have to put it in a file with the extension filename.sh and start it with 'bash filename.sh on' for on and for off 'bash filename.sh off'. Coming from windows, costs a small hour to find out ;)
Can anybody tell me how coding tags are working on this forum, it's not mentioned in the help of this site.....
Tethering works now fine for me. Before I used tethering over USB.
Gatze ( 2017-10-27 19:08:27 +0200 )editthanks for the script, it works well. thinking about getting it to turn off too, I presume if we restart networking after setting
zepher ( 2017-11-09 16:46:48 +0200 )editecho 1 > /sys/module/bcmdhd/parameters/op_mode
, hopefully it should work. I'm not sure what the low level network restart command is, but will look into it. I guess if it was that easy they would have implemented it by now though...