Saturday, July 28, 2012

Lenovo x220t trackpoint problem and solution

So, it happens that the x220's screen rests on the trackpoint when it's flipped around in tablet mode. If the display wiggles enough to nudge the trackpoint, the cursor will drift away and refuse to go where the pen is pointing for 5-10 seconds. Pretty annoying, wouldn't you say? Took me awhile to figure out what was going on, too!

My "fix" is an AutoHotkey script to disable the trackpoint. I then configured the screen rotation button so that a long press triggers the script. Here's the AutoHotkey script:


; Enable either trackpoint or touchpad (toggle the setting)
#z::
Run C:\Program Files\ThinkPad\UltraNav Utility\UNAVOSD.EXE
Sleep 200
PixelGetColor, touchPadOnlyEnabled, 30, 135
if ( touchPadOnlyEnabled = 0xffffff )
{
  Click 300, 100 ; enable trackpoint
}
else ; trackpoint or both are enabled
{
  Click 300, 135 ; enable touchpad only
}
return

That is saved to "AutoHotkey.ahk" in My Documents. The file was actually created by AutoHotkey when I asked it to create a sample script. I just gutted it and added the above code. When the Left-Windows key is pressed together with the Z key, the action is triggered.

How it works is:

  • Run the Lenovo UltraNav Device Settings program, UNAVOSD.EXE. This is the same program that's run when you press Fn-F8. It requires that both the trackpoint and the trackpad be enabled in the BIOS.
  • Sleep for some time to let the on screen display (OSD) appear.
  • Peek at the UltraNav OSD to see if just the touchpad is enabled.
  • Enable just the trackpoint or just the touchpad depending on the pixel value retrieved in the previous step.

There are a few weaknesses about this script:

  • It enables only the trackpoint or the touchpad. I never enable both, but it's easy to change the logic if you like. FWIW, the coordinates of the "enable both" option is near x=300, y=65.
  • The script relies on hard-coded coordinate values and pixel color values. A change to the UltraNav OSD could break the script.
  • It relies on a sleep which may not be appropriate for slower computers.

To configure the screen rotation button, go to Control Panel -> Hardware and Sound -> Tablet PC Settings -> Set tablet buttons to perform certain tasks (aka the Buttons tab) -> Change. In the dialog, change "Press and hold" to "Press a key or key combination". Then enter the key sequence in the Keys field.

Hope that helps!

No comments:

Post a Comment