Take a look at our
ThinkPads.com HOME PAGE
For those who might want to contribute to the blog, start here: Editors Alley Topic
Then contact Bill with a Private Message

two-finger scrolling on T43 under XP?

Forum for scripts, utilities like TPFanControl, IBM-ECW, 2-finger scrolling, etc.
Message
Author
Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

two-finger scrolling on T43 under XP?

#1 Post by Angulion » Tue Sep 02, 2008 3:26 pm

Hi there,
a while ago I acquired a MacBook and one of the features I like most is the two-finger scrolling. I wondered whether two-finger scrolling is also possible on XP machines, and more specifically on my very own T43 (see signature). A little search in the Internet led me to this page that shows how to do it under Linux:
http://sunilgarg.com/2007/10/enable-two ... in-ubuntu/
And indeed, putting in these changes in the config file as described gives me two-finger scrolling under Debian which is quite useful and also shows that the hardware supports two-finger scrolling.
Now to the next step, making it work under XP. Not surprisingly, I did not find any option to enable two-finger scrolling in the TP configuration software but instead I discovered some suspicious entries in the registry, such as "HKEY_CURRENT_USER\Software\Synaptics\SynTP\TouchPadPS2\2FingerGestures". I haven't yet tried fiddling with these entries to see whether I can enable two-finger scrolling under XP. Before doing this, I figured I would ask in this forum for advice. Any comments and help greatly appreciated.
Thanks in advance and best regards,
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

Harryc
Moderator Emeritus
Moderator Emeritus
Posts: 13228
Joined: Thu Apr 12, 2007 8:23 am
Location: Upstate New York

#2 Post by Harryc » Tue Sep 02, 2008 4:02 pm

I like this feature on my Macbook Pro. I'll be following this thread for any hope of it under XP. I have never seen any mention of it. Good luck.

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#3 Post by Angulion » Tue Sep 02, 2008 5:46 pm

quick update -- I did some more research in the internet and stumbled over the following support documents from Synaptec:

http://www.synaptics.com/decaf/utilities/ACF126.pdf
http://www.synaptics.com/decaf/utilitie ... PIv1_0.zip

Note that on p. 75 of the first document the API function 'GetCurrentFingers' is mentioned which allows to determine the number of fingers on the pad. Thus, it should be possible to read out this info under XP and, in principle, use it for two-finger scrolling. Unfortunately, implementing s.th. like this in reasonable time is beyond me. However, maybe one of the 'programming-minded' readers of this forum might be in a better position to do so!? (one can always hope ...)

thanks again and best regards,
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#4 Post by yak » Wed Sep 03, 2008 7:55 am

I had a look. The problem is that the document describes a different API and I cannot find a possibility to read the number of fingers in the COM API altrought there is a function to tell if the TouchPad supports this. Strange.

I've checked and it says that the TouchPad in my T41 supports it.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#5 Post by Angulion » Wed Sep 03, 2008 9:57 am

Hi yak,
thanks for your reply. I have to admit upfront that my programming experience (at least under Windows) is rather limited. However, I looked through the documentation once more and realized that the function 'GetCurrentFingers' that is mentioned in the first document I linked to does not feature in the API documentation. But what about the 'SynFingerFlags' enumeration - it contains the flag SF_FingerTap2 to detect whether a two-finger gesture is in progress. Going by the name, it is probably intended for sth. else but maybe it can be hijacked for our purpose. Again, my knowledge about Windows programming is little and I don't really know.
Thanks and so long,
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#6 Post by yak » Wed Sep 03, 2008 1:52 pm

Yes, that's the only trace of more than one finger support in the API. I have tried to monitor this flag but it didn't work (so far) with either tapping or holding.

I'll probably test some more later.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#7 Post by yak » Thu Sep 04, 2008 5:12 am

I did some additional testing but still can't make the FingerTap2 work. Funny because I can tap with three fingers in Ubuntu to simulate right button press.

