bedtime
Posts: 66
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: 22
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: 2
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: 22
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: 2
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: 22
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: 2
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: 22
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.

Return to “Official Foundation Display”