2

I have a RPi 2 set up as a kiosk with the official touch screen.

On startup, the user will need to enter some input using the touch screen, but then I want to display an external web page in full screen mode. This site shows a map, and I want the user to be able to drag the map, but not to click in it. Note that the website is external so I can't use javascript to catch events.

How can I catch/disable touch screen events from bash? An acceptable, but not ideal, solution would be to disable touch functionality altogether after the user logs in.

2
  • Do you want to control the behaviour of the browser from bash?
    – Bex
    Commented Apr 10, 2016 at 12:17
  • I want to catch touch input before it reaches the browser so I can intercept a click but pass dragging through. Commented Apr 10, 2016 at 15:36

3 Answers 3

1

I ended up installing xinput, getting the touch screen's ID using

xinput --list

and then:

<?php
exec('xinput disable 6');
?>

Where 6 is the touch device ID.

This disables all touch input so the user is not able to drag or click.

0

What you want can probably not be easily achieved from bash, as such.

You probably want to operate on the driver.

One idea would be to unload the input driver all together. You will have to identify it, using lsmod, and then remove it with rmmod. You can reinsert it with insmod if needed.

1
  • 1
    Note that some poorly written drivers behave erratically when you unload them while their device file is in use. I've seen a system where disabling the touchpad / touchscreen this way would crash the system every second time or so. Commented Aug 14, 2017 at 7:58
0

While it is possible to disable individual input events in X (e.g. using xmodmap), it's pretty much impossible to disable a click while leaving a drag enabled. Both actions are transmitted to the window via ButtonPress and ButtonRelease events, and those are translated to clicks or drags by the widget library, such as QT or GTK. Theoretically, you could patch the library to disable the "onClick" callback, leaving only the drag functionality, but that would require a non-trivial level of programming knowledge.

That leaves you with the option of disabling the input device altogether, which you already know how to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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