Computers/Thinkpad X200

From ParabolaWiki
Jump to: navigation, search

ja:Lenovo ThinkPad X200

Hardware PCI/USB ID Working?
Audio 8086:293e Yes
Bluetooth Yes
Ethernet 8086:10f5 Yes
Fingerprint reader Yes
Integrated Graphics (Mobile Intel 4 Series) 8086:2a43 Yes
Keyboard Yes
SD-card reader Yes
Touchpad (X201 and variants) Yes
TPM Unknown
Trackpoint Yes
Webcam 17ef:480c Yes
Wireless LAN (Intel Ultimate N WiFi Link 5300) 8086:4236 No
Wireless LAN (Intel Corporation PRO/Wireless 5100 AGN) 8086:4237 No

1 Firmware

Warning: Modifying the system's firmware can be rewarding but it is also very dangerous. Proceed with caution.
Warning: Flashing firmware ROMs from untrusted sources can potentially leave a computer with firmware-level malicious rootkits, or a brick. Be careful!

1.1 Coreboot / Libreboot

Coreboot is a fast and flexible firmware solution to replace the system BIOS. The ThinkPad X200 is fully supported by Coreboot and good documentation can be found at the Libreboot project's official website. The X200s and X200 Tablet are also partially supported per the Libreboot X200 documentation. Libreboot is a free Coreboot distribution with a 100% freedom policy that excludes all binary blobs, and fully supports X200(s/t) models.

Like most ThinkPads, the X200(s) / X200T has an FCC enforced whitelist for wireless cards. This means if a third party wireless card is installed via Mini PCIe or PCMCIA slot, the system will not boot. However, Libreboot removes this restriction.

2 Fingerprint reader

Install fprint. Support depends on the model variant.

3 Function keys

Note: Commands like xmodmap, xev, showkey, dmesg, setkeycodes can help you. See Extra keyboard keys for details.
Key Visible?1 Marked?2 Effect
Fn Yes No XF86WakeUp
Fn+PrintScreen Yes Yes Alt+Sys_Req
Fn+ScrollLock No Yes Toggle the function of the numeric keys3
Fn+Pause Yes Yes Ctrl+Break
Fn+Home Yes Yes XF86MonBrightnessUp
Fn+PageUp No Yes Toggles the ThinkLight on T-series laptops.
Fn+End Yes Yes XF86MonBrightnessDown
Fn+F2 Yes Yes XF86ScreenSaver
Fn+F3 Yes Yes XF86Battery
Fn+F4 Yes Yes XF86Sleep
Fn+F5 Yes Yes XF86WLAN
Fn+F6 Yes No4 XF86WebCam
Fn+F7 Yes Yes XF86Display
Fn+F8 Yes Yes XF86TouchpadToggle
Fn+F9 No Yes (On Microsoft Windows) open the ThinkPad EasyEject Utility screen.
Fn+F12 Yes Yes XF86Suspend
Fn+Space No Yes (On Microsoft Windows) enable the FullScreen Magnifier function.
Fn+Up Yes Yes XF86AudioStop
Fn+Left Yes Yes XF86AudioPrev
Fn+Down Yes Yes XF86AudioPlay
Fn+Right Yes Yes XF86AudioNext
  1. The key is visible to xev and similar tools
  2. The physical key has a symbol on it, which describes its function
  3. The number lock works and is handled in firmware. This is opaque to the software and NmLk itself is not visible to xev. This is not the same as the number lock found on most keyboards, where the number lock key is visible to software, but keys pressed with the number lock toggled will have the keysym of a keypad key (7 versus KP_7).
  4. Unmarked but documented in the hardware maintenance manual.

4 Special keys

4.1 Mute key

You may need to pass acpi_osi=Linux as a kernel parameter to allow the mute key to function as intended. See https://thinkwiki.org/wiki/Mute_button and the relevant thread on the linux-acpi mailing list for more details. Under Libreboot/Coreboot one can also use the ectool binary to set the correct mode as follows:

# ectool -w 0x03 -z 0x40

This should enable the mute button to work as intended, be careful with ectool though as it is directly manipulating the registers in the EC.
To make this persist after reboots and suspend-wakeups, you can create a systemd service to rerun the command on boot and after wakeup:

