Skip to content

Instantly share code, notes, and snippets.

@mgd722
Last active May 17, 2024 09:25
Show Gist options
  • Save mgd722/436bf5d656f3005c40a9eef2d9c31fae to your computer and use it in GitHub Desktop.
Save mgd722/436bf5d656f3005c40a9eef2d9c31fae to your computer and use it in GitHub Desktop.
Fix touchpad on Lenovo 100e running Ubuntu

Fix touchpad on Lenovo 100e running Ubuntu

So you bought a used Lenovo 100e with a stupid ELAN066C touchpad. It works in Windows just fine, other than being god-awful slow. You want to put Xubunutu on it to make it workable, except the touchpad stopped working. Ugh.

My brain is smooth, so this took me like 40+ hours to solve. I'm sure you would have solved it faster, but just in case you need help here are the steps I took to get it working. For reference, my exact computer is Lenovo 100e 2nd Gen (82GJ).


NOTE: secure boot must be disabled for this to work!

  1. Make sure this is the actual problem first: the touchpad isn't just having issues, it’s straight up not detected. ELAN066C touchpad and mouse will be missing under virtual core pointer when you run this.
xinput list
  1. If this command outputs something, the touchpad is getting loaded as a platform device. If you get no output, I'm not sure the rest of this will solve your problem.
ls -l /sys/bus/platform/devices | grep ELAN066C
  1. So we've gotta patch some shit in the kernel... I think? I am not a really a software engineer, I just do webdev and pretend I know what's up. We'll install tools and start in the temp dir.
sudo apt install acpica-tools
cd /tmp
  1. First dump the DSDT table, then decompile it.
sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
iasl -d dsdt.aml
  1. This will yield a dsdt.dsl file in the /tmp directory. We need to fix the drivers for this stupid ELAN066C touchpad. Find this line. One of the two If statements here needs to evaluate to true:
If ((^^^PCI0.LPC0.H_EC.ECRD (RefOf (^^^PCI0.LPC0.H_EC.TPTY)) == 0x01))

I just replaced the second If statement (the one that == 0x02) with an Else.

EXAMPLE OF FIXED IF/ELSE BLOCK
              If ((^^^PCI0.LPC0.H_EC.ECRD (RefOf (^^^PCI0.LPC0.H_EC.TPTY)) == 0x01))
              {
                  Name (SBFB, ResourceTemplate ()
                  {
                      I2cSerialBusV2 (0x0015, ControllerInitiated, 0x00061A80,
                          AddressingMode7Bit, "\\_SB.I2CD",
                          0x00, ResourceConsumer, , Exclusive,
                          )
                  })
                  Return (ConcatenateResTemplate (SBFB, SBFG))
              }
              Else
              {
                  Name (SBFC, ResourceTemplate ()
                  {
                      I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80,
                          AddressingMode7Bit, "\\_SB.I2CD",
                          0x00, ResourceConsumer, , Exclusive,
                          )
                  })
                  Return (ConcatenateResTemplate (SBFC, SBFG))   
              }
  1. Use the editor of your choice to edit and save dsdt.dsl following the instructions above, then compile it.
iasl -sa dsdt.dsl
  1. You may get some warnings, but no errors. It should compile and leave you with a file that should be renamed and copied to /boot.
sudo cp dsdt.aml /boot/fixed_dsdt.aml
  1. Tell grub to load this updated table on boot. Neither /boot/grub/custom.cfg nor compiling to cpio tables and specifying them in GRUB_EARLY_INITRD_LINUX_CUSTOM worked for me (no idea why not) but this does, so I gave up and do this now. Maybe it's hacky, but it works. This could mess up your boot if done wrong, and then you'd need a live USB to salvage it.
sudo sh -c "echo '# load correct acpi table on any boot\nacpi /fixed_dsdt.aml' >> /etc/grub.d/40_custom"
  1. Verify that the syntax looks good before messing up bootloading, then update grub.
cat /etc/grub.d/40_custom
sudo update-grub
  1. Reboot and the touchpad should be magically working. Be filled with regret that the process took so long to figure out.
sudo reboot now

The first two commands of this guide should return different values than they did at the start. Celebrate, or cry. I did both.


Touchpad middle button

Now that you have a working touchpad, you probably also want to fix the middle button weirdness (issue and solution both described there).

Once that's fixed, you can make it permanent by adding to Ubuntu's session and startup.

xinput set-button-map 10 1 1 3 4 5 6 7

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment