Automatically enable touchpad after suspend

Thanks!

I tried to load the batch script instead but it did not work. From the status command, I get an interesting error:

EnableTouchPad.sh[2494]: Unable to connect to X server

It is being triggered before the X server. Try to trigger it after the resume or the graphical target.

  1. Can you add user=root to your [Service] section?
  2. What does EnableTouchPad.sh do from a normal terminal? Any errors there? What is your sleep timer? 15 or less?

Got the same laptop a few days ago and have the same problem! (5.8 kernel, touchpad didn’t work OOB on lower).

Previously tried reloading psmouse module, but it had no effect - so thanks for the xinput hint, at least I can enable it manually without a restart when I need to. Looking forward to finding a solution to this issue.

As bapman is not responding, feel free to share your effort in this. What’s the output of

EnableTouchPad.sh

from a normal window and does that restore the touchpad?

Hi. I too have the same model and encountered the same issues with the touchpad after resume. I’ve updated the BIOS to the latest DMCN32WW (release date 14/07/2020) but this didn’t resolve the touchpad issues.

Running the EnableTouchPad.sh on terminal after resuming from suspend activates the touchpad. However, it doesn’t work as systemd:

EnableTouchpad.sh[30605]: Unable to connect to X server

The command seems to run before X server graphical interface is running. I’ve tried other alternatives as well.

  • Edited the enabletouchpad.service to try to apply after the graphical interface is running. Doesn’t work. Same error message “Unable to connect to X server”. My file now includes:

[Unit]
Description=Enables touchpad again after resuming
After=basic.target suspend.target hibernate.target graphical.target graphical-session.target

[Service]
User=root
Type=oneshot
Environment=DISPLAY=:0
ExecStart=/usr/local/bin/EnableTouchpad.sh

[Install]
WantedBy=basic.target suspend.target hibernate.target graphical.target graphical-session.target

I’ve managed the touchpad issue by assigning the F9 key to toggle the touchpad. Also, when the screen opens it doesn’t wake the OS. I need to press a key to wake up the device.

Other issues I’ve had with the slim 7:

Overall, the laptop is running fine for the most part. Completely idle it drains around 2.5W - 3W on battery with very dim screen. I’m using tlp and auto-cpufreq which allows the cpu to ramp up under heavy load with turbo enabled a few seconds.

2 Likes

Let’s try a radical new approach and un/reload the module for that touchpad when coming back from sleep.

As I don’t have your hardware, what’s the output to:

grep /proc/modules "touch"

:question:

cat /proc/modules |grep touch
hid_multitouch 32768 0 - Live 0x0000000000000000
hid 143360 4 hid_generic,hid_multitouch,hid_sensor_hub,i2c_hid, Live 0x0000000000000000

I’ve tried with i2c_hid. The issue I had with this one was that it stopped working after a few seconds after resuming. My inverted scrolling also had reverted to default after manually enabling the touchpad.

all out of bright ideas then…

:sob:

Thanks for trying to help.

Yes, thank you! Very weird issue, it seems that systemd does not have the right to connect to the X server. If someone finds the solution, do not hesitate to post!

the reason I wanted to take it to the module level, but as I don’t have your hardare, I need to find the module first…

:sob:

/usr/bin/restart-touchpad.sh

#!/bin/bash
echo "Restarting Touchpad just in case"
declare -x DISPLAY=":0.0"
declare -x XAUTHORITY="/home/"$USER"/.Xauthority"
xinput disable 'PNP0C50:00 06CB:CDB0 Touchpad'
xinput enable 'PNP0C50:00 06CB:CDB0 Touchpad'

(you may need to make this file executable with sudo chmod +x /usr/bin/restart-touchpad.sh)


~/.config/systemd/user/restart-touchpad.service

[Unit]
Description=Restart Touchpad
After=basic.target suspend.target hibernate.target

[Service]
Type=oneshot
Environment=DISPLAY=:0
ExecStart=/usr/bin/restart-touchpad.sh

WantedBy=basic.target suspend.target hibernate.target

Then enable it:

systemctl enable restart-touchpad.service --user --now

Let me know how it goes. I think it should work :grin:

