Skip to content

Instantly share code, notes, and snippets.

@fbrozovic
Last active April 30, 2020 23:53
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save fbrozovic/9102118 to your computer and use it in GitHub Desktop.
Save fbrozovic/9102118 to your computer and use it in GitHub Desktop.

Debian on ThinkPad W540

This is a short write-up of my experiences with installing Debian on a ThinkPad W540.

All commands should be run as root, unless indicated otherwise.

Table of Contents

Debian Install Notes

NVIDIA Graphics Driver

LCD Brightness Keys

ClickPad Configuration

Fingerprint Sensor (VFS5011)

## Debian Install Notes

With debian-testing-amd64-netinst.iso (from 20140217), when installing from an USB stick created with Rufus, the installation failed with an error saying that no package sources were configured. Burning the same ISO to a CD and installing from it solved the problem.

## NVIDIA Graphics Driver

After installing the system and booting into the system for the first time, we are going to install the graphics drivers for the Quadro K1100M/K2100M:

  • Add the non-free and contrib repositories to /etc/apt/sources.list
  • Add multiarch support for i386: dpkg --add-architecture i386
  • Run apt-get update and install the necessary packages: apt-get install nvidia-kernel-dkms bumblebee-nvidia primus primus-libs:i386
  • Add users to the bumblebee group with adduser $USER bumblebee
  • Reboot and check whether GPU switching works:
  # cat /proc/acpi/bbswitch
  0000:01:00.0 OFF
  # echo ON > /proc/acpi/bbswitch && cat /proc/acpi/bbswitch
  0000:01:00.0 ON
  # echo OFF > /proc/acpi/bbswitch
  • If GPU switching works, edit /etc/bumblebee/bumblebee.conf and change the following two lines:
  Driver = nvidia
  KernelDriver = nvidia-current
  • Reboot and check whether optirun works with optirun glxgears. If there are no errors on the console, bumblebee is now correctly configured!
## LCD Brightness Keys

Most likely, the brightness keys will not work out of the box. To make them work, edit /etc/default/grub:

  GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi=\"!Windows 2012\""

Run update-grub and reboot.

## ClickPad Configuration

Since the W540 doesn't have physical TrackPoint buttons anymore, an adjustment to the synaptics driver configuration is needed to get (approximately) the same feel as in Windows. I haven't gotten scrolling using the middle button working yet, but I will update this document when I do.

  • Create the directory /etc/X11/xorg.conf.d if it doesn't exist yet
  • Create a file named 50-synaptics-clickpad.conf in the above directory with the following contents:
Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
        MatchDevicePath "/dev/input/event*"
        Option  "HorizScrollDelta"      "0"
        Option "MinSpeed" "1"
        Option "MaxSpeed" "1"
        Option "AccelerationProfile" "2"
        Option "AdaptiveDeceleration" "16"
        Option "ConstantDeceleration" "16"
        Option "VelocityScale" "32"
# enable tap-to-click as default (bnc#722457)
        Option "TapButton1" "1"
        Option "TapButton3" "2"
        Option "TapButton2" "3"
EndSection


Section "InputClass"
        Identifier "touchpad ignore duplicates"
        MatchIsTouchpad "on"
        MatchOS "Linux"
        MatchDevicePath "/dev/input/mouse*"
        Option "Ignore" "on"
EndSection


# This option enables the bottom right corner to be a right button on
# non-synaptics clickpads.
# This option is only interpreted by clickpads.
Section "InputClass"
        Identifier "Default clickpad buttons"
        MatchDriver "synaptics"
#        Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
        Option "AreaTopEdge" "2700"
        Option "SoftButtonAreas" "65% 0 0 3500 35% 65% 0 3500"
#       To disable the bottom edge area so the buttons only work as buttons,
#       not for movement, set the AreaBottomEdge
EndSection

After a reboot, you should now be able to use the upper part of the clickpad as TrackPoint buttons. If desired, you can change the AreaTopEdge parameter in the configuration file. Increasing the value moves the top edge of the active area further away from the top edge of the clickpad, meaning that there will be a bigger area in which you will not be able to move the mouse pointer with the touchpad; decreasing it will do the opposite.

## Fingerprint Sensor (VFS5011)
  • Install the necessary packages:
apt-get install git libmagickcore-dev libusb-1.0-0-dev libnss3-dev libglib2.0-dev libtool fprintd automake libxv-dev libpam-fprintd build-essential fprint-demo
  • Grab the driver sources: git clone git://github.com/abbradar/fprint_vfs5011.git
  • In the fprint_vfs5011 directory, run ./autogen.sh && ./configure --prefix=/usr
  • There is a bug in the makefile, so you have to edit libfprint/Makefile and find the fprint-list-udev-rules target. At the end of the line that starts with $(AM_V_CCLD), add $(GLIB_LIBS):
$(AM_V_CCLD)$(fprint_list_udev_rules_LINK) $(fprint_list_udev_rules_OBJECTS) $(fprint_list_udev_rules_LDADD) $(LIBS) $(GLIB_LIBS)
  • Now we can compile and install the library: make && make install
  • In order for users to be able to access the fingerprint reader, we are going the have to add the following section to /lib/udev/rules.d/60-libfprint0.rules:
# Validity VFS5011
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0017", ATTRS{dev}=="*", ATTR{power/control}="auto", MODE="0664", GROUP="plugdev"
  • Reboot your machine and run fprint_demo. The fingerprint reader should be recognized and you should be able to enroll your fingers.
@robolange
Copy link

So after a year of nearly flawless use on Debian testing (was jessie, now stretch) a recent update has caused a regression and now most of the top-row Thinkpad keys do not work and suspend-on-screen-close also does not work. Anyone else see this?

I can change the volume and brightness by the GUI or via command line, but the buttons don't work anymore. The Wifi button still works, and the Nvidia card can still be activated/deactivated via optirun. The Internet icon button (second from the right above the number pad) still works. But none of the other top-row buttons even show up as keypresses in xev anymore.

I had acpi_osi=\"!Windows 2013\" in GRUB_CMDLINE_LINUX_DEFAULT. I also tried acpi_osi=\"Linux\" and while it didn't help, it didn't hurt either, as Bumblebee still worked.

Anyone have any idea how to begin debugging this? Or even just to figure out what package to file a bug against?

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