LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 01-16-2017, 04:14 PM   #1
silvanm
LQ Newbie
 
Registered: Sep 2012
Posts: 11

Rep: Reputation: Disabled
Touchscreen race condition


Hello

I have a problem with the touchscreen of my new convertible. If I do a touch and the previous touch was just moments ago, everything works fine. However, if the previous touch was about 3 seconds or more ago and I do a touch, only the touchdown event gets triggered and the touch doesn't get released (resulting in a right click after a moment).
I am using debian with gnome at the moment, but a quick test with fedora gave exactly the same behavior. Depending on the time difference to the previous touch, the touch gets handled correctly or just the touchdown event is recognized.
It seems to be a race condition, because if I do a long touch (about 0.5s), it works independent of the delay to the previous touch. I assume something switches back to touchpad mode after 3 seconds and is then too slow to switch to touchscreen mode again. However, disabling the touchpad or unloading the psmouse driver did not help.

Does anybody have an idea how to fix this? It's pretty annoying because it makes my touchscreen useless.

Thanks for any help!
 
Old 01-16-2017, 04:30 PM   #2
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
More information would be helpful... Like the make/model of the convertible and the chipset of the touch controller...
 
Old 01-16-2017, 04:40 PM   #3
silvanm
LQ Newbie
 
Registered: Sep 2012
Posts: 11

Original Poster
Rep: Reputation: Disabled
The convertible is a Lenovo Yoga 710 14''

