Bug 32200 - Workaround configuration for mouse buttons such as R.A.T. mode button
Summary: Workaround configuration for mouse buttons such as R.A.T. mode button
Status: RESOLVED WONTFIX
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/evdev (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
: 73443 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-07 14:25 UTC by Darren Salt
Modified: 2014-01-09 20:28 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
AutoReleaseButtons configuration option (9.72 KB, patch)
2010-12-07 14:25 UTC, Darren Salt
no flags Details | Splinter Review
AutoReleaseButtons configuration option (v2) (10.03 KB, patch)
2011-03-18 12:26 UTC, Darren Salt
no flags Details | Splinter Review
xf86-input-evdev AutoReleaseButtons configuration option (3.87 KB, patch)
2014-01-01 01:14 UTC, Jérôme Carretero
no flags Details | Splinter Review

Description Darren Salt 2010-12-07 14:25:36 UTC
Created attachment 40885 [details] [review]
AutoReleaseButtons configuration option

This patch adds a configuration option for mice such as those the Saitek R.A.T. series which have buttons which cycle through a sequence of button numbers and don't report the release event until next clicked.

Example usage:

Section "InputClass"
	Identifier	"R.A.T.-7"
	MatchUSBID	"06a3:0ccb"
	Driver		"evdev"
	Option		"Buttons"		"17"
	# Mapping the thumb wheel as buttons 7 and 6 for H scroll
	Option		"ButtonMapping"		"1 2 3 4 5 0 0 8 9 7 6 12 13 14 15 16 17"
	# The "mode" button (left of button 1) generates odd release/press
	# events: the release is reported when it's next clicked, and a
	# different button number is reported for the click.
	# We have to assume that it's instantly released.
	Option		"AutoReleaseButtons"	"13 14 15"
	# Two scroll wheels
	Option		"ZAxisMapping"		"4 5 6 7"
EndSection
Comment 1 Peter Hutterer 2010-12-07 15:58:05 UTC
can you describe in more detail what's the actual problem here? I can get it from the InputClass comment but a bit more detail would be nice. Thanks.
Comment 2 Darren Salt 2010-12-07 16:38:49 UTC
More detail follows. Button numbers are reported here unmapped.

First click: button 13 down.
Second click: button 13 up, button 14 down.
Third click: button 14 up, button 15 down.
Fourth click: button 13 down, button 15 up.
Fifth click: as second.

It seems that without this patch and associated configuration, X is handling mouse movement after the first click as dragging.

For mice such as these, some suitable auto-release (or instant-release, if you like) configuration should probably be selected by default, but we're into quirks database territory there...
Comment 3 Peter Hutterer 2010-12-07 17:22:45 UTC
I take it the evtest output shows the same?

sounds like intentionally broken hardware to me...
Comment 4 Darren Salt 2010-12-08 10:05:27 UTC
It does.

Event: time 1291830645.966730, type 4 (Misc), code 4 (ScanCode), value 90009
Event: time 1291830645.966735, type 1 (Key), code 280 (?), value 1
Event: time 1291830645.966739, type 4 (Misc), code 4 (ScanCode), value 9000b
Event: time 1291830645.966742, type 1 (Key), code 282 (?), value 0
Event: time 1291830645.966749, -------------- Report Sync ------------
Event: time 1291830651.273195, type 4 (Misc), code 4 (ScanCode), value 90009
Event: time 1291830651.273201, type 1 (Key), code 280 (?), value 0
Event: time 1291830651.273204, type 4 (Misc), code 4 (ScanCode), value 9000a
Event: time 1291830651.273207, type 1 (Key), code 281 (?), value 1
Event: time 1291830651.273215, -------------- Report Sync ------------
Event: time 1291830653.473973, type 4 (Misc), code 4 (ScanCode), value 9000a
Event: time 1291830653.473979, type 1 (Key), code 281 (?), value 0
Event: time 1291830653.473982, type 4 (Misc), code 4 (ScanCode), value 9000b
Event: time 1291830653.473985, type 1 (Key), code 282 (?), value 1
Event: time 1291830653.473994, -------------- Report Sync ------------
Comment 5 Peter Hutterer 2010-12-08 19:10:54 UTC
Review of attachment 40885 [details] [review]:

not a big fan of this option because I expect a user-base of less than 10 over the lifetime of the driver. Either way, some comments on the patch.

- man page hunk missing
- can we share the option parsing code between draglock and autorelease somehow. it's not 100% identical, but close
- EvdevAutoReleaseButton can be replaced with calls to EvdevQueueButtonClicks
- CARD8 should be enough for the property
- please don't use CARD32 in the header file, just use uint32_t or similar
- typo in "fires button event messges */
- property should be list of button numbers instead of a bitmask. can still be a bitmask internally.
- style: no {} for single-line blocks please
- please add a comment at the top of the source file explaining what this feature does so that the next person can quickly get a grasp on the intent without having to browse git history.
- use TestBit for bit testing instead of manual & (<<)
Comment 6 Darren Salt 2011-03-18 12:26:20 UTC
Created attachment 44592 [details] [review]
AutoReleaseButtons configuration option (v2)

Updated version of the patch.

This adds a paragraph to the man page, gets rid of EvdevAutoReleaseButton (and the typo), uses uint32_t instead of CARD32, fixes some style issues (was copying style used elsewhere in the source...), and adds a descriptive comment.

Sharing of option parsing with the drag-lock code is not done; not sure that that's appropriate, really.

The property is still a bitmask and therefore can't sensibly be CARD8. TestBit seems to be for arrays...
Comment 7 Peter Hutterer 2011-03-21 23:50:55 UTC
(In reply to comment #6)
> The property is still a bitmask and therefore can't sensibly be CARD8. TestBit
> seems to be for arrays...

property as a list of CARD8 instead of a bitmask. if we ever change MAX_BUTTONS to higher than 32, the 32-bit bitmask would break.

btw, have you considered a kernel hack for this instead? it seems that other userspace processes would suffer as well from this broken hardware so we might as well fix it in one spot
Comment 8 Darren Salt 2011-03-23 05:39:14 UTC
Done, for the R.A.T.7. https://patchwork.kernel.org/patch/653481/

If that is accepted then the evdev patch still remains useful for working around this kind of thing in other mice until the kernel is patched for them. (I don't yet have the USB IDs for the other R.A.T. mice.)
Comment 9 Jérôme Carretero 2014-01-01 01:12:21 UTC
Darren's evdev patch has probably more chances of being included somewhere than the kernel patch. Updated it.
Comment 10 Jérôme Carretero 2014-01-01 01:14:36 UTC
Created attachment 91378 [details] [review]
xf86-input-evdev AutoReleaseButtons configuration option
Comment 11 Peter Hutterer 2014-01-06 05:23:25 UTC
Sorry, I won't merge this patch in evdev. The device in question breaks the evdev protocol by pressing a button but not releasing it when the button was released. It needs some quirk in the kernel rather than a generic option that needs to be manually configured, etc. Benjamin, can you have a look at the kernel patch please?
Comment 12 Benjamin Tissoires 2014-01-06 17:13:18 UTC
Regarding the kernel patch, I just noticed that somebody resubmitted it recently with the addition of others USB VID/PID. I will reply on the LKML, but also here.

Here are my comments:
- the quirk should be addressed in hid-saitek, not in hid-input (it is a very specific quirk)
- I don't think the set_bit call is needed. It should be done by input_event
- the previous thing may have been needed because you may need to send an input_sync event in between the press and release
- Why having 3 different buttons for the same button (I understand it is a mode, but as it is buggy currently)? I would say we should map only one input button to the physical button and release it once it is pressed. This way, you can map whatever to the physical button, and not depend on the current mode.
Comment 13 Benjamin Tissoires 2014-01-09 20:28:55 UTC
*** Bug 73443 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.