But anyway, I had an idea that one could actually use the Z axis (pressure) to implement this. As it turnes out, this value increases if you use two or more fingers. I have to strongly press one finger to achieve value that I get by just laying two fingers on the pad.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#8 Post by yak » Thu Sep 04, 2008 8:55 am

Here's a reference implementation. It works quite well on my T41.

Code: Select all

#
# Two (or more) finger scrolling for Synaptics TouchPad and
# Windows XP.
#
# Reference implemetation in Python. Should be rewritten in C#
# or simmilar language.
#
# Uses the fact that two fingers act same as a very hard press
# of one finger.
#
# Currently supports vertical scrolling only.
#
# Supports tapping to activate the right mouse button too.
#
# Requires Python win32 extensions, download from:
# https://sourceforge.net/projects/pywin32/
#
# You will also have to run the
#   <Python>\Lib\site-packages\win32com\client\makepy.py
# script and select the
#   Synaptics Device Control Widgets, Version 1.0 (1.0)
# entry, to add the TouchPad library to the Python.
#
# Copyright (c) 2008 Arkadiusz Wahlig
#
# Version 1.3
#

# If the pressure of a moving finger(s) exceeds this value,
# scroll is activated.
SCROLL_PRESSURE_THRESHOLD = 90

# Scroll speed factor. Greater value = faster scroll.
SCROLL_SPEED_FACTOR = 0.7

# Minimal pressure value for the right button tap to be initiated.
TAP_PRESSURE_THRESHOLD = 90

# Maximal duration (in milliseconds) of a tap. Set to 0 to disable
# tapping.
TAP_TIMEOUT = 175

# Maximal distance the finger can traverse during a tap.
TAP_MAX_DISTANCE = 75

# =================================================================

from win32com.client import Dispatch, DispatchWithEvents, constants
import pythoncom, win32api
from ctypes import *
from win32con import *

# INPUT structure with integrated MOUSEINPUT union member, see:
# http://msdn.microsoft.com/en-us/library/ms646270(VS.85).aspx
class XMOUSEINPUT(Structure):
    _fields_ = [('type', c_int),
                ('dx', c_long),
                ('dy', c_long),
                ('mouseData', c_int),
                ('dwFlags', c_int),
                ('time', c_int),
                ('dwExtraInfo', c_void_p)]