(EDIT - it seems some users may need to replace “$USER” in the above script with their actual username to reflect the actual path, ex: /home/cscs/.Xauthority)

5 Likes

Thanks for helping out! There still seems to be an issue with the systemd service.

Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8873]: Restarting Touchpad just in case
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8874]: No protocol specified
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8874]: Unable to connect to X server
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8875]: No protocol specified
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8875]: Unable to connect to X server
Aug 23 10:59:33 yoga14s systemd[1]: enabletouchpad.service: Main process exited, code=exited, status=1/FAILURE

Anyone else with the same error messages?

The command correctly restarts the touchpad after suspend. The issue seems to be on the systemd side.

I tested this and couldnt reproduce your issue …
Are you sure its copied correctly?
It must be a user service as shown above.
Maybe also check what is

echo "$DISPLAY"

echo “$DISPLAY”
:0

I had correctly copied the content of the files.

Anyone else?

Some additional information on the drivers in case it’s useful:

sudo dmesg | egrep -i “(elan|hid|i2c)”
[ 1.924330] hid: raw HID events driver © Jiri Kosina
[ 1.963418] i2c_hid i2c-PNP0C50:00: supply vdd not found, using dummy regulator
[ 1.963447] i2c_hid i2c-PNP0C50:00: supply vddl not found, using dummy regulator
[ 1.998501] i2c_hid i2c-ITE8353:00: supply vdd not found, using dummy regulator
[ 1.998515] i2c_hid i2c-ITE8353:00: supply vddl not found, using dummy regulator
[ 2.490113] i2c_hid i2c-PNP0C50:00: failed to retrieve report from device.
[ 2.490179] input: PNP0C50:00 06CB:CDB0 Mouse as /devices/platform/AMDI0010:00/i2c-0/i2c-PNP0C50:00/0018:06CB:CDB0.0001/input/input12
[ 2.490353] input: PNP0C50:00 06CB:CDB0 Touchpad as /devices/platform/AMDI0010:00/i2c-0/i2c-PNP0C50:00/0018:06CB:CDB0.0001/input/input13
[ 2.490464] hid-generic 0018:06CB:CDB0.0001: input,hidraw0: I2C HID v1.00 Mouse [PNP0C50:00 06CB:CDB0] on i2c-PNP0C50:00
[ 2.491079] hid-generic 0018:048D:8353.0002: hidraw1: I2C HID v1.00 Device [ITE8353:00 048D:8353] on i2c-ITE8353:00
[ 2.545474] i2c_hid i2c-PNP0C50:00: failed to retrieve report from device.
[ 2.545534] input: PNP0C50:00 06CB:CDB0 Mouse as /devices/platform/AMDI0010:00/i2c-0/i2c-PNP0C50:00/0018:06CB:CDB0.0001/input/input15
[ 2.545593] input: PNP0C50:00 06CB:CDB0 Touchpad as /devices/platform/AMDI0010:00/i2c-0/i2c-PNP0C50:00/0018:06CB:CDB0.0001/input/input16
[ 2.545628] hid-multitouch 0018:06CB:CDB0.0001: input,hidraw0: I2C HID v1.00 Mouse [PNP0C50:00 06CB:CDB0] on i2c-PNP0C50:00
[ 3.610592] Modules linked in: amd64_edac_mod(-) bnep uvcvideo btusb btrtl videobuf2_vmalloc btbcm videobuf2_memops videobuf2_v4l2 btintel videobuf2_common bluetooth videodev mc ecdh_generic ecc squashfs hid_sensor_als hid_sensor_trigger industrialio_triggered_buffer kfifo_buf hid_sensor_iio_common loop joydev mousedev industrialio hid_multitouch hid_sensor_hub snd_acp3x_pdm_dma snd_acp3x_rn snd_soc_dmic hid_generic wmi_bmof snd_soc_core snd_compress ac97_bus amdgpu snd_pcm_dmaengine iwlmvm nls_iso8859_1 mac80211 nls_cp437 snd_hda_codec_realtek edac_mce_amd vfat kvm_amd snd_hda_codec_generic ledtrig_audio fat kvm snd_hda_codec_hdmi libarc4 gpu_sched snd_hda_intel i2c_algo_bit snd_intel_dspcfg snd_hda_codec ttm irqbypass iwlwifi snd_hda_core drm_kms_helper snd_hwdep crct10dif_pclmul snd_pcm crc32_pclmul ghash_clmulni_intel aesni_intel cec snd_timer crypto_simd cryptd rc_core ideapad_laptop glue_helper cfg80211 sparse_keymap rapl syscopyarea input_leds pcspkr snd sysfillrect sysimgblt
[ 3.610618] tpm_crb k10temp fb_sys_fops sp5100_tco ccp soundcore snd_rn_pci_acp3x ucsi_acpi i2c_piix4 snd_pci_acp3x rfkill typec_ucsi tpm_tis typec evdev wmi battery i2c_hid mac_hid tpm_tis_core hid acpi_cpufreq tpm pinctrl_amd rng_core ac drm uinput sg crypto_user agpgart ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 serio_raw atkbd libps2 xhci_pci xhci_pci_renesas crc32c_intel xhci_hcd i8042 serio