/etc/systemd/system/mutekey.service
 [Unit]
 Description=mutekey
 After=suspend.target

 [Service]
 Type=simple
 ExecStart=/usr/bin/ectool -w 0x03 -z 0x40

 [Install]
 WantedBy=multi-user.target
 WantedBy=suspend.target
# systemctl enable --now mutekey

4.2 Tablet buttons

Key Effect
Button 1 Rotates screen.
Button 2 Switches screen between landscape and portrait mode.
Button 3 Possibly opens a menu.
Button 4 XF86ScreenSaver

The X200t buttons won't be recognized by xev and similar tools and have to be assigned to free keycodes first. For this, you can either run Setkeycodes manually after each reboot, or create a systemd service that executes a script:

/etc/systemd/system/keyfix.service
 [Unit]
 Description=keyfix

 [Service]
 Type=simple
 ExecStart=/usr/local/bin/keyfix.sh

 [Install]
 WantedBy=multi-user.target
/usr/local/bin/keyfix.sh
 #!/bin/bash
 setkeycodes 67 85 6c 89 68 95 66 112
# chmod +x /usr/local/bin/keyfix.sh
# systemctl enable keyfix
# systemctl start keyfix
Key Scancode Keycode given to Setkeycodes Actual assigned keycode
Button 1 67 85 93
Button 2 6c 89 97
Button 3 68 95 103
Button 4 66 112 120
Note: Due to a bug, Setkeycodes will set the keycode that is 8 codes ahead of the one it receives in commands. For example, setkeycodes 66 112 will actually bind the scancode 66 to keycode 120.
Note: Tablet buttons do not seem to work in tablet mode (flipped and closed screen). The reason for this is unclear; requires investigation.

You need to map the keycodes to something in order to make use of them, here is an example for screen rotation and screen locking for sway:

~/.config/sway/config
 # rotate integrated display
 bindcode 93 output LVDS-1 transform 180 clockwise
 bindcode 97 output LVDS-1 transform 90 anticlockwise
 bindcode 103 output LVDS-1 transform 90 clockwise
 bindcode 120 exec swaylock -Ff
 
 # rotate wacom tablet along with the integrated display
 input "1386:147:Wacom_Serial_Penabled_1FG_Touchscreen_Pen" {
     accel_profile "flat"
     pointer_accel 0
     map_to_output LVDS-1
 }

4.3 Screen rotation

Note: This method only works on X11.
/usr/local/bin/screen_rotation.sh
#!/bin/sh

# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation="$(xrandr -q --verbose | grep 'connected' | grep -Eo  '\) (normal|left|inverted|right) \(' | grep -Eo '(normal|left|inverted|right)')"

# Using current screen orientation proceed to rotate screen and input tools.
case "$rotation" in
    normal)
    # rotate to the left
    xrandr -o left
    xsetwacom set "Serial Wacom Tablet WACf004 stylus" rotate ccw
    xsetwacom set "Serial Wacom Tablet WACf004 eraser" rotate ccw
    ;;
    left)
    # rotate to normal
    xrandr -o normal
    xsetwacom set "Serial Wacom Tablet WACf004 stylus" rotate none
    xsetwacom set "Serial Wacom Tablet WACf004 eraser" rotate none
    ;;
esac

Keycodes can be bound to the execution of scripts in many desktop environments' settings. Environment-independent X applications also exist such as xbindkeys and sxhkd.

5 Hard disk shock protection

The ThinkPad X200 comes with an integrated 2-axis accelerometer providing the possibility of parking the hard drive's disk heads preventing from data loss due to heavy shocks. See HDAPS for details. It may be necessary to set correct invert parameter.

6 Power management

Note: There is a useful blog post describing possible measures to reduce power consumption of a X200T to almost 7 Watt.

To set up an efficient power saving environment, install the tlp package. A detailed guide how to implement a simplistic power saving environment based upon TLP can be found here.

Fan-control software can be used to further reduce power consumption.

It is possible also to use powertop for more information on measuring actual power consumption.

See Power saving for additional tips.

7 Screen calibration

7.1 Loading the correct ICC colour profile

Download x200.icc and move it to ~/.color/icc. Load the profile with xcalib as follows:

