Opened 12 years ago

Closed 12 years ago

#8978 closed bug (fixed)

'Clicks' not set in MouseDown messages on Thinkpad TrackPoint buttons

Reported by: mks Owned by: siarzhuk
Priority: normal Milestone: R1
Component: Drivers/Mouse/PS2 Version: R1/Development
Keywords: Cc: degea@…
Blocked By: Blocking:
Platform: All

Description

I have a Thinkpad R61 with Touchpad and Trackpoint. The left "mouse" button that belongs to the Trackpoint doesn't work properly in some applications.

  • I can click in Tracker and on the desktop and I can drag files around, but I cannot double click to open a file. Double clicking on the window title to minimize also does not work.
  • In WebPositive I cannot click on links with this button to follow a URL. Actually the click is performed (I can see that the link changes color, as long a I hold the button) but it does not activate the link. However, I can select text and use the scrollbar with the very same button. Right-clicking and then left-clicking 'Open link' in the menu also works.

Tested with hrevr1alpha4-44595 but I think this never worked before.

Attachments (5)

MouseTest.cpp (1.0 KB ) - added by mks 12 years ago.
syslog.0 (249.2 KB ) - added by mks 12 years ago.
Right after bootup
syslog.2 (3.3 KB ) - added by mks 12 years ago.
A few clicks with the DualPoint
fix-dualpoint-clickcount.patch (2.5 KB ) - added by mks 12 years ago.
This fix, suggested by korli, works. The timestamp wasn't set either.
0001-Fix-DualPoint-click-count.patch (2.9 KB ) - added by mks 12 years ago.
Same patch but created with git format-patch

Download all attachments as: .zip

Change History (24)

comment:1 by ttcoder, 12 years ago

Cc: degea@… added
Component: - GeneralDrivers/Mouse/PS2
Owner: changed from nobody to siarzhuk

Same "half" functionality with my R61 in Haiku, meaning I have to use the mouse buttons instead of the trackpad buttons; probably not a HW problem since everything works fine in win xp. Could be the "ps2" module that's the culprit, since it's used for the touchpad:

~> grep ps2 /var/log/syslog
KERN: ps2_hid: init_hardware
KERN: ps2_hid: init_driver
KERN: ps2_hid: publish_devices
KERN: ps2_hid: uninit_driver
KERN: loaded driver /boot/system/add-ons/kernel/drivers/dev/input/ps2_hid
KERN: ps2: devfs_publish_device input/touchpad/ps2/alps_0, status = 0x00000000
KERN: ps2: devfs_publish_device input/keyboard/at/0, status = 0x00000000
KERN: ps2: keyboard found
Version 0, edited 12 years ago by ttcoder (next)

comment:2 by ttcoder, 12 years ago

The fact that the touchpad buttons work completely, yet the trackpad buttons do not, is intruiguing: what exactly differs from the latter to the former ?

(BTW my previous comment mixed stuff up.. it's the touchpad which is handled by the ps2 module... so what module/driver handles the trackpad ?)

comment:3 by mks, 12 years ago

Hm, just to make this clear … I think you mean trackpoint (the little red knob) not trackpad. ;)

Without a look at the source code I guess it could be that the buttons have different numbers and the applications have something like (pseudo code)

if (buttonNumber == 1 && doubleclick) {
  performAction();
}

Perhaps I can look into this later, but I'm a little short on spare time atm.

comment:4 by ttcoder, 12 years ago

I stand corrected (though as my more humorous self would jest, "ThinkPad, touchpad, trackpad, trackpoint.. what's the difference!" ;-)

Seriously, I jumped on this ticket after seeing it but in truth it's low priority for me as well; the, errrrr, other pad buttons are an easy reach just a couple inches below and they work fine 8-)

comment:5 by bryanv, 12 years ago

I have a Dell Latitude D620 with an alps trackpoint / trackpad combo.

I have quite a few complaints about it...

1.) The trackpoint doesn't work for moving the pointer.

It detects pressure, and apparently interprets that as a click?

2.) The L&R buttons below the trackpoint don't work at all. 3.) The trackpad tracking is horrible. I can't seem to get the mouse settings adjusted for a reasonable response.

comment:6 by mks, 12 years ago

I wrote a minimal test program (which I will attach for reference). The TrackPoint buttons all generate messages like this one:

BMessage('_MDN') {
        when = int64(0x80139627deb54d44 or -9217858914312958652)
        buttons = int32(0x4 or 4)
        clicks = int32(0x0 or 0)
        be:delta_x = int32(0x0 or 0)
        be:delta_y = int32(0x0 or 0)
        modifiers = int32(0x0 or 0)
        screen_where = BPoint(x:253, y:210)
        _view_token = int32(0x4 or 4)
        where = BPoint(x:186, y:119)
        be:view_where = BPoint(x:186, y:119)
}

I.e. the clicks count is always 0.

Now I don't know where to look further.

by mks, 12 years ago