lsmod | egrep -i “(elan|hid|i2c)”
hid_sensor_als 20480 0
hid_sensor_trigger 20480 2 hid_sensor_als
industrialio_triggered_buffer 16384 1 hid_sensor_trigger
hid_sensor_iio_common 20480 2 hid_sensor_trigger,hid_sensor_als
industrialio 90112 4 industrialio_triggered_buffer,hid_sensor_trigger,kfifo_buf,hid_sensor_als
hid_multitouch 32768 0
hid_sensor_hub 24576 3 hid_sensor_trigger,hid_sensor_iio_common,hid_sensor_als
hid_generic 16384 0
i2c_algo_bit 16384 1 amdgpu
i2c_piix4 28672 0
i2c_hid 32768 0
mac_hid 16384 0
hid 143360 4 i2c_hid,hid_multitouch,hid_sensor_hub,hid_generic

ls -l /sys/bus/i2c/devices/
total 0
lrwxrwxrwx 1 root root 0 Aug 23 10:42 i2c-0 -> …/…/…/devices/platform/AMDI0010:00/i2c-0
lrwxrwxrwx 1 root root 0 Aug 23 10:42 i2c-1 -> …/…/…/devices/platform/AMDI0010:03/i2c-1
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-2 -> …/…/…/devices/pci0000:00/0000:00:14.0/i2c-2
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-3 -> …/…/…/devices/pci0000:00/0000:00:14.0/i2c-3
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-4 -> …/…/…/devices/pci0000:00/0000:00:14.0/i2c-4
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-5 -> …/…/…/devices/pci0000:00/0000:00:08.1/0000:03:00.0/i2c-5
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-6 -> …/…/…/devices/pci0000:00/0000:00:08.1/0000:03:00.0/i2c-6
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-7 -> …/…/…/devices/pci0000:00/0000:00:08.1/0000:03:00.0/i2c-7
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-8 -> …/…/…/devices/pci0000:00/0000:00:08.1/0000:03:00.0/drm/card0/card0-eDP-1/i2c-8
lrwxrwxrwx 1 root root 0 Aug 23 11:06 i2c-9 -> …/…/…/devices/pci0000:00/0000:00:08.1/0000:03:00.0/drm/card0/card0-DP-1/i2c-9
lrwxrwxrwx 1 root root 0 Aug 23 10:42 i2c-ITE8353:00 -> …/…/…/devices/platform/AMDI0010:03/i2c-1/i2c-ITE8353:00
lrwxrwxrwx 1 root root 0 Aug 23 10:42 i2c-PNP0C50:00 -> …/…/…/devices/platform/AMDI0010:00/i2c-0/i2c-PNP0C50:00

Other Ideapad models seem to have issues with drivers but this one doesn’t seem to use elants - https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_5_15are05#Touchpad`

A quick thing to check… … can you edit the script and replace “$USER” with your actual username and check that ? (so that it reflects the actual path, ex - /home/cscs/.Xauthority)

Yes!!! It works! Thank you, thank you, thank you! :grinning: :grinning:

Hm. Yeah thats more sure… but I thought I had gotten it with the env var … owell
but hey … glad it worked in the end :slight_smile:
cheers!