Code:
silvan@deblap2:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0cf3:e300 Atheros Communications, Inc. 
Bus 001 Device 002: ID 13d3:5673 IMC Networks 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
silvan@deblap2:~$ lspci
00:00.0 Host bridge: Intel Corporation Device 5904 (rev 02)
00:02.0 VGA compatible controller: Intel Corporation Device 5916 (rev 02)
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)
00:15.1 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #1 (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
00:1c.0 PCI bridge: Intel Corporation Device 9d10 (rev f1)
00:1c.5 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #6 (rev f1)
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)
00:1e.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO UART Controller #0 (rev 21)
00:1f.0 ISA bridge: Intel Corporation Device 9d58 (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Device 9d71 (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
01:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
02:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader (rev 01)
silvan@deblap2:~$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ SYNA7501:00 06CB:16D3                   	id=11	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=14	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Video Bus                               	id=8	[slave  keyboard (3)]
    ↳ Power Button                            	id=9	[slave  keyboard (3)]
    ↳ EasyCamera                              	id=10	[slave  keyboard (3)]
    ↳ Ideapad extra buttons                   	id=12	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=13	[slave  keyboard (3)]
silvan@deblap2:~$ lsmod
Module                  Size  Used by
ctr                    16384  4
ccm                    20480  2
fuse                   98304  3
rfcomm                 77824  2
arc4                   16384  2
bnep                   20480  2
snd_hda_codec_hdmi     45056  1
snd_hda_codec_generic    69632  1
hid_sensor_als         16384  0
hid_sensor_accel_3d    16384  0
hid_sensor_trigger     16384  4 hid_sensor_als,hid_sensor_accel_3d
hid_sensor_iio_common    16384  3 hid_sensor_als,hid_sensor_accel_3d,hid_sensor_trigger
industrialio_triggered_buffer    16384  2 hid_sensor_als,hid_sensor_accel_3d
kfifo_buf              16384  1 industrialio_triggered_buffer
industrialio           65536  5 hid_sensor_als,hid_sensor_accel_3d,hid_sensor_trigger,industrialio_triggered_buffer,kfifo_buf
hid_multitouch         20480  0
hid_sensor_hub         20480  4 hid_sensor_als,hid_sensor_accel_3d,hid_sensor_iio_common,hid_sensor_trigger
nls_ascii              16384  1
nls_cp437              20480  1
vfat                   20480  1
fat                    69632  1 vfat
snd_soc_skl            65536  0
snd_soc_skl_ipc        40960  1 snd_soc_skl
snd_soc_sst_ipc        16384  1 snd_soc_skl_ipc
snd_soc_sst_dsp        28672  1 snd_soc_skl_ipc
snd_hda_ext_core       28672  1 snd_soc_skl
snd_soc_sst_match      16384  1 snd_soc_skl
intel_rapl             20480  0
i2c_designware_platform    16384  0
i2c_designware_core    20480  1 i2c_designware_platform
x86_pkg_temp_thermal    16384  0
intel_powerclamp       16384  0
snd_soc_core          212992  1 snd_soc_skl
coretemp               16384  0
snd_compress           20480  1 snd_soc_core
efi_pstore             16384  0
kvm                   585728  0
irqbypass              16384  1 kvm
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
ath10k_pci             45056  0
ath10k_core           245760  1 ath10k_pci
ath                    32768  1 ath10k_core
nouveau              1544192  1
mac80211              651264  1 ath10k_core
ghash_clmulni_intel    16384  0
evdev                  24576  15
joydev                 20480  0
rtsx_pci_ms            20480  0
cfg80211              573440  3 mac80211,ath,ath10k_core
snd_hda_intel          36864  8
serio_raw              16384  0
pcspkr                 16384  0
snd_hda_codec         131072  3 snd_hda_intel,snd_hda_codec_hdmi,snd_hda_codec_generic
efivars                20480  1 efi_pstore
snd_hda_core           81920  6 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_soc_skl,snd_hda_codec_hdmi,snd_hda_codec_generic
memstick               20480  1 rtsx_pci_ms
mxm_wmi                16384  1 nouveau
snd_hwdep              16384  1 snd_hda_codec
iTCO_wdt               16384  0
snd_pcm               110592  8 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_hda_core,snd_soc_skl,snd_hda_codec_hdmi,snd_soc_core
iTCO_vendor_support    16384  1 iTCO_wdt
ttm                    98304  1 nouveau
i915                 1282048  16
hci_uart               90112  0
btqca                  16384  1 hci_uart
btusb                  45056  0
uvcvideo               90112  0
btrtl                  16384  1 btusb
snd_timer              32768  1 snd_pcm
btbcm                  16384  2 hci_uart,btusb
btintel                16384  2 hci_uart,btusb
snd                    86016  24 snd_compress,snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_soc_core,snd_pcm
soundcore              16384  1 snd
videobuf2_vmalloc      16384  1 uvcvideo
videobuf2_memops       16384  1 videobuf2_vmalloc
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_core         36864  2 uvcvideo,videobuf2_v4l2
videodev              176128  3 uvcvideo,videobuf2_core,videobuf2_v4l2
drm_kms_helper        155648  2 nouveau,i915
idma64                 20480  0
media                  40960  2 uvcvideo,videodev
virt_dma               16384  1 idma64
sg                     32768  0
bluetooth             544768  33 btrtl,hci_uart,btintel,btqca,bnep,btbcm,rfcomm,btusb
drm                   360448  12 nouveau,i915,ttm,drm_kms_helper
mei_me                 36864  0
intel_pch_thermal      16384  0
mei                   102400  1 mei_me
shpchp                 36864  0
i2c_algo_bit           16384  2 nouveau,i915
intel_lpss_pci         16384  0
ideapad_laptop         24576  0
sparse_keymap          16384  1 ideapad_laptop
rfkill                 24576  8 bluetooth,ideapad_laptop,cfg80211
battery                16384  0
ac                     16384  0
wmi                    16384  3 mxm_wmi,nouveau,ideapad_laptop
video                  40960  3 nouveau,i915,ideapad_laptop
intel_lpss_acpi        16384  0
intel_lpss             16384  2 intel_lpss_pci,intel_lpss_acpi
acpi_pad               24576  0
tpm_crb                16384  0
button                 16384  2 nouveau,i915
tpm_tis                16384  0
tpm_tis_core           20480  1 tpm_tis
tpm                    45056  3 tpm_tis,tpm_crb,tpm_tis_core
efivarfs               16384  1
ip_tables              24576  0
x_tables               36864  1 ip_tables
autofs4                40960  2
ext4                  585728  1
crc16                  16384  2 bluetooth,ext4
jbd2                  106496  1 ext4
crc32c_generic         16384  0
fscrypto               28672  1 ext4
ecb                    16384  0
mbcache                16384  2 ext4
sd_mod                 45056  3
rtsx_pci_sdmmc         24576  0
mmc_core              143360  1 rtsx_pci_sdmmc
crc32c_intel           24576  2
ahci                   36864  2
libahci                32768  1 ahci
aesni_intel           167936  4
aes_x86_64             20480  1 aesni_intel
libata                249856  2 ahci,libahci
glue_helper            16384  1 aesni_intel
lrw                    16384  1 aesni_intel
gf128mul               16384  1 lrw
ablk_helper            16384  1 aesni_intel
cryptd                 24576  3 ablk_helper,ghash_clmulni_intel,aesni_intel
psmouse               135168  0
i2c_i801               24576  0
xhci_pci               16384  0
scsi_mod              225280  3 sd_mod,libata,sg
i2c_smbus              16384  1 i2c_i801
xhci_hcd              188416  1 xhci_pci
rtsx_pci               57344  2 rtsx_pci_sdmmc,rtsx_pci_ms
mfd_core               16384  3 hid_sensor_hub,rtsx_pci,intel_lpss
usbcore               249856  4 uvcvideo,xhci_pci,btusb,xhci_hcd
usb_common             16384  1 usbcore
fan                    16384  0
thermal                20480  0
i2c_hid                20480  0
hid                   118784  3 hid_sensor_hub,i2c_hid,hid_multitouch
fjes                   28672  0
 
Old 01-16-2017, 05:39 PM   #4
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
It seems a lot of the people installing Linux on that machine simply blacklisted the touchscreen driver to get it to even install. Someone else blacklisted the tilt sensors...

See here: https://forums.lenovo.com/t5/forums/...id/7958/page/4
 
Old 01-17-2017, 01:36 AM   #5
silvanm
LQ Newbie
 
Registered: Sep 2012
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks for your research. I had similar problems like the people in this thread with experiencing kernel panics (Arch Linux and Fedora). However, the newest Debian testing version worked out of the box without any troubles including screen rotation, keyboard auto-disable etc. except for this touchscreen-bug.

Blacklisting the tile sensors did not help unfortunately.
 
Old 01-20-2017, 07:32 AM   #6
silvanm
LQ Newbie
 
Registered: Sep 2012
Posts: 11

Original Poster
Rep: Reputation: Disabled
I managed to boot arch linux now without kernel panic. Unfortunately, I experienced exactly the same behaviour as I currenty do with debian.

Any help would be appreciated
 
Old 01-20-2017, 10:38 AM   #7
silvanm
LQ Newbie
 
Registered: Sep 2012
Posts: 11

Original Poster
Rep: Reputation: Disabled
For those struggling with the same problem: I found a (hacked) workaround. I wrote a little program that analyzes the output of the driver. If within the last 150ms nothing happened, but the touchscreen still says that the touch is active, the program simulates a touch-release event.

The code is here:
Code:
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <linux/input.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>


int main (void) {

	int active = 0;
	struct input_event history[3];
	
	struct timeval dummy;
	struct input_event stop0 = {dummy, 3, 57, -1};
	struct input_event stop1 = {dummy, 1, 330, 0};
	struct input_event stop2 = {dummy, 0, 0, 0};

	int fp;
	struct input_event event;

	fp = open("/dev/input/event10", O_RDWR);
	if(fp < 0) {
		printf("Need to be root\n");
		return -1;
	}

	
	while(1) {

		fd_set set;
		struct timeval timeout;
	
		if(!active) {
			timeout.tv_sec = 5;
			timeout.tv_usec = 0;
		}
		else {
			timeout.tv_sec = 0;
			timeout.tv_usec = 150000;
		}
	
		FD_ZERO (&set);
		FD_SET(0, &set);
		FD_SET(fp, &set);


		if(select(fp+1, &set, NULL, NULL, &timeout)) {
			read(fp, &event, sizeof(event));
			//printf("Event type: %i, code: %i, value: %i\n", event.type, event.code, event.value);
			history[2] = history[1];
			history[1] = history[0];
			history[0] = event;
			active = 1;
			if(history[0].type == 0 && history[0].code == 0 && history[0].value == 0) {
				if(history[1].type == 1 && history[1].code == 330 && history[1].value == 0) {
					if(history[2].type == 3 && history[2].code == 57 && history[2].value == -1) {
						active = 0;
					}
				}
			}
		}
		else {
			//printf("Timeout\n");
			if(active) {
				//printf ("BUT STILL ACTIVE!");
				stop0.time = history[0].time;
				stop1.time = history[0].time;
				stop1.time.tv_usec+=100;
				stop2.time = history[0].time;
				stop2.time.tv_usec+=200;
				write(fp, &stop0, sizeof(stop0));
				write(fp, &stop1, sizeof(stop1));
				write(fp, &stop2, sizeof(stop2));
				active = 0;
			}
		}
		
		
	
	}

	
	close(fp);

	return 0;

}
As can be seen, the program uses the device file in /dev to analyze the output and simulate new input. The event-number should be adopted to fit your system.

It's just an ugly hack, but works more or less for me. Anyways, if somebody could find a solution that fixes the driver or whatever is the problem, this would of course be much nicer.
 
Old 01-20-2017, 10:51 AM   #8
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
I had just noticed this last night on my new ThinkPad Yoga, with the stylus as well, so you are not alone. I haven't had a chance to play, but now that I know I'm not alone I'll research further, let you know what I come up with if I have the time.
 
Old 01-20-2017, 11:35 AM   #9
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
... shot in the dark, here ... : The behaviour you're describing reminds me of an issue I had with another type of device where the power management software was suspending certain peripherals after a few seconds of inactivity. I was able to control this with powertop. ... Might be worth a look ...

Best -
 
Old 01-21-2017, 02:43 PM   #10
silvanm
LQ Newbie
 
Registered: Sep 2012
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks a lot, that worked!

I disabled "Runtime PM for I2C Adapter i2c-10 (Synopsys DesignWare I2C adapter)" in powertop and now my touchscreen works flawless, even without the script. I hope the touchscreen does not drain my battery too much, but if this would be the case I could also manually turn it off and on.

Anyways, thanks for the hint, that was great.
 
Old 01-21-2017, 04:14 PM   #11
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by silvanm View Post
Thanks a lot, that worked!

I disabled "Runtime PM for I2C Adapter i2c-10 (Synopsys DesignWare I2C adapter)" in powertop and now my touchscreen works flawless, even without the script. I hope the touchscreen does not drain my battery too much, but if this would be the case I could also manually turn it off and on.

Anyways, thanks for the hint, that was great.
Cool - glad I could help you in finding the solution, silvanm. For better general battery-saving and power management performance, I've found laptop-mode-tools and xfce4-power-manager useful, even with DE's that come with their own PM stuff (i.e. Gnome). Depending on your hardware, your mileage may vary, and of course powertop remains a useful troubleshooting and fine-tuning tool.

Cheers :-)

Last edited by Rickkkk; 01-21-2017 at 04:18 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
race condition in gethostbyname_r dcds Linux - Server 7 02-16-2015 03:39 AM
What is race condition? LinuxInfo Programming 1 09-15-2008 09:44 PM
Kded race condition during automounting SpelledJ Slackware 6 10-25-2007 01:51 PM
Race condition in /etc/rc.d/ with latest -current ? Yalla-One Slackware 1 08-06-2006 02:23 PM
race condition in close socket?? jwstric2 Programming 3 03-18-2005 05:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 11:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration