bedtime
Posts: 69
Joined: Thu Dec 13, 2018 6:02 pm

Re: [how to] enable long touch as right click

Wed May 08, 2019 12:14 pm

MeneerJansen wrote:
Wed Apr 10, 2019 6:55 pm
The shell script from @bedtime gives the following error on my Raspbian 9.8 Stretch machine in Xfce:

Code: Select all

usage: xinput query-state <device name>
/home/pi/bin/rclk.sh: 30: [: =: unexpected operator
:?:
Sorry about that. Haven't used that script in a long time...

If it's a touchscreen device, you can try replacing the line:

Code: Select all

MOUSE_ID=$(xinput --list | grep -i -m 1 'mouse' | grep -o 'id=[0-9]\+' | grep -o '[0-9]\+')
with

Code: Select all

MOUSE_ID=$(xinput --list | grep -i -m 1 'FT5406' | grep -o 'id=[0-9]\+' | grep -o '[0-9]\+')



C program to find the device of a touchscreen:

printevent.c:

Code: Select all

/*
    gcc -Wall -O3  printevent.c -o printevent 
*/

#include<stdio.h>

__inline void fast_memcpyS(char *str, const char *str2, int start, int len)
{
    for( ;len > -1; )
    {
        str[len + start] = str2[len];
        --len;
    }
}

__inline int fast_memcmp(const char *str, const char *str2, int len)
{
    while(str[len] == str2[len] && --len);

    return len;
}

void get_device() 
{
    char data[120], s[32];
    int ret;
    FILE * const file = fopen( "/proc/bus/input/devices", "r");

    do
        ret = fscanf(file, "%*2s %s %*[^\n]\n", data);
    while(fast_memcmp(data, "Name=\"FT5406", 12) != 0 && ret != EOF);

    fscanf(file, "%*[^\n]\n%*[^\n]\n%*[^\n]\n%*2s %*15s %6s", data);

    fast_memcpyS(s, "/dev/input/", 0, 11);
    fast_memcpyS(s, data, 11, 6);

    puts(s);

    fclose(file);
}

int main() {

    get_device();

    return 0;

}

User avatar
MeneerJansen
Posts: 28
Joined: Sat May 14, 2016 1:51 pm

Re: [how to] enable long touch as right click

Wed May 08, 2019 6:45 pm

Solved it by adding this to /etc/X11/xorg.conf.d/99-calibration.conf:

Code: Select all

   # Right mouse button is long press with pen:
   Option "EmulateThirdButton" "1"
   Option "EmulateThirdButtonTimeout" "750"
   Option "EmulateThirdButtonMoveThreshold" "30"
[edit 16-6-2019] It must be added in the section called "InputClass".
Last edited by MeneerJansen on Sun Jun 16, 2019 2:54 pm, edited 1 time in total.

Asymic
Posts: 29
Joined: Sun Jun 16, 2019 8:28 am

Re: [how to] enable long touch as right click

Sun Jun 16, 2019 8:39 am

Please can someone expand on the last post, quoting "solved it".

Is this all I have to do to get a long touch on Jessie?

I am quite new to Pi. The line "Solved it by adding this to /etc/X11/xorg.conf.d/99-calibration.conf: " is a little confusing to me.

I take it that this is the path:- "/etc/X11/xorg.conf.d/" and this is a file name:- "99-calibration.conf"

If that is the case, and this is a new file, How does Pi know to read it?

Thank you.

User avatar
MeneerJansen
Posts: 28
Joined: Sat May 14, 2016 1:51 pm

Re: [how to] enable long touch as right click

Sun Jun 16, 2019 2:50 pm

Asymic wrote:
Sun Jun 16, 2019 8:39 am
Please can someone expand on the last post, quoting "solved it".

Is this all I have to do to get a long touch on Jessie?

I am quite new to Pi. The line "Solved it by adding this to /etc/X11/xorg.conf.d/99-calibration.conf: " is a little confusing to me.

I take it that this is the path:- "/etc/X11/xorg.conf.d/" and this is a file name:- "99-calibration.conf"

If that is the case, and this is a new file, How does Pi know to read it?

Thank you.
I think that my "method" only works in Raspbian 9 "Stretch". And yes, the path is "/etc/X11/xorg.conf.d/" and the filename is "99-calibration.conf". If you don't have that file on your Pi then I don't think it will work. By the way, all files in /etc/X11/xorg.conf.d/ are read and executed when Linux starts up. By the way, the text must be added in the section called "InputClass" in said file.

If you're new to the Pi and to Linux then trying to get a TFT screen to work on Raspbian Stretch may be quite difficult. See this topic.

Asymic
Posts: 29
Joined: Sun Jun 16, 2019 8:28 am

Re: [how to] enable long touch as right click

Tue Jun 18, 2019 3:59 pm

Thank you for the answer. I am running "Stretch" so I am a little confused as to why you would have the folder, and I have not.

I really need this long press feature! Do you think adding the folder and making the file would produce a result?

Thank you!

User avatar
MeneerJansen
Posts: 28
Joined: Sat May 14, 2016 1:51 pm

Re: [how to] enable long touch as right click

Wed Jun 19, 2019 10:44 am

Asymic wrote:
Tue Jun 18, 2019 3:59 pm
Thank you for the answer. I am running "Stretch" so I am a little confused as to why you would have the folder, and I have not.

I really need this long press feature! Do you think adding the folder and making the file would produce a result?

Thank you!
You may have another LCD touch screen than I have. I had to download "drivers" (read: some sripts) from the manufacturers' website. Those create said files and folders.

irdroid3
Posts: 3
Joined: Wed Jun 05, 2013 11:42 am

Re: [how to] enable long touch as right click

Fri Jun 28, 2019 6:06 pm

Does anyone know how to enable the long touch for the right mouse button
in Buster / Debian 10 (on the Official Touch screen on a Raspberry Pi 4) ?

I poked around looking for - /etc/X11/xorg.conf.d/99-calibration.conf
but the similariry ends at - /etc/X11/

Cheers, Ian
.

User avatar
MeneerJansen
Posts: 28
Joined: Sat May 14, 2016 1:51 pm

Re: [how to] enable long touch as right click

Sat Jun 29, 2019 11:04 am

irdroid3 wrote:
Fri Jun 28, 2019 6:06 pm
Does anyone know how to enable the long touch for the right mouse button
in Buster / Debian 10 (on the Official Touch screen on a Raspberry Pi 4) ?

I poked around looking for - /etc/X11/xorg.conf.d/99-calibration.conf
but the similariry ends at - /etc/X11/

Cheers, Ian
.
You might try to create it. Maybe it'll work... If not, this topic might be of help if you're an experienced Linux user.

Asymic
Posts: 29
Joined: Sun Jun 16, 2019 8:28 am

Re: [how to] enable long touch as right click

Fri Jul 26, 2019 6:02 am

I have been trying again to get the long touch to work on stretch, with the official 7 inch screen.

it has created a number of questions, which for ease I will number at the beginning of the line as they come up!

As my install of stretch does not seem to have the file, and path, mentioned earlier, I decided to do a search on *.conf files and had a look at ones which seemed like they might contain "input class", and sure enough I find all the settings which everybody has installed in "xorg.conf", and as I take it that this file is run at boot, then it would appear something really has stopped this working in the later updates of Raspbian.

1) can someone tell me if this file is run at boot or how to find out?