$ /usr/bin/xcalib -d :0 ~/.color/icc/x200.icc

8 Wireless internet

The Thinkpad X200 and X200 Tablet can have any of the following wireless cards supplied by the factory:

  • Condor Peak 1x2 HMC WIFI
  • EchoPeak 1X2 HMC RUSSIA SKU (WiMAX/WIFI5150) for Russia
  • Intel Centrino Wireless-N 1000, Advanced-N 6200, Advanced-N + WiMAx 6250, Ultimate-N 6300
  • Intel WiFi Link 5100, 5300
  • Intel WiMAX/WiFi Link 5150, 5350
  • ThinkPad 11b/g/n Wireless LAN Mini-PCI Express Adapter II, III

It is unknown if any of those are supported by linux-libre-firmware, probably not.

If connectivity problems such as a slow connection or aborts are experienced, especially when connected to a WPA2 Enterprise network, then try to load the iwlwifi module with the options 11n_disable=1, 11n_disable=2, swcrypto=1, bt_coex_active=0. There is no clear recommendation which of these options to be used as for some users 11n_disable=1 already solves the problem sufficiently, for others bt_coex_active=0. See Wireless network configuration#iwlwifi for more detailed instructions.

9 Troubleshooting

9.1 Libreboot uneven backlight brightness problem

In some CCFL display panel libreboot fails to detect the correct PWM brightness value resulting in uneven backlight (summary). To fix this, you need to flash libreboot version 20210522 or newer (download) (warning libreboot 20210522 has a grub font & restart bug, altough shutdown is okay).

9.2 Failed to execute '/usr/sbin/inputattach'

If you see the above error in your logs, copy /usr/lib/udev/rules.d/70-wacom.rules to /etc/udev/rules.d/70-wacom.rules and comment out SUBSYSTEM of inputattach.

9.3 System feels unresponsive

If your system feels unresponsive and lagging, you can try creating a file called /etc/modprobe.d/drm_kms.conf:

options drm_kms_helper poll=N

9.4 Backlight fails to activate after system resume

On rare occasions the backlight may not activate after resuming. See Problem with display remaining black after resume for possible workarounds.

9.5 PM device: Resume from hibernation error: Failed to restore -19

This is likely to be related to the tpm_tis and tpm modules not being properly unloaded before hibernation. These modules are required by the device listed in the error as 00:0a:

# dmesg | grep 00:0a
[    0.377877] pnp 00:0a: Plug and Play ACPI device, IDs PNP0c31 (active)
[   10.746742] tpm_tis 00:0a: 1.2 TPM (device-id 0x1020, rev-id 6)
[   10.746751] tpm_tis 00:0a: Intel iTPM workaround enabled
[   10.866734] tpm_tis 00:0a: TPM is disabled/deactivated (0x6)

To unload the module create the following executable file called /usr/lib/systemd/system-sleep/tpm.sh, assuming the use of the systemd hibernation procedure:

#!/bin/sh
case $1/$2 in
  pre/*)
    echo "Going to $2..."
    modprobe -r tpm
    modprobe -r tpm_tis
    ;;
  post/*)
    echo "Waking up from $2..."
    modprobe tpm
    modprobe tpm_tis
    ;;
esac

9.6 mei_me 0000:00:03.0: suspend

If you are seeing this error, a workaround is to blacklist the mei and mei_me modules. More information can be found here.

9.7 pciehp 0000:00:1c.1:pcie04: Cannot add device at 0000:03:00

See #mei_me 0000:00:03.0: suspend.

9.8 Uhhuh. NMI received for unknown reason 30.

The Thinkpad X200 is known to report the following error on resume from hibernation or suspension:

Uhhuh. NMI received for unknown reason 30.
Dazed and confused, but trying to continue
Do you have a strange power saving mode enabled?

In this case you can disable the high precision event timer (HPET) by adding "nohpet" to your GRUB kernel parameter line.

9.9 High pitched noises

The X200(s) is prone to high pitched, low volume noises originating from the CPU, usually in low power scenarios. To work around this, you can either use powertop, or limit CPU cstates.

High pitched noises may also be emitted from the display's inverter board on CCFL models. This is normal behavior and may or may not be present depending on how much energy the installed display draws.

For more information see [1].

10 See also