Project

General

Profile

Actions

Feature #1806

open

Feature #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 almost 7 years ago. Updated about 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Telephony and mobile data
Target version:
Start date:
05/20/2017
Due date:
% Done:

0%

Estimated time:
Resolution:
Device:
Grant:
Type of work:
Wiki editions

Description

In order to implement what's required in #1779, some docs are needed about how to achieve modem disabling under the hood.


Files


Related issues

Related to Replicant - Feature #1820: Do some testing on femtocellsNewDenis 'GNUtoo' Carikli07/04/2017

Actions
Actions #1

Updated by Jeremy Rand almost 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.

Actions #2

Updated by Fil Bergamo almost 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...

Actions #3

Updated by Wolfgang Wiedmeyer almost 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).

Actions #4

Updated by Jeremy Rand almost 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!

Actions #6

Updated by Fil Bergamo over 6 years ago

Actions #7

Updated by Wolfgang Wiedmeyer over 6 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.

Actions #8

Updated by Wolfgang Wiedmeyer over 6 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.

Actions #10

Updated by Jeremy Rand over 6 years ago

Thanks for the review Wolfgang! I've added a new patch that I think addresses your feedback.

Actions #11

Updated by Wolfgang Wiedmeyer over 6 years ago

Thanks Jeremy, pushed :)

Actions #12

Updated by Jeremy Rand over 6 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).

Actions #13

Updated by Wolfgang Wiedmeyer over 6 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!

Actions #14

Updated by Jeremy Rand about 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.

Actions #15

Updated by Kurtis Hanna over 5 years ago

Should we mark this issue as resolved?

Actions #16

Updated by Fil Bergamo over 5 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).

Actions #17

Updated by Kurtis Hanna over 5 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.

Actions #18

Updated by Denis 'GNUtoo' Carikli about 5 years ago

  • Target version changed from Replicant 6.0 to Replicant 6.0 0004
Actions #19

Updated by Denis 'GNUtoo' Carikli over 4 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.

Actions #20

Updated by _I3^ RELATIVISM about 3 years ago

  • Type of work Wiki editions added
Actions

Also available in: Atom PDF