The one thing that begins to bug me about this topic is the fact that a touch screen should allow the mouse to be left behind! It is a nice screen, not cheap, and official. It also strikes me that the latest versions of Raspbian are "official" and so is this forum!

2) Surely there is some developer on here that can get to the bottom of this?! To me it is a major step backwards.

I have read that "Long touch is not supported on Stretch"

3) Why or how can this be? Are we expected to use the touch screen, but then when we want the mouse menu we have to get the mouse out?

I am almost tempted to find an early version of Raspbian where this does work - but I feel this is actually going against the grain.

As a last resort I had planned to use TwoFing to get round this, but I have also read that this does not work on Stretch.

4) Does TwoFing work with Stretch? Has anybody got it working?

5) Is it possible to escalate this topic so that one of the higher developers of Raspbian is aware? or are they aware anyway?

Many thanks for any answers!

User avatar
MeneerJansen
Posts: 28
Joined: Sat May 14, 2016 1:51 pm

Re: [how to] enable long touch as right click

Fri Jul 26, 2019 11:20 am

Asymic wrote:
Fri Jul 26, 2019 6:02 am
I have been trying again to get the long touch to work on stretch, with the official 7 inch screen.

it has created a number of questions, which for ease I will number at the beginning of the line as they come up!

As my install of stretch does not seem to have the file, and path, mentioned earlier, I decided to do a search on *.conf files and had a look at ones which seemed like they might contain "input class", and sure enough I find all the settings which everybody has installed in "xorg.conf", and as I take it that this file is run at boot, then it would appear something really has stopped this working in the later updates of Raspbian.
I've reacted before on your post. I redirect everybody w/ questions about this to this post of mine. It could be that the commands in that file do not work with the official Pi screen that you use. Also make sure you've installed evdev:

