6

I'm looking for a way to disable and enable the phone's touchscreen via console, and possibly the physical buttons, so to prevent finger touches from being processed. The phone is a Samsung Galaxy Fame, Android 4.1.x.

Background:

I'm configuring an old Galaxy Fame to serve as a sat navigator fixed on my car dashboard, aiming at using the up-to-date and free OpenStreetMap.

When I turn the key, the phone's USB is powered at 5V, when I turn off the car, the USB has no power. The phone is able to detect these events and I scripted some actions upon them, aiming at providing an instant-on and instant-off navigator service.

The phone remains always on and just switches to a power-save status when the car is off. The navigator app – OsmAnd – starts automatically at boot, but the boot does not occur between a car-on / car-off cycle, because the phone remains on to detect the mentioned USB changes.

Currently, what happens when I start the car and the USB gets powered:

  • Display is lit (echo 200 >/sys/class/backlight/panel/brightness)
  • Sat receiver is activated
  • CPU frequency set to max

What happens when I turn off the car and USB loses power:

  • Display's backlight off
  • The sat receiver goes off, along with WiFi and Bluetooth, in case they might have been active
  • CPU frequency set to minimum

Up to this point, everything is working. My problem now is that, when the car goes off and the phone enters this quasi-standby mode, the touchscreen still accepts input and, if the phone is handled or touched for whatever reason, it will stealthily react to those touches while the screen is unlit.

4
  • what is the model id of this device? meaning sm-blahblah , also can you post your init.rc to a pastebin? You have this device rooted?, grep your ramdisk *.rc's the perms/chown entries should tsp-ish, touch screen panel
    – moonbutt74
    Aug 16, 2015 at 0:47
  • run cat /sys/class/sec/sec_touchscreen/set_module_off if it comes back 0 then echo it to 1 and see what happens. Also how do i wrap code in comments?
    – moonbutt74
    Aug 16, 2015 at 0:50
  • This is a "Samsung Galaxy Fame gt-s6810p"; /init.rc is here: pastebin.mozilla.org/8842877 ; the device is rooted and I can execute su; grep results look interesting but I have not yet experimented with these control files: pastebin.mozilla.org/8842878 . My fiddlings with /sys/class/sec/sec_touchscreen/set_module_off are here: pastebin.mozilla.org/8842879
    – davide
    Aug 16, 2015 at 2:13
  • okay, that's a classic mistake, it's a good thing anything you do at the moment is temporary, cat FIRST to find out if it's a 0 or 1 type of setting.
    – moonbutt74
    Aug 16, 2015 at 2:27

3 Answers 3

3

cat your init.rc and under # Permissions for InputDevices.

chown system radio /sys/class/sec/tsp/cmd
chmod 0660 /sys/class/sec/tsp/input/enabled  <--your device may differ
chown system system /sys/class/sec/tsp/input/enabled <--your device may differ

Add to your scripting setup after verifying, for my device, a Samsung Galaxy Tab 4

echo 0 > /sys/class/sec/tsp/input/enabled

Touchscreen disabled.

echo 1 > /sys/class/sec/tsp/input/enabled

Touchscreen re-enabled.

2
  • Cool to hear! My phone however doesn't have that control file. The closest things I can approach to by grep-ping under /sys for the strings enable and tsp are: /sys/devices/virtual/sec/tsp/power/autosuspend_delay_ms — which I ignorantly overwrote to 1000, to no avail, and /sys/module/hid_prodikeys/parameters/enable, which I overwrote to N,N,N,N,N,N,N,N attempting to disable the touchkeys, to no avail. Write permissions were set before each write, and no errors prompted. I was probably deceived by the name of those control files.
    – davide
    Aug 15, 2015 at 23:21
  • I also tried fiddling with /sys/class/sec/sec_touchscreen/set_module_off and /sys/module/hid_magicmouse/parameters/report_touches.
    – davide
    Aug 16, 2015 at 0:18
3

I found a solution from https://android.stackexchange.com/a/193667

rm -rf /dev/input/event0

Does "delete" my touchscreen input. The other events disable/delete my other hardware buttons like volume etc. After restart of the phone, they are back. You need root / su for this.

0

On Google Nexus 4 (mako, LineageOS 14.1) and Xiaomi Mi5 (gemini), you can give

rm /dev/input/event2

to disable the touchscreen at runtime. You will still be able to control the device through scrcpy.

On Google Nexus 5 (hammerhead, LineageOS 14.1) you can give

rm /dev/input/event1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .