Feature #1806
openFeature #1779: Implement setting that allows to permanently disable the modem
modem shell enable/disable script: verify with measurements through a BTS that the modem is disabled
Added by Fil Bergamo over 7 years ago. Updated over 3 years ago.
0%
Description
In order to implement what's required in #1779, some docs are needed about how to achieve modem disabling under the hood.
Files
0001-Added-scripts-for-disabling-and-enabling-the-i9300-m.patch (39.6 KB) 0001-Added-scripts-for-disabling-and-enabling-the-i9300-m.patch | Jeremy Rand, 07/22/2017 04:09 PM | ||
6.0-modem-v2.patch (146 KB) 6.0-modem-v2.patch | Jeremy Rand, 08/20/2017 04:51 PM |
Related issues
Updated by Jeremy Rand over 7 years ago
Wolfgang posted some relevant info for the S3 i9300 here: https://redmine.replicant.us/boards/39/topics/13996?r=14001#message-14001
Quoting his instructions:
adb root adb remount adb shell mv /system/lib/libsamsung-ril.so /system/lib/libsamsung-ril.so.disabled
I haven't tried the instructions myself, but NS von H says they worked.
Updated by Fil Bergamo over 7 years ago
That instruction
adb remount
makes me suspect that this isn't doable from inside the phone, and needs a host computer.
But, from my understanding, what it actually does is remount the /system partition in RW mode.
So, maybe just issuing a shell command from inside the phone would do the same:
mount -o rw,remount /system
gotta give it a try...
Updated by Wolfgang Wiedmeyer over 7 years ago
Thanks for looking into this!
Indeed, it's possible to remount the system partition like this. Apps like AdAway do this. But this is a hack and shouldn't be done during regular operation of the device. The system partition should stay untouched if possible. It's also problematic because all changes are reverted after installing an update zip.
Moving libsamsung-ril leads to the RIL daemon not finding the vendor RIL and thus not initializing the radio. This only works on Samsung devices where libsamsung-ril is used. To have a more future-proof solution, it would be better to implement this in a way that is device-independent.
Settings should be stored in the data partition if they should be permanent. I don't know if it's possible to use the settings storage that the settings app uses and make this accessible by system daemons. I guess that all of this could be implemented like this:- Add a new setting to the settings app that says something like "Disable modem initialization"
- If the setting is selected, a file like
/data/.disable_modem_boot
is generated - When the RIL daemon is started, before loading a vendor RIL like libsamsung-ril, it checks if this file exists and exits immediately if it does.
If you choose to implement it this way, then there are more things to watch out for, but it's not important to do this right away. It's probably not possible to disable the RIL daemon and make sure that it is not started by any other process. So making changes directly to the RIL daemon like I suggested above is necessary. However, it needs to be checked if the daemon is then started over and over again and if this can be prevented somehow.
The file that stores the setting in the data partition needs to be protected. At least it needs to have a proper SELinux context and in general, it should be ensured that it can only be removed by the settings app (and root of course).
Updated by Jeremy Rand about 7 years ago
I have a working PoC: https://git.replicant.us/replicant/user-scripts/merge_requests/1
It's not as clean a solution as what Wolfgang suggested, but maybe it'll suffice until someone more competent than I am has time to implement Wolfgang's suggested method.
Cheers!
Updated by Jeremy Rand about 7 years ago
- File 0001-Added-scripts-for-disabling-and-enabling-the-i9300-m.patch 0001-Added-scripts-for-disabling-and-enabling-the-i9300-m.patch added
Patch attached for the user-scripts repo.
Updated by Fil Bergamo about 7 years ago
- Related to Feature #1820: Do some testing on femtocells added
Updated by Wolfgang Wiedmeyer about 7 years ago
Jeremy, thanks for the patch!
Could you change the commit title to something more general to reflect that this works not only on the i9300 but all devices that use Samsung-RIL?
I'm not sure if it's necessary to include the license in a separate file. The other scripts don't have it and it could be confusing then. But this is no blocker to me.
It would be good to document the scripts in the wiki. I gave you wiki access.
Updated by Wolfgang Wiedmeyer about 7 years ago
I just noticed that for the wifi scripts, the license is also included. It looks like everything on the replicant-6.0 branch is then GPLv3+, so the license could be moved to the root folder.
Updated by Jeremy Rand about 7 years ago
- File 6.0-modem-v2.patch 6.0-modem-v2.patch added
Updated by Jeremy Rand about 7 years ago
Thanks for the review Wolfgang! I've added a new patch that I think addresses your feedback.
Updated by Jeremy Rand about 7 years ago
Wolfgang Wiedmeyer wrote:
It would be good to document the scripts in the wiki. I gave you wiki access.
https://redmine.replicant.us/projects/replicant/wiki/ModemDisable
Hopefully everything there is acceptable. If you think it's all okay, feel free to link to it from https://redmine.replicant.us/projects/replicant/wiki#Replicant-usage (I don't have edit privileges for that page).
Updated by Wolfgang Wiedmeyer almost 7 years ago
Jeremy Rand wrote:
Hopefully everything there is acceptable. If you think it's all okay, feel free to link to it from https://redmine.replicant.us/projects/replicant/wiki#Replicant-usage (I don't have edit privileges for that page).
Done. Looks good, thanks for adding the documentation!
Updated by Jeremy Rand over 6 years ago
Wolfgang Wiedmeyer wrote:
The file that stores the setting in the data partition needs to be protected. At least it needs to have a proper SELinux context and in general, it should be ensured that it can only be removed by the settings app (and root of course).
Is it feasible to apply such permissions to a "setprop persist.*" property? As I understand it, that's the standard method for settings to be stored.
Updated by Kurtis Hanna about 6 years ago
Should we mark this issue as resolved?
Updated by Fil Bergamo about 6 years ago
- Assignee deleted (
Fil Bergamo)
Kurtis Hanna wrote:
Should we mark this issue as resolved?
If I recall correctly, Jeremy's scripts only work for I9300 and are based on a device-specific approach.
Furthermore, the search should remain open until some in-depth testing is made to confirm no radio activity is present when the modem is disabled (see #1820).
Updated by Kurtis Hanna about 6 years ago
This write up says that this script works on devices that use Samsung-RIL, and that we don't yet have a way to disable the modem on other devices: https://redmine.replicant.us/projects/replicant/wiki/ModemDisable
The Samsung-RIL page doesn't say which devices it is used on. https://redmine.replicant.us/projects/replicant/wiki/Samsung-RIL I thought all devices supported in Replicant 6.0 use Samsung-RIL. Is it true that this script is device specific? If so, we should probably change the ModemDisable wiki.
I agree with your suggestion to keep this ticket open pending some in depth testing to confirm that no radio activity is present when the modem is disabled.
Updated by Denis 'GNUtoo' Carikli over 5 years ago
- Target version changed from Replicant 6.0 to Replicant 6.0 0004
Updated by Denis 'GNUtoo' Carikli almost 5 years ago
- Subject changed from Find and document a way to reliably disable the modem via shell commands. to modem shell enable/disable script: verify with measurements through a BTS that the modem is disabled
- Target version changed from Replicant 6.0 0004 to Any version
Change from "Find and document a way to reliably disable the modem via shell commands." as the script will be in the next release and has already been done and merged. Some patches are still pending for the integration but will be merged soon.