class SynDeviceCtrlEvents:
    def __init__(self):
        self.packet = Dispatch('SynCtrl.SynPacketCtrl')
        self.__acquired = False
        self.touch_pos = None
        self.tap_in_progress = False

    def Finish(self):
        '''Clears the state of the device.'''
        if self.IsPadAcquired():
            self.ReleasePad()
        if self.tap_in_progress:
            self.SetDeviceTap(self.device_tap)

    def AcquirePad(self):
        '''Acquires the TouchPad for exclusive access. This will
        stop the mouse pointer.'''
        self.Acquire(0)
        self.__acquired = True

    def ReleasePad(self):
        '''Release the TouchPad. The mouse pointer starts moving
        again.'''
        self.Unacquire()
        self.__acquired = False

    def IsPadAcquired(self):
        '''Returns True if the TouchPad has been acquired using
        AcquirePad().'''
        return self.__acquired

    def GetDeviceTap(self):
        '''Returns True if tapping is enabled in the TouchPad
        control panel.'''
        g = self.GetLongProperty(constants.SP_Gestures)
        return bool(g & constants.SF_GestureTap)

    def SetDeviceTap(self, value):
        '''Enables or disabled tapping in the TouchPad control
        panel.'''
        g = self.GetLongProperty(constants.SP_Gestures)
        if value:
            g |= constants.SF_GestureTap
        else:
            g &= ~constants.SF_GestureTap
        self.SetLongProperty(constants.SP_Gestures, g)

    def OnPacket(self):
        # this event is called when the TouchPad has new data for us
        p = self.packet
        self.LoadPacket(p)

        # handle scrolling
        if p.FingerState & constants.SF_FingerPresent:
            if self.touch_pos is None:
                # remember the position of the pointer when the pad
                # was touched
                self.touch_pos = win32api.GetCursorPos()
            if p.FingerState & constants.SF_FingerMotion:
                if p.Z >= SCROLL_PRESSURE_THRESHOLD and \
                        not self.IsPadAcquired():
                    # finger moved with high pressure, acquire the pad
                    self.AcquirePad()
                    # reset the position of the pointer
                    win32api.SetCursorPos(self.touch_pos)
                if self.IsPadAcquired():
                    # pad acquired, finger moved -> do the scroll
                    self.DoScroll(p.XDelta, p.YDelta)
        else:
            self.touch_pos = None
            if self.IsPadAcquired():
                # finger lifted, release the pad
                self.ReleasePad()

        # handle tapping
        if p.FingerState & constants.SF_FingerPresent:
            if p.Z >= TAP_PRESSURE_THRESHOLD and \
                    not self.tap_in_progress:
                # high pressure detected, init a tap
                self.tap_in_progress = True
                self.tap_start = p.TimeStamp
                self.tap_distance = 0
                # disable device tap to prevent it from being triggered
                self.device_tap = self.GetDeviceTap()
                self.SetDeviceTap(False)
            if self.tap_in_progress and \
                    p.FingerState & constants.SF_FingerMotion:
                self.tap_distance += abs(p.XDelta) + abs(p.YDelta)
        elif self.tap_in_progress:
            # finger lifted, finish a tap
            self.tap_in_progress = False
            # check the tap duration
            if p.TimeStamp - self.tap_start < TAP_TIMEOUT and \
                    self.tap_distance < TAP_MAX_DISTANCE:
                self.DoTap()
            # reenable device tap if needed
            self.SetDeviceTap(self.device_tap)

        # quit if requested (left button during scroll)
        if self.IsPadAcquired() and \
                p.ButtonState & constants.SF_ButtonLeft:
            win32api.PostQuitMessage()

    def DoScroll(self, dx, dy):
        '''Sends a mouse wheel event to the system.'''
        m = XMOUSEINPUT()
        m.type = INPUT_MOUSE
        m.dwFlags = MOUSEEVENTF_WHEEL
        m.mouseData = int(dy * SCROLL_SPEED_FACTOR)
        windll.user32.SendInput(1, byref(m), sizeof(XMOUSEINPUT))

    def DoTap(self):
        '''Sends a mouse right button click event to the system.'''
        m = (XMOUSEINPUT * 2)()
        m[0].type = INPUT_MOUSE
        m[0].dwFlags = MOUSEEVENTF_RIGHTDOWN
        m[1].type = INPUT_MOUSE
        m[1].dwFlags = MOUSEEVENTF_RIGHTUP
        windll.user32.SendInput(2, byref(m), sizeof(XMOUSEINPUT))

def main():
    # create and initialize the API object
    api = Dispatch('SynCtrl.SynAPICtrl')
    api.Initialize()
    api.Activate()

    # find a TouchPad
    handle = api.FindDevice(constants.SE_ConnectionAny,
                            constants.SE_DeviceTouchPad,
                            -1)
    if handle < 0:
        raise RuntimeError('Can\'t find a TouchPad device!')

    # create and initialize the device object
    device = DispatchWithEvents('SynCtrl.SynDeviceCtrl',
                                SynDeviceCtrlEvents)
    device.Select(handle)
    device.Activate()

    # start pumping the windows messages, without this
    # the device's OnPacket event won't ever be called
    pythoncom.PumpMessages()

    # clear the state of the device
    device.Finish()

if __name__ == '__main__':
    main()
Someone with time on his hands can use it to write a proper tool in some compilable language.

--- EDIT ---

Updated to version 1.3.
Last edited by yak on Fri Sep 05, 2008 10:15 am, edited 4 times in total.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#9 Post by Angulion » Thu Sep 04, 2008 10:41 am

