4

Long story short, looking for a way to either disable the behaviour of screen turning on/off in reaction to magnets, or disable the Hall sensor (the sensor responsible for the reaction) altogether. The flip cover I have in hand has a weak magnet and thus doesn't turn on/off the screen reliably, hence I want to simply disable the feature and take things into my own hands.

There are a bunch of Xposed modules that do just the job (example), but Android 7+ probably never will get Xposed from what it looks like right now, so a solution without using Xposed is required.

The device in question is a Samsung Galaxy Tab S2 (Qualcomm, Wi-Fi) with root access.

EDIT 1: after some poking around, it seems that /dev/input/event6 corresponds to the Hall sensor on this device - every time I open/close the magnetic lid, it shows an event there. Unfortunately, I still haven't found a way to disable a particular input device.

EDIT 2: I have tried a way to prevent the Hall sensor from reporting back its status, thus effectively disabling the sensor, and it works well. The problem is it requires me to modify the ROM's source code, and although I can handle that as a ROM compiler, I'm sure there are much more people who can't. So still, waiting for a more feasible solution.

  • I suppose it's possible by writing something to somewhere under /sys. Well, root required, of course. – iBug Jul 6 '17 at 2:01
  • Thinking of the same, and one can indeed do it that way on a Nexus 7 (2013), but different devices have different /sys structures, and that's the complication... – Andy Yan Jul 6 '17 at 4:22
  • What's wrong with opening Settings and turning the thing off there? – Matthias Urlichs Jan 16 at 12:53
  • @MatthiasUrlichs Most devices don't have such a setting. It's not a part of AOSP. – Andy Yan Jan 17 at 1:28
1
+50

You can delete /dev/input/event6 directly. Then everything with the Hall sensor will stop working.

To make this happen automatically, you can write a simple script and let it auto-run at boot.

#!/system/bin/sh
exec rm -f /dev/input/event6

To restore without rebooting, examine it with ls -l before deleting (or you have to reboot)

Assume ls -l gave this result:

crw-rw---- root input 13, 68 1970-01-01 00:00 /dev/input/event6

Take note of the two numbers after owner/group, run this to recover

mknod /dev/input/event6 c 13 68
  • Your solution worked perfectly on my Galaxy A9 2018. I am wondering how to permanently disable this sensor without having something run at boot. Do you have any suggestions? – Falcon Mar 14 at 2:26
  • @Falcon Sorry, that's not easily possible (you have to modify the kernel or whatever) – iBug Mar 14 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.