Thursday, April 17, 2014

Fixing Touchpad on Acer 720p Chromebook for Kali 1.06

I updated my kali 1.05 install to kali 1.06 by using the apt-get dist-upgrade.  I ran into a few problems but was able to follow the error message output to fix it.  Now I'm ready to patch some kernel drivers to support the touchpad.  Specifically
  • drivers/platform/x86/chromeos_laptop.c
  • drivers/i2c/busses/i2c_designware-pci.c
The script also copies i2c_designware-core.ko and tries to copy i2c_designware-platform.ko .  The first file did not seem to be patches, and the second did not exist on my machine.

There are good directions here, which also deal with suspend problems.  I haven't tried to suspend yet, but I can guess that there may be problems.  The script here was set up for Ubuntu 13.10 or newer, so it did not work.  It failed trying to download the linux kernel source.

Here's the script for reference. 

# Create a temp directory for our work
tempbuild=`mktemp -d`
cd $tempbuild

# Determine kernel version (with and without Ubuntu-specific suffix)
mykern=${1:-$(uname -r)}
mykernver=linux-$(echo $mykern | cut -d'-' -f 1)

# Install necessary deps to build a kernel
sudo apt-get build-dep -y --no-install-recommends linux-image-$mykern

# Grab Ubuntu kernel source
apt-get source linux-image-$mykern
cd $mykernver

if [ -f drivers/platform/x86/chromeos_laptop.c ]; then
  platform_folder=x86
elif [ -f drivers/platform/chrome/chromeos_laptop.c ]; then
  platform_folder=chrome
fi

# Use Benson Leung's post-Pixel Chromebook patches:
# https://patchwork.kernel.org/bundle/bleung/chromeos-laptop-deferring-and-haswell/
for patch in 3078491 3078481 3074391 3074441 3074421 3074401 3074431 3074411; do
  wget -O - https://patchwork.kernel.org/patch/$patch/raw/ \
  | sed "s/drivers\/platform\/x86\/chromeos_laptop.c/drivers\/platform\/$platform_folder\/chromeos_laptop.c/g" \
  | patch -p1
done

# Need this
cp /usr/src/linux-headers-$mykern/Module.symvers .

# Prep tree
cp /boot/config-$mykern ./.config
make oldconfig
make prepare
make modules_prepare

# Build only the needed directories
make SUBDIRS=drivers/platform/$platform_folder modules
make SUBDIRS=drivers/i2c/busses modules

# switch to using our new chromeos_laptop.ko module
# preserve old as .orig
sudo mv /lib/modules/$mykern/kernel/drivers/platform/$platform_folder/chromeos_laptop.ko /lib/modules/$mykern/kernel/drivers/platform/$platform_folder/chromeos_laptop.ko.orig
sudo cp drivers/platform/$platform_folder/chromeos_laptop.ko /lib/modules/$mykern/kernel/drivers/platform/$platform_folder/

# switch to using our new designware i2c modules
# preserve old as .orig
sudo mv /lib/modules/$mykern/kernel/drivers/i2c/busses/i2c-designware-core.ko /lib/modules/$mykern/kernel/drivers/i2c/busses/i2c-designware-core.ko.orig
sudo mv /lib/modules/$mykern/kernel/drivers/i2c/busses/i2c-designware-pci.ko /lib/modules/$mykern/kernel/drivers/i2c/busses/i2c-designware-pci.ko.orig
sudo mv /lib/modules/$mykern/kernel/drivers/i2c/busses/i2c-designware-platform.ko /lib/modules/$mykern/kernel/drivers/i2c/busses/i2c-designware-platform.ko.orig
sudo cp drivers/i2c/busses/i2c-designware-*.ko /lib/modules/$mykern/kernel/drivers/i2c/busses/
sudo depmod -a $mykern
echo "Finished building Chromebook modules in $tempbuild. Reboot to use them."
 

I had problems with this, so I basically went through the commands one at a time manually.  The tricky part was patching.  I have never done this before.  When I finished, my chromeos_laptop.c file had some structs inserted inside of other structs.  I copy/pasted them outside the structs and then the make command worked.  After that, I copied chromeos_laptop.ko, i2c_designware-core.ko, and i2c_designware-pci.ko to the right directories, ran depmod -a 3.12-kali1-amd64, and rebooted.

The trackpad worked, but sporadically.  I followed the next part of the directions and had to paste these lines into my  /usr/share/X11/xorg.conf.d/50-synaptics.conf  file in the "InputClass" section.
Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Option "FingerLow" "10"
        Option "FingerHigh" "16"
EndSection

Most of the lines were there, so I just had to add:

        MatchDevicePath "/dev/input/event*"
        Option "FingerLow" "10"
        Option "FingerHigh" "16"
 
Now, I have to figure out how to get tap-to-click to work.  Currently, I have to click the touchpad to get right and left clicks.

Well...that was easy.  Applications | System Tools | Preferences | System Settings.  In that window, click on the Touchpad tab.  Check "Enable mouse clicks with touchpad" to enable tap-to-click.


 

No comments:

Post a Comment