Hi yak,
that looks very good. I haven't yet had the chance to try it out but will attempt in due time to see whether I can make it work.
In the meantime, I have found a webpage where sb. else had the same idea as you and implemented it in VB. However, the link to the actual file is broken and no source code is given:
http://dt.in.th/2008-04-06.synaptics-scroll.html

Also, I had looked up the source code for the Linux version of the Synaptics touchpad driver:
http://web.telia.com/~u89404340/touchpad/files/
Maybe there is something in there which helps improving your two-finger-scroll implementation.

For time being, thank you very much. Good job!
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#10 Post by Angulion » Thu Sep 04, 2008 11:32 am

Hi yak,
I got it to work - awesome job. However, I agree with your notion that somebody here should take your code and rewrite in another language and compile it.
In the meantime, I just enjoy your Python version. It's so cool - you rule.
cheers,
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

Harryc
Moderator Emeritus
Moderator Emeritus
Posts: 13228
Joined: Thu Apr 12, 2007 8:23 am
Location: Upstate New York

#11 Post by Harryc » Thu Sep 04, 2008 12:15 pm

This looks something great in the making, nice work! Can one of you post laymans steps to run this python script, and to make it run on boot?

rook
Freshman Member
Posts: 61
Joined: Sat Jan 19, 2008 7:24 pm
Location: Krakow, Poland

#12 Post by rook » Thu Sep 04, 2008 12:20 pm

i can write simple, small application for win32, but i need to know that what Harryc is asking about, running steps...
T40 PM 1.5GHz, 1280MB RAM, 60GB 4800rpm HDD, 14.1 SXGA+ TFT LCD, 32MB ATI Radeon 7500, 16x10x24x/8x CD-RW/DVD(slim), Modem/BT, 10/100/1000 Ethernet, 802.11abg, UltraNav, 6 cell x 2600mAh battery, WinXP Pro

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#13 Post by Angulion » Thu Sep 04, 2008 12:43 pm

As both yak and me agree, a rewrite in another language plus compilation would be desirable. It would be great, if for example rook could do that.

In the meantime, let me just give you the steps I went through to make yak's wonderful script work:
1) I assume you have Python installed. If not, get it at http://www.python.org.
2) As yak said, you need to install the win32 extensions for Python. You can obtain them at https://sourceforge.net/projects/pywin32/. Be sure to get the version that matches your Python version.
3) You have to register the Synaptics libraries in Python (not sure whether I am using the right terminology here). To do this, locate the makepy.py script in $PYTHON_DIR/Lib/site-packages/win32com/client and run it like this:

Code: Select all

makepy.py -d
In the pop-up menu scroll down to the Synaptics entries and successively select all of them. I am not sure which one is actually needed, but choosing all three works.
4) Now you can run yak's script and should be ready to go. You could probably just put a link to a batch file that runs the script in your Win startup-folder to have it always available.

Hope this is of help.
so long,
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#14 Post by yak » Thu Sep 04, 2008 7:24 pm

Angulion described the installation very well, I will just add that the entry to select after the makepy.py script is run is:

Code: Select all

Synaptics Device Control Widgets, Version 1.0 (1.0)
To make it start at boot you may want to save it as *.pyw file instead of *.py. This pyw extension is special for Windows version of Python and hides the console window that would otherwise always appear.

Then just create a shortcut to the script and put it in the Autostart folder.

To quit the script, either open the task manager and terminate the python.exe process (or pythonw.exe if you saved the script as *.pyw) or use the quit functionality built into the script:
- start the scroll by moving two fingers on the touchpad so that the pointer stops moving,
- without lifting the fingers up from the touchpad, press the left touchpad button (NOT the left trackpoint button).
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#15 Post by yak » Fri Sep 05, 2008 8:09 am

The code I've posted before has been updated to

Version 1.2.

New are two things:

1. The scroll initiation has been improved. Now the fingers not only have to press on the TouchPad, they also have to move. Only then the pointer is locked and the scrolling starts.

This was changed because it happened to me sometimes, that I've applied enough pressure with one finger to start the scroll when I didn't want to. Since it is harder to reach high pressure values while the finger is moving, this change to the code fixed this.

