Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blockevent for Android

release Release License

The "Android" name is a trademark of Google LLC.

blockevent runs on the user space similarly to getevent tool. Offers 2 appliable concepts for input devices.

Grabs exclusive input handle with using EVIOCGRAB control for input devices in the /dev/input/ to block input_event flow to Android Platform's EventHub. (Block concept)

Then releases the devices when specified input_event is received from any device(Stop trigger concept) or SIGINT signal sent by its terminal.(Ctrl+C)



Can be used:

  • To keep using devices that has faulty touch screen(especially ghost touch), buttons or headphone jack without modifying the kernel or disassembly any hardware.

  • For the applications needing to temporarily block of touch screen such as video players, child locks, drawing tracers, ebook readers.

  • For the applications needing to permanently block of touch screen like turning device into display.

Usage

Usage: ./blockevent -d device... [-s trigger] [-v level] [-r x1,y1,x2,y2...] [-R ] [-W width] [-H height]
    -d: blocking device. Preset device id or a path specified device.
        Preset devices (0=Touchscreen, 1=Volume Down, 2=Volume Up, 3=Power Button)
        Specific device (/dev/input/eventX)

    -s: stop trigger.Preset device or a device specified event.
        Preset devices (0=Area Button, 1=Volume Down, 2=Volume Up, 3=Power Button)
        Specific event (/dev/input/eventX:<Type>,<Code>,<Value>)

    -v: verbosity level.(Errors=1, None=2, All=4) (Default=1)
    -r: rectangle.Comma seperated left bottom and right top corner point coordinates.
        -d 0 -s (1-3) -r x1,y1,x2,y2 : specifies partly blocking rectangle on the touchscreen.
        -d 0 -r x1,y1,x2,y2 -s 0 -r x1,y1,x2,y2 : specifies partly blocking.
        -d (1-3) -s 0 -r x1,y1,x2,y2 : specifies area button's rectangle.

    -R: reverse. Reverses blocking rectangle on the touchscreen.
    -W: screen width.
    -H: screen height.
    -h: print help.

Get your executable binary from Releases or build yourself then follow the commands.

Running on device :

su # tsu for Termux
cp blockevent_* /data/local/tmp/
chmod +x /data/local/tmp/blockevent_*
./data/local/tmp/blockevent_*

Running with adb :

adb push blockevent_* /data/local/tmp/
adb shell su -c "chmod +x /data/local/tmp/blockevent_*"
adb shell su -c /data/local/tmp/blockevent_*

Block touch screen :

> ./data/local/tmp/blockevent_* -d 0

Block left half of the touch screen:

> ./data/local/tmp/blockevent_* -d 0 -r 0,2400,540,0 -W 1080 -H 2400

Block touch screen and stop blocking when volume down button is pressed:

> ./data/local/tmp/blockevent_* -d 0 -s 1

Block touch screen and stop blocking when rectangle area is double tapped.

> ./data/local/tmp/blockevent_* -d 0 -s 0 -r 400,1100,750,800 -W 1080 -H 2400

Block other devices :

> getevent -lp
add device 3: /dev/input/event6
  name:     "atoll-wcd937x-snd-card Headset Jack"
  [...]

> ./data/local/tmp/blockevent_* -d /dev/input/event6

Build

Target ABI
android_arm armeabi-v7a
android_arm64 arm64-v8a
android_x86 x86
android_x86_64 x86_64

There is a script provided to build application for all the targets. Make sure you download NDK and install Bazel then follow the commands.

Using the release.sh script:

> export ANDROID_NDK_HOME=/YOUR/NDK/PATH
> ./release.sh

4 build completed successfully (Total: 4)
releases/blockevent_arm: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, with debug_info, not stripped
[...]

Build for the specific target:

bazel build //src:blockevent --config=TARGET

TODO

This section will be removed after version 1.x.x

  • Add specific event trigger option to stop blocking
  • Add touch device classifier to able to block touchscreen without getting device from the user.
  • Add option to block multiple devices at the same time.
  • Add installation script
  • Add option to block only specific part of touchscreen
  • Add custom stop triggers.
  • [Done for touchscreen] Change device blocking behavior to event blocking behavior. Some devices has a single device for volume and power button events. New behavior will provide a filtered blocking mechanism.

Releases

Packages

Contributors

Languages