galliumos-distro
galliumos-distro copied to clipboard
Possible workaround for Elan Touchpad driver failing
Acer Chromebook 14 (Edgar) with MrChromeBox Legacy firmware.
NAME="GalliumOS" VERSION="3.1 (Bismuth)" ID=galliumos ID_LIKE="ubuntu debian" PRETTY_NAME="GalliumOS 3.1" VERSION_ID="3.1" HOME_URL="https://galliumos.org/" SUPPORT_URL="https://galliumos.org/" BUG_REPORT_URL="https://https://github.com/GalliumOS/galliumos-distro/issues" VERSION_CODENAME=bismuth UBUNTU_CODENAME=bionic
Problem: My Elan Touchpad driver fails after some time. In my experience, this happens after many hours of usage. None of the solutions proposed in https://github.com/GalliumOS/galliumos-distro/issues/539 work for me. I didn't put this idea in that discussion because it is a hack and not a true fix and I didn't want to muddy the waters.
Since I am lucky (unlucky?) enough to only be affected after many hours (and not minutes) I decided it was best--in absence of a true fix--to simply reload the elan driver. However, doing so on a set schedule via cron job seemed inelegant. I also didn't want my touchpad to "cut out" briefly every 10 (20/30/60 or whatever) minutes. I want this reload of touchpad module to be as invisible as possible.
Solution that works for me: This band-aid works so well for me that I never experience any issues with the Elan Touchpad dying; in fact, I essentially forget that I have an issue at all.
What I do is simply reload the 'elan_i2c' driver after every "resume from sleep" using a script in "/var/systemd/system-sleep". This script will unload/load the driver when my Chromebook resumes from sleep, driven by the systemd module.
Note: this solution is similar to the "/lib/systemd/system-sleep/wifi.sh" script, which is provided by the package "galliumos-braswell". This script (also run upon resume from sleep) unloads and reloads the wifi modules.
The good stuff: Create a script named "/lib/systemd/system-sleep/reload-elan-driver". Make it executable and owned by root. Add the following:
#!/bin/sh
#
# For some ChromiumOS 3.x systems experiencing issues
# with Elan touchpad driver dying.
#
# This script reloads the elan touchpad driver after
# resume from suspend, simply to keep driver "fresh".
#
# Place this script in:
# /lib/systemd/system-sleep
tag="elan-reload"
case $1 in
post)
# Bounce the elan_i2c module on resume
/sbin/modprobe -r elan_i2c && \
/sbin/modprobe -q elan_i2c
if test "$?" = "0" ; then
logger -t $tag "Elan Touchpad Driver reloaded successfully"
else
logger -t $tag "ERROR reloading Elan Touchpad Driver!"
fi
;;
esac
exit 0
Now, when your Chromebook resumes from sleep, systemd runs the above script and bounces the elan_i2c module. You should never notice it happening!
Disclosure: This may not work for you if you experience frequent touchpad failures or you rarely suspend your laptop. I use my Edgar extensively (hours every day) but rarely go longer than 4-6 hours before closing the lid or letting it suspend by itself. If your elan touchpad dies more frequently, you may consider using the above script in a different manner; eg from a shorter-interval cron job or similar.
Hope this helps!
But! what if your Elan touchpad fails before "systemd-sleep" or a cron job gets triggered? Here is a manual fail-safe (a workaround for the above workaround...):
Create the following script, place it in your PATH and make executable:
#!/usr/bin/env bash
# filename: tpfix
/usr/bin/sudo /sbin/modprobe -r elan_i2c
rc="${?}"
if [[ "${rc}" -eq 0 ]]; then
/usr/bin/sudo /sbin/modprobe elan_i2c
fi
exit 0
Give your $USER "sudo NOPASSWD" permissions to execute "/sbin/modprobe -r elan_i2c" and "/sbin/modprobe elan_i2c" (a file in "/etc/sudoers.d/"):
<Your_username> ALL= NOPASSWD:/sbin/modprobe -r elan_i2c, /sbin/modprobe elan_i2c
Now you can execute the above script from the command line without entering a password for sudo.
Next, assign a keyboard shortcut to this script. In XFCE, look to "Keyboard --> Application Shortcuts." On my system I assigned the following:
/home/kinggrowler/.local/share/bin/tpfix --> Ctrl-Alt-E
Now, if I need to manually reload the drivers I simply enter the keyboard combo: Ctrl-Alt-E and my elan_i2c module is reloaded.
...But my original idea above using "systemd-sleep" is so effective I never have to manually bounce the module, however for people with frequent touchpad crashes, a manual bounce may be useful.
Thanks this worked great!!!
Thanks this worked great!!!
Awesome, thanks for the feedback!
First of all, thanks so much for your input! The sleep script alone has been tremendously helpful. But I still deal with the occasional issue while I'm using the Chromebook, and I can't seem to get the manual script setup properly. I've created the script, named it tpfix, made it executable, and placed it in /home/lukewarmpocket/.local/share/bin. However, when I attempt to run
ALL= NOPASSWD:/sbin/modprobe -r elan_i2c, /sbin/modprobe elan_i2c
it returns
bash: NOPASSWD:/sbin/modprobe: No such file or directory
What am I doing wrong? I'm sorry if this is a silly question, but I've tried reading and troubleshooting on my own and came up with nothing.
Wait a minute, Luke I was in your 8th grade science class!
I don't have an Edgar handy to test, but if you grep -ir elan /etc/
or specifically against /etc/udev/
does it return any results?
I don't have an Edgar handy to test, but if you
grep -ir elan /etc/
or specifically against/etc/udev/
does it return any results?
Ethan, here are the results of running grep for /etc/, both with and without sudo. grep for udev returned nothing.
/etc/locale.alias:icelandic is_IS.ISO-8859-1 grep: /etc/sudoers.d/README: Permission denied grep: /etc/polkit-1/localauthority: Permission denied grep: /etc/security/opasswd: Permission denied grep: /etc/ppp/pap-secrets: Permission denied grep: /etc/ppp/chap-secrets: Permission denied grep: /etc/gshadow: Permission denied /etc/login.defs:# enable the equivelants of them. grep: /etc/ssl/private: Permission denied grep: /etc/sudoers: Permission denied /etc/sound/events/gnome-2.soundlist:description[sv]=Informativt meddelande /etc/sound/events/gnome-2.soundlist:description[sv]=Varningsmeddelande /etc/sound/events/gnome-2.soundlist:description[sv]=Felmeddelande /etc/sound/events/gnome-2.soundlist:description[sv]=Diversemeddelande grep: /etc/NetworkManager/system-connections/NETGEAR99-5G: Permission denied grep: /etc/NetworkManager/system-connections/Pixel 3 XL: Permission denied grep: /etc/NetworkManager/system-connections/NETGEAR46: Permission denied grep: /etc/NetworkManager/system-connections/NETGEAR99: Permission denied grep: /etc/.pwd.lock: Permission denied grep: /etc/shadow-: Permission denied grep: /etc/shadow: Permission denied /etc/mime.types:application/vnd.lotus-freelance grep: /etc/gshadow-: Permission denied grep: /etc/cups/subscriptions.conf.O: Permission denied grep: /etc/cups/printers.conf: Permission denied grep: /etc/cups/printers.conf.O: Permission denied grep: /etc/cups/ssl: Permission denied grep: /etc/cups/ppd/CANON-MX920.ppd: Permission denied grep: /etc/cups/classes.conf: Permission denied grep: /etc/cups/subscriptions.conf: Permission denied /etc/skel/.kodi/userdata/guisettings.xml: <subtitlelanguage `default="true">original
/etc/locale.alias:icelandic is_IS.ISO-8859-1
/etc/login.defs:# enable the equivelants of them.
/etc/sound/events/gnome-2.soundlist:description[sv]=Informativt meddelande
/etc/sound/events/gnome-2.soundlist:description[sv]=Varningsmeddelande
/etc/sound/events/gnome-2.soundlist:description[sv]=Felmeddelande
/etc/sound/events/gnome-2.soundlist:description[sv]=Diversemeddelande
/etc/mime.types:application/vnd.lotus-freelance
/etc/skel/.kodi/userdata/guisettings.xml:
Luke, I'm confused when you say you run this in bash:
ALL= NOPASSWD:/sbin/modprobe -r elan_i2c, /sbin/modprobe elan_i2c
You should not type that command, but simply add that line to your sudoers file, or create a new sudoers file in /etc/sudoers.d.
So, for example, you could create a new file in /etc/sudoers.d/luke-nopasswd, and add the following as described above:
luke ALL= NOPASSWD:/sbin/modprobe -r elan_i2c, /sbin/modprobe elan_i2c
We do this because otherwise the "luke" user does not have permission to use the modprobe command as we need.
Hope this helps!