Attachment: MouseTest.cpp added

comment:7 by mks, 12 years ago

Summary: Thinkpad trackpoint buttons do not work properly'Clicks' not set in MouseDown messages on Thinkpad TrackPoint buttons

comment:8 by siarzhuk, 12 years ago

Can you recompile and test ps2 bus manager with activated tracing? If no I can prepare such module for you. Which haiku build do you use - gcc2 or gcc4?

comment:9 by mks, 12 years ago

Yesterday I tried to recompile app_server with enabled tracing in Window.cpp to see if the clickCount is correct in there. (I don't really have an idea of what I'm doing so I kinda tried to work my way from the top down)

But I failed, as the resulting binary didn't run. So to answer your question, I guess I can't. ;)

I have hrev45129 installed on a thumb drive. I am pretty certain that it is the gcc2hybrid version.

comment:10 by siarzhuk, 12 years ago

Hm... IMO, it is too late to check for click count in any window. ;-) In the same way as your test program window they will receive the _MDN with clicks equal to zero, I think. ;-) But I spoke about ps2 bus manager http://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/bus_managers/ps2/ps2_common.h#n32 Just uncomment this line and rebuild with

jam -q ps2

command, than preserve your existing copy of ps2 module and replace it with one you have just compiled. Than purge your /var/log/syslog and reboot. After reboot your mouse become dog slow and your syslog will be filled with lot of ps2 initialization information. It will be very kind of you if you make a copy of syslog just after system boot finishes. Than purge syslog with

echo . > /var/log/syslog

command and press your TrackPoint buttons as many times as you need to provide enough info about buttons commands into log and make a copy of syslog after this. Naturally, it is a good idea to attach both syslog copies to this ticket.

ps2 bus manager is a starting point where those button events are entering the system so this tracing information may be helpfull to seek the source of your problem. So, good luck.

PS: Be aware of using mixed-compiled modules in your hybrid system - if you have gcc2hybrid - you have to build gcc2 version and gcc4 version in opposite case.

comment:11 by mks, 12 years ago

http://cgit.haiku-os.org/haiku/tree/src/servers/app/Window.cpp#n854

clickCount The number of subsequent, no longer than double-click
interval separated clicks that have happened so far. This number doesn't
necessarily match the value in the message. It has already been
pre-processed in order to avoid erroneous multi-clicks (e.g. when a
different button has been used or a different window was targeted). This
is an in-out variable. The method can reset the value to 1, if it
doesn't want this event handled as a multi-click. Returning a different
click target will also make the caller reset the click count.

… seemed "suspicious" to me and I don't know the input handling code, or any Haiku internal code for that matter. Plus I didn't know where the BMessage is generated and figured I had to start somewhere. I did this before your hint with ps2_bus_manager and I would prefer it if you left out the attitude next time.

Nevertheless I am attaching two logs, syslog.0 is right after boot up, firing up the console and copying the syslog. syslog.2 is just a few clicks and again the copying.

Hope, somebody can help make sense of the output, especially the data values.

by mks, 12 years ago

Attachment: syslog.0 added

Right after bootup

by mks, 12 years ago

Attachment: syslog.2 added

A few clicks with the DualPoint

comment:12 by siarzhuk, 12 years ago

Just some ideas after the short trip in source cross-reference.

The mouse message is build in input_server mouse device src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp somehere at line 445, corresponding movement_maker struct is filled in ps2 bus_manager probably in src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.cpp ps2_packet_to_movement() call. So you may try to trace these places for some more ideas about misinterpretation your trackpoint data.

comment:13 by korli, 12 years ago

Since the device is detected as alps, handling happens in src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp. movement->clicks isn't set at all at in this case. See here for how it should be done.

Another problem though is that the state of cookie->movementMaker is inconsistent (TouchpadMovement::fButtonsState for instance). A simple solution would be to change TouchpadMovement::_UpdateButtons to public scope, and call it after settings clicks.

by mks, 12 years ago

This fix, suggested by korli, works. The timestamp wasn't set either.

comment:14 by mks, 12 years ago

patch: 01

comment:15 by mks, 12 years ago

I had to remove the inline or it wouldn't link. I am not sure if that's OK.

in reply to:  15 comment:16 by siarzhuk, 12 years ago

Replying to mks:

Nice. Could you please provide some info about your "author name" and <e-mail address> you would like to see in corresponding commit message? Thank you.

comment:17 by mks, 12 years ago

Oh, sure thing.

Michael Kanis <mks@…>

comment:18 by axeld, 12 years ago

It's best to use git format-patch to create the patch -- this will even already contain the commit message, and the commit will be attributed to you in the commit history. See SubmittingPatches for more information.

by mks, 12 years ago

Same patch but created with git format-patch

comment:19 by siarzhuk, 12 years ago

Resolution: fixed
Status: newclosed

Applied in hrev45224. Thank you for the contribution!

Note: See TracTickets for help on using tickets.