2. The script now supports tapping to trigger the right mouse button. You can set it up at the beginning of the script.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

Harryc
Moderator Emeritus
Moderator Emeritus
Posts: 13228
Joined: Thu Apr 12, 2007 8:23 am
Location: Upstate New York

#16 Post by Harryc » Fri Sep 05, 2008 8:29 am

rook wrote:i can write simple, small application for win32, but i need to know that what Harryc is asking about, running steps...
rook, if you could do this it would be fantastic! When I asked for 'steps', I was just looking for a procedure on how to install the python script. Angulion answered my question, thank-you.

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#17 Post by Angulion » Fri Sep 05, 2008 9:54 am

one more thought -- at least in principle, one could also compile the Python script as is. I stumbled across a Python compiler but don't know how good results would turn out to be. Maybe yak has some opinions on that. In parallel, rook should go for it and port it into C++ or whatever language he prefers.
Thanks,
Andi
p.s.: I love this forum.
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#18 Post by yak » Fri Sep 05, 2008 10:23 am

Just updated the code to V1.3.

One improvement. As soon as any touch is detected on the TouchPad, the current pointer (cursor) position is stored. The pointer is then moved back to this position if the touch resulted in scrolling.

What is this for? Most of the time before we put both fingers on the TouchPad, one of them will be detected and the pointer will move. If we repeatedly lift the fingers and put them back on to scroll some more, the pointer will slowly flow away from its original position eventually moving out of the control which will prevent scrolling from working. Moving it back ensures that it stays in one place while we're scrolling.

Another idea is to make the scrolling work like in iPhone or Grab&Drag extension for Firefox. The scroll would not stop when the fingers are lifted up but slowly stop depending on how fast the finger movement was.

One note, you may want to experiment with setting the SCROLL_SPEED_FACTOR variable to a negative value. This will invert the scrolling, it will act more like you were pulling the scrolled content instead of moving the scrollbar.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#19 Post by Angulion » Fri Sep 05, 2008 10:31 am

Hi yak,
I would love to try version 1.3 - do you mind posting it here?
Thanks and so long,
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#20 Post by yak » Fri Sep 05, 2008 10:44 am

I didn't want to spam the forum so I've just replaced the old code in the original post with version 1.0.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

Harryc
Moderator Emeritus
Moderator Emeritus
Posts: 13228
Joined: Thu Apr 12, 2007 8:23 am
Location: Upstate New York

#21 Post by Harryc » Fri Sep 05, 2008 5:37 pm

Mod edit Moved this thread to the Thinkpad Utility Work Area conference and made it a sticky.

flox
Posts: 1
Joined: Mon Sep 15, 2008 1:10 pm
Location: Waco, TX

#22 Post by flox » Mon Sep 15, 2008 2:10 pm

Hey guys, I really want to see this thing work! I have scoured Google for this type of program, and this is the only one I have found! This thread needs to be higher up in the Google lists.