Code: Select all

sudo apt-get install libevdev2 xserver-xorg-input-evdev
Where is the xorg.conf file that you are talking about? In the directory /etc/X11/xorg.conf.d? Rename it to 99-calibration.conf, maybe that'll help.

Asymic wrote:
Fri Jul 26, 2019 6:02 am
1) can someone tell me if this file is run at boot or how to find out?
I'm afraid I do not. It is a mystery to me how Xorg works and it is going to be replaced by Wayland anyway. AFAIK Xorg does not need a .conf file anymore. It "configures" itself. So the files we're talking about are not per definition on one's system anymore now-a-days.
Asymic wrote:
Fri Jul 26, 2019 6:02 am
The one thing that begins to bug me about this topic is the fact that a touch screen should allow the mouse to be left behind! It is a nice screen, not cheap, and official. It also strikes me that the latest versions of Raspbian are "official" and so is this forum!
The seller/manufacturer should support it. Can you contact that company?
Asymic wrote:
Fri Jul 26, 2019 6:02 am
2) Surely there is some developer on here that can get to the bottom of this?! To me it is a major step backwards.
I don't think the problem is not w/ the Raspbian developers but the developers of Xorg and it's documentation. There are a lot of commands that can/could be placed in xorg.conf that only work w/ a certain driver for a certain videocard. There are old commands that are no longer supported by the latest version of Xorg, etc. etc. And some of the stuff that I enabled for my touch screen only works w/ ye good olde evdev instead of libinput. However libinput is installed by Raspbian and evdev has to be installed manually (see command above).
Asymic wrote:
Fri Jul 26, 2019 6:02 am
I have read that "Long touch is not supported on Stretch"

3) Why or how can this be? Are we expected to use the touch screen, but then when we want the mouse menu we have to get the mouse out?

I am almost tempted to find an early version of Raspbian where this does work - but I feel this is actually going against the grain.

As a last resort I had planned to use TwoFing to get round this, but I have also read that this does not work on Stretch.

4) Does TwoFing work with Stretch? Has anybody got it working?

5) Is it possible to escalate this topic so that one of the higher developers of Raspbian is aware? or are they aware anyway?

Many thanks for any answers!
The developers of Raspbian did not sell the screen. So I do not think that they are the ones to support it. It is the responsibility of an equipment manufacturer to make sure it's stuff works. I think they contracted a Linux expert at the time they started to sell said screen. That person wrote down what to do to get the screen working. And they didn't bother to hire an expert who knows the in and outs of Xorg again when Xorg and/or the Debian system changed. Shame, if you ask me. What is the official website of the screen that you bought? Are there no good instructions there?

Asymic
Posts: 29
Joined: Sun Jun 16, 2019 8:28 am

Re: [how to] enable long touch as right click

Sun Jul 28, 2019 7:15 am

Thank you for the answers above.

Xorg.conf is in /etc/X11 folder. I do begin to wonder if it is used - I now find when looking through Xorg.0.log that not all of the EmulateThirdButton commands (in Xorg.conf) are used.

I must admit I was a little surprised by your comment about contacting the manufacturer of the "official" screen. Am I wrong in assuming that this forum and the "official" display are not linked despite it being in the products section? Forgive my confusion please!

Thank you.

User avatar
MeneerJansen
Posts: 28
Joined: Sat May 14, 2016 1:51 pm

Re: [how to] enable long touch as right click

Sun Jul 28, 2019 3:20 pm

Asymic wrote:
Sun Jul 28, 2019 7:15 am
Thank you for the answers above.

Xorg.conf is in /etc/X11 folder. I do begin to wonder if it is used - I now find when looking through Xorg.0.log that not all of the EmulateThirdButton commands (in Xorg.conf) are used.
Try to move it to the directoy /etc/X11/xorg.conf.d/. Also install evdev:

Code: Select all

sudo apt-get install libevdev2 xserver-xorg-input-evdev
Asymic wrote:
Sun Jul 28, 2019 7:15 am
I must admit I was a little surprised by your comment about contacting the manufacturer of the "official" screen. Am I wrong in assuming that this forum and the "official" display are not linked despite it being in the products section? Forgive my confusion please!

