summaryrefslogtreecommitdiffstats
path: root/networking/modem/device-files/disable_modem.sh
diff options
context:
space:
mode:
authorJeremyRand <biolizard89@gmail.com>2017-08-20 16:38:01 +0000
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-08-28 14:09:15 +0200
commit61fbac7fe0ae0c88d869f3a40a106bcd65f25ec6 (patch)
tree5a010742228556f3fb3f643a65c9eb7982dbce38 /networking/modem/device-files/disable_modem.sh
parent63d9b15a50cb9fda0ad284173d12c3ebde5562b3 (diff)
downloadvendor_replicant-scripts-61fbac7fe0ae0c88d869f3a40a106bcd65f25ec6.tar.gz
vendor_replicant-scripts-61fbac7fe0ae0c88d869f3a40a106bcd65f25ec6.tar.bz2
vendor_replicant-scripts-61fbac7fe0ae0c88d869f3a40a106bcd65f25ec6.zip
Added scripts for disabling and enabling the modem on devices that use Samsung-RIL.
Reviewed-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'networking/modem/device-files/disable_modem.sh')
-rw-r--r--networking/modem/device-files/disable_modem.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/networking/modem/device-files/disable_modem.sh b/networking/modem/device-files/disable_modem.sh
new file mode 100644
index 0000000..eed2664
--- /dev/null
+++ b/networking/modem/device-files/disable_modem.sh
@@ -0,0 +1,43 @@
+#!/system/bin/bash
+#
+# Copyright (C) 2017 Jeremy Rand <jeremy@veclabs.net>
+# Partially based on code by Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> and Filippo Fil Bergamo
+#
+# This file is part of "SlightlyBetterAirplaneMode", a set of shell scripts to shut off
+# the Samsung phone modem without trusting the non-free modem firmware.
+#
+# SlightlyBetterAirplaneMode is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SlightlyBetterAirplaneMode is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -euf -o pipefail
+
+echo "Remounting system partition as writable..."
+mount -o rw,remount /system
+
+echo "Disabling RIL..."
+mv /system/lib/libsamsung-ril.so /system/lib/libsamsung-ril.so.disabled || echo 'RIL was already disabled.'
+
+echo "Syncing filesystem..."
+sync
+sync
+
+echo "Remounting system partition as read-only..."
+mount -o ro,remount /system
+
+echo "Syncing filesystem..."
+sync
+sync
+
+# https://android.stackexchange.com/a/139139
+echo "Modem will be disabled after we reboot now..."
+am start -a android.intent.action.REBOOT