Anyways, I copy/pasted the code and followed the instructions, but I first got a whitespace error after the '\'s. I deleted the whitespace, but now am getting this error:

Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\..\TwoFingerScrollWin.py", line 211, in <module>
main()
File "C:\Users\..\TwoFingerScrollWin.py", line 191, in main
handle = api.FindDevice(constants.SE_ConnectionAny,
File "C:\Python25\Lib\site-packages\win32com\client\__init__.py", line 168, in __getattr__
raise AttributeError, a
AttributeError: SE_ConnectionAny

You guys have any advice?



P.S. Yak, you're a genius for implementing this. You may say it's easy, but no one else has done it! Major props.
Dell Inspiron E1705 - Don't hate!

Angulion
Posts: 10
Joined: Sun Jul 08, 2007 7:04 pm
Location: Chicago, IL

#23 Post by Angulion » Wed Sep 17, 2008 7:43 am

Hi flox,
I don't know whether you have figured out by now what your problem with the Python code was or not. I am not sure what the initial 'whitespace' error you ran into was due to, but even as a Python neophyte I point out that when deleting (white)spaces one has to be cautious: changing the indentation level of a line of code affects its block structure and thus the syntax of the program.
That said, to solve your problem may I suggest that you go back to yak's original code and copy and paste it again, this time maybe using a different editor. If you then run into the same error with the script, you could send your actual Python file to me and I can have a look at it (send me a PM and we can arrange specifics).
yak has been quiet for a while but I could well imagine that he has better advice than this. (maybe he replies to this ;)
so long,
Andi
T43 2686-DGU (1.86 GHz,1.5GB,7k60,SXGA+)

abyssnolf
Posts: 1
Joined: Mon Sep 22, 2008 3:18 pm
Location: St Louis, MO

#24 Post by abyssnolf » Tue Sep 23, 2008 2:55 pm

I tried this on my Vista x64 install and it did not work.

Not wanting to be daunted, I started reprogramming the python solution in C#, but found myself unable to find a difference between one finger and two fingers. There is a flag mentioned in the SDK that is supposed to detect two fingers, but it never triggers. The back-up technique, as in the python script, was to detect a hard finger press, but my laptop did not consistently read any significant variation in the Z pressure between one and two fingers. My next step was to try to use the width measurement, but that also failed to read consistently.

As such, either the touch pad does not have the hardware to detect two finger touches (which seems unusual, this is a new laptop), Vista blocks two finger information close to the hardware layer, or some combination of synaptics settings are blocking the information.

I plan on booting up a live cd of Ubuntu to see if I can get two-finger scrolling to work on that (as I know it can). If that works, then that helps a little. If I can get it working somehow, I'll share the C# source/executable.

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#25 Post by yak » Mon Sep 29, 2008 5:21 pm

I recently moved from T41 on which my Python code was developed to a T60. The T41 passed away because of GPU issues.

As abyssnolf said, the script didn't work anymore. The Synaptics driver is not reporting greater Z-axis values if more fingers are put on the touchpad.

I'm not sure now (have to check) but I think I am able to simulate the right mouse click using a three fingers tap in Ubuntu so the hardware should support multi-fingers in some way.

In the meantime, until this is figured out, I was looking for some other options to scroll more conviniently.

One could be to use the middle TrackPoint button. One could scroll using the whole TouchPad while keeping the button pressed. The problem is that you would have to scroll using your thumb and that's not too convinient.

Another idea is to enable/disable the scrolling by a tap in one of the corners of the touchpad. Possibly with some visual way to let the user know the current state (mouse cursor change?).

I have to admit, none of these is as intuitive as two finger scrolling.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

cxls
Freshman Member
Posts: 118
Joined: Fri Oct 20, 2006 11:08 pm
Location: Cumberland, Rhode Island

#26 Post by cxls » Thu Oct 02, 2008 3:37 pm

What's the current status of this? I tried getting it to work on my T60p, and I think I was doing it right, but it wouldn't work.

If someone can help me get this working, I have experience converting Python scripts to Windows executables using py2exe and I could help out with that.
IBM ThinkPad T60p 2623-DDU | Intel Core Duo 2.0 GHz T2500 | 2 GB RAM | 256 MB ATI FireGL V5200 | 100 GB 7200 RPM SATA HDD | 15" UXGA BOE-Hydis (1600x1200) | NMB Keyboard | 9 Cell Battery x2

cxls
Freshman Member
Posts: 118
Joined: Fri Oct 20, 2006 11:08 pm
Location: Cumberland, Rhode Island

#27 Post by cxls » Fri Oct 03, 2008 10:53 am

cxls wrote:What's the current status of this? I tried getting it to work on my T60p, and I think I was doing it right, but it wouldn't work.

If someone can help me get this working, I have experience converting Python scripts to Windows executables using py2exe and I could help out with that.
I believe I also know how to create an installer for this, assuming it still works with T60s/etc.

EDIT: I actually built it into an exe, but the Synaptic Widget isn't selected and I don't know how to automate/roll it into the exe.
IBM ThinkPad T60p 2623-DDU | Intel Core Duo 2.0 GHz T2500 | 2 GB RAM | 256 MB ATI FireGL V5200 | 100 GB 7200 RPM SATA HDD | 15" UXGA BOE-Hydis (1600x1200) | NMB Keyboard | 9 Cell Battery x2

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#28 Post by yak » Mon Oct 06, 2008 1:38 pm

I still haven't found a way to do this on a T60.

However, today I had some spare time and was looking for different ways to improve the scrolling.

One of the new ideas was this circular movement-scrolling used on various devices like iPod or new Nokia phones.

Even Synaptics talks about such thing, their drivers still doesn't support it thou. Here's an announcement with a link to some technical details:
http://www.synaptics.com/technology/chiral.cfm

I had a go at implementing this in Python. You can download it here (V1.0). Tell me what do you think. Personally, I think it's better (more efficient) than this two-finger-scroll.
ChiralScroll.pyw

The script is based on the original one posted earlier in this thread and has same requirements.

The script should work on all notebooks with Synaptics touchpads, not only ThinkPads.

The algorithm still could use some improvements like some kind of acceleration if we move the finger faster or apply more pressure. Still, it works quite well now and definitely isn't as complex as it may seem.

Excerpt:

Code: Select all

# Reference implementation of the ChiralMotion(tm) Technology for a Synaptics TouchPad.
#   http://www.synaptics.com/technology/chiral.cfm
#
# ChiralMotion is a way of 1-D scrolling by moving the finger on a TouchPad in
# a circular motion.
#
# This implementation triggers the scroll when the right edge of the TouchPad is
# touched. The TouchPad is then switched into scrolling mode and the cursor is
# frozen until the finger is lifted. The initial scrolling direction is determined
# by the first finger motion (up/down). Any later linear reversal causes the
# scrolling direction to be reversed also.
#
# You will want to disable the Virtual scrollbars in Synaptics driver settings
# to avoid conflicts.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

Zender
Junior Member
Junior Member
Posts: 315
Joined: Sun Mar 18, 2007 8:34 pm
Location: Prague, Czech Republic
Contact:

#29 Post by Zender » Mon Oct 06, 2008 2:23 pm

There's interesting thing in Synaptics Device Driver ChangeLog:

----------------------------------------------------------------------------
Version 11.0.0 02/11/2008 (Win2K/WinXP/Vista)
----------------------------------------------------------------------------
New Features
-Added a hardware lock to prevent advanced gestures, Chiral, Pinch and Momentum for now, from running on standard TouchPads.

It's also interesting to note, that if you put one finger on the touchpad, keep it there, and add second finger after that, the cursor movement will only be affected by moving the first finger, the second is (almost) ignored.

Seems to me like we're once again not allowed to use what the hardware supports.
T60 14" SXGA+ 9c T5600 3GB X1400 4965AGN MC8780 IR BT FPR DVDRW Alps XPP

yak
ThinkPadder
ThinkPadder
Posts: 1256
Joined: Thu Dec 06, 2007 3:17 pm
Location: NRW, Germany

#30 Post by yak » Mon Oct 06, 2008 2:45 pm

Interesting. I wonder what do they mean by "hardware lock".

Anyway, my script is just based on their public API so it will work.

And btw, I've updated it to V1.1. Now the scroll isn't started if you move the finger into the trigger area, you have to touch the touchpad there.

Edit: V1.2. Fixed a bug in detection of reverse motion.
ThinkPad™ X201 / AFFS-120
i5-560M 2.67Ghz, 8GB RAM, Samsung 840 Pro 256GB SSD, Win 8 Pro 64-bit, UltraBase X200, ThinkPad Compact USB Keyboard,
Dell U2713HM (2560x1440, IPS), ExpressCard USB 3.0 (2 ports, flush), Nexus 7+10

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “ThinkPad Utility Work Area”

Who is online

Users browsing this forum: No registered users and 21 guests