Thank you.
I might be wrong but I thought that this forum is run by volunteers/amateurs. I most certainly am getting no money for posting here, nor am I in any way affiliated w/ Raspberry Pi, LCD screen manufacturers or any hardware manufacturer what so ever. I'm just a hobbyist, like many on this forum I think. :)

Good luck!

User avatar
davidcoton
Posts: 4185
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: [how to] enable long touch as right click

Sun Jul 28, 2019 6:09 pm

MeneerJansen wrote:
Sun Jul 28, 2019 3:20 pm
I might be wrong but I thought that this forum is run by volunteers/amateurs. I most certainly am getting no money for posting here, nor am I in any way affiliated w/ Raspberry Pi, LCD screen manufacturers or any hardware manufacturer what so ever. I'm just a hobbyist, like many on this forum I think. :)
The forum is maintained by RPF. All contributors are volunteers, even if they are also RPF or RPT staff. (I suspect they may use work time for some answers, but not all.)

The "official" display is indeed an RPT product.

RPT is the trading subsidiary of the RPF (charity/not for profit).
Signature retired

Asymic
Posts: 29
Joined: Sun Jun 16, 2019 8:28 am

Re: [how to] enable long touch as right click

Fri Aug 09, 2019 7:22 am

Thanks to everyone for helping here. I have now, however, loaded twofing to at least give me some mouseless fun.

If anybody has any idea who the manufacturer of the rpi screen is I will however try and contact them as suggested

User avatar
Marjorie
Posts: 5
Joined: Sun Jul 06, 2014 9:45 pm

Re: [how to] enable long touch as right click

Tue Sep 03, 2019 8:21 pm

For what it's worth:

I was able to configure the right click on touchscreen ADS7846 in Raspian Buster by creating file /etc/X11/xorg.conf with directives like this:

Code: Select all

Section "InputClass"
    Identifier "Touchscreen"
    Driver "evdev"
    MatchProduct "ADS7846"
    Option "EmulateThirdButton" "1"
    Option "EmulateThirdButtonTimeout" "750"
    Option "EmulateThirdButtonThreshold" "50"
EndSection
It seems that the directive Driver "evdev" is required to make it work.
Prior to that I also installed package evdev:

Code: Select all

sudo apt-get install libevdev2 xserver-xorg-input-evdev
(libevdev2 was already installed on my system)

Warning if you have this touchscreen (ADS7846): the official script on Github will mess your system.
Please perform manual configuration instead. Here's a guide that helped me: https://www.root42.de/blog/?p=6

modernhistorian
Posts: 4
Joined: Mon Oct 28, 2019 9:15 pm

Re: [how to] enable long touch as right click

Fri Nov 08, 2019 3:43 pm

Marjorie wrote:
Tue Sep 03, 2019 8:21 pm
For what it's worth:

I was able to configure the right click on touchscreen ADS7846 in Raspian Buster by creating file /etc/X11/xorg.conf with directives like this:

Code: Select all

Section "InputClass"
    Identifier "Touchscreen"
    Driver "evdev"
    MatchProduct "ADS7846"
    Option "EmulateThirdButton" "1"
    Option "EmulateThirdButtonTimeout" "750"
    Option "EmulateThirdButtonThreshold" "50"
EndSection
It seems that the directive Driver "evdev" is required to make it work.
Prior to that I also installed package evdev:

Code: Select all

sudo apt-get install libevdev2 xserver-xorg-input-evdev
(libevdev2 was already installed on my system)

Warning if you have this touchscreen (ADS7846): the official script on Github will mess your system.
Please perform manual configuration instead. Here's a guide that helped me: https://www.root42.de/blog/?p=6
Using Buster on a Pi3, I installed evdev and wrote xorg.conf, but no joy on long touch. could you be more specific about what manual configuration might be needed? Thanks.

User avatar
MeneerJansen
Posts: 28
Joined: Sat May 14, 2016 1:51 pm

Re: [how to] enable long touch as right click

Sat Nov 09, 2019 2:34 pm

modernhistorian wrote:
Fri Nov 08, 2019 3:43 pm
Using Buster on a Pi3, I installed evdev and wrote xorg.conf, but no joy on long touch. could you be more specific about what manual configuration might be needed? Thanks.
I think it depends on the brand of screen that you have. I think that for some screens evdev works, and for instance on the "official" Pi-screen it doesn't. Also, the various screens of different sizes do not all contain the same hardware, so that's also a factor to take into account.

Good luck! :)

Return to “Official Foundation Display”