Bug 90206 - More complete input rebinding support
Summary: More complete input rebinding support
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/libinput (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on: 90208
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-28 00:13 UTC by Mal Haak
Modified: 2015-04-30 01:35 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mal Haak 2015-04-28 00:13:39 UTC
I have a logitech trackball. 

I rebind the useless back and forward buttons into middle click for copy/paste duties and to turn the trackball into my 4 way scroll wheel. 

Libinput does not support this at all. This breaks my workflow completely. 

An example of what I am trying to achieve is listed here: 

http://blog.karssen.org/2010/09/11/linux-the-logitech-trackman-marble-and-emulating-a-scroll-wheel/ 

These kinds of customizations aren't just nice to have, they are one of the reasons I use a Linux desktop.
Comment 1 Peter Hutterer 2015-04-28 01:20:06 UTC
see libinput_device_config_scroll_set_button() for how to change the scroll button, most mice/trackballs have scrolling enabled this way. So that part at least is possible in libinput.

Coincidentally, if you can attach an evemu-describe of this trackball that would be much appreciated.

As for more general button remapping, I think this will be left to the caller of libinput. There are a bunch of button mappings that are a lot more complex than a simple A->B remapping (see the wacom button mapping panel in GNOME for example), so libinput would be doing a disservice here by providing a low-level but incomplete mapping facility.
Comment 2 Mal Haak 2015-04-28 04:58:08 UTC
Ok, so libinput_device_config_scroll_set_button() would allow me to define a button that when pressed changes things so that mouse movements are interpreted as 4 way scroll actions?

# evemu-describe /dev/input/event4
N: Logitech USB Trackball
I: 0003 046d c408 0110
P: 00 00 00 00 00 00 00 00
B: 00 17 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 1f 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 02 03 00 00 00 00 00 00 00
B: 03 00 00 00 00 00 00 00 00
B: 04 10 00 00 00 00 00 00 00
B: 05 00 00 00 00 00 00 00 00
B: 11 00 00 00 00 00 00 00 00
B: 12 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00


I guess my issue with your last statement is that there doesn't appear to be anything able to do the mapping you speak of when using libinput with Xorg. The Xorg support being a shim that I believe you created? It might be a different kettle of fish when using Wayland. 

Are there xorg.conf entries I can add or something? I couldn't find anything in the API documentation as I understand that is more for the people building things that use libinput not for end users attempting to do things with it. 

I guess in the context of Xorg, this feels like a step backwards possibly because the thing you are replacing did a number of things that 'in the future' will now be done by somebody else, but in the now if you aren't providing the functionality and others aren't exposing what you do provide, we are left with unconfigurable things.  

I'm happy to be wrong, but if I am that means the documentation around this whole thing is woefully insufficient and/or unindexed in pretty much every major search engine.
Comment 3 Peter Hutterer 2015-04-28 06:45:01 UTC
(In reply to Mal Haak from comment #2)
> Ok, so libinput_device_config_scroll_set_button() would allow me to define a
> button that when pressed changes things so that mouse movements are
> interpreted as 4 way scroll actions?

yes. IMO this should be automatically enabled on your trackball, I filed Bug 90208 for this now.

and after typing a different comment I now see this was filed against the xorg libinput driver, not libinput itself, sorry, I misread. I'll have a look at the driver.

Meanwhile: xinput set-button-map sets the button mapping in X but it it's runtime only.
Comment 4 Mal Haak 2015-04-28 07:13:19 UTC
(In reply to Peter Hutterer from comment #3)
> (In reply to Mal Haak from comment #2)
> > Ok, so libinput_device_config_scroll_set_button() would allow me to define a
> > button that when pressed changes things so that mouse movements are
> > interpreted as 4 way scroll actions?
> 
> yes. IMO this should be automatically enabled on your trackball, I filed Bug
> 90208 for this now.

Interestingly I would actually claim this trackball is functioning as designed. The issue was more with changing its design. It doesn't actually have a button used to enable scroll. Its one of those odd devices that has a Forwards and Backwards buttons. One of which I repurpose to do the job of a scroll button. Which I guess was the quest I set out on. 

> 
> and after typing a different comment I now see this was filed against the
> xorg libinput driver, not libinput itself, sorry, I misread. I'll have a
> look at the driver.

Thanks for that! It's all good, I don't want to sound too grumpy, but there has been a bit of a trend of late for things that are new throwing babies and bathwater in the name of advancement. 

> 
> Meanwhile: xinput set-button-map sets the button mapping in X but it it's
> runtime only.

Xinput set button map. I will look at this. I'm assuming that as long as I bind a button to the 'scroll button' it would enable the 4 way scrolling with the trackball? Well once the other bug its sorted?
Comment 5 Peter Hutterer 2015-04-28 07:34:38 UTC
urgh, sorry, incomplete answer from my side. lemme try again :)


xinput set-button-map is what you'd use to remap the back button to the middle button (judging by the first comment that's what you want to do).

xinput set-prop "device name" "libinput Button Scrolling Button" <somenumber> is what you use to bind the button as scroll button
and 
xinput set-prop "device name" "libinput Scroll Method Enabled" 0 0 1
to enable button scrolling on the device.
That is possible through a xorg.conf snippet though:

Section "InputClass"
   Identifier "trackball middle button scrolling"
   MatchDriver "libinput"
   MatchProduct "Logitech USB Trackball"
   Option "ScrollMethod" "button"
   Option "ScrollButton" "2"
EndSection

That's for the middle button (2), if you want forward/back the buttons will be 9 and 8 iirc (xev will tell you). The other bug is purely for enabling this by default.
Comment 6 Mal Haak 2015-04-28 10:52:37 UTC
(In reply to Peter Hutterer from comment #5)
> urgh, sorry, incomplete answer from my side. lemme try again :)

Seriously thanks for this!


> xinput set-button-map is what you'd use to remap the back button to the
> middle button (judging by the first comment that's what you want to do).

Yep.

> xinput set-prop "device name" "libinput Button Scrolling Button"
> <somenumber> is what you use to bind the button as scroll button
> and 
> xinput set-prop "device name" "libinput Scroll Method Enabled" 0 0 1
> to enable button scrolling on the device.

So this will be press button and then 4 way scrolling with the trackball?

> That is possible through a xorg.conf snippet though:
> 
> Section "InputClass"
>    Identifier "trackball middle button scrolling"
>    MatchDriver "libinput"
>    MatchProduct "Logitech USB Trackball"
>    Option "ScrollMethod" "button"
>    Option "ScrollButton" "2"
> EndSection
> 
> That's for the middle button (2), if you want forward/back the buttons will
> be 9 and 8 iirc (xev will tell you). The other bug is purely for enabling
> this by default.

Thanks for this. Is there some documentation I can read up on the LibInput things I can do with xinput. Seems like it would make sense for me to go off and do some reading, instead of picking your brain.
Comment 7 Peter Hutterer 2015-04-28 11:38:27 UTC
> > xinput set-prop "device name" "libinput Button Scrolling Button"
> > <somenumber> is what you use to bind the button as scroll button
> > and 
> > xinput set-prop "device name" "libinput Scroll Method Enabled" 0 0 1
> > to enable button scrolling on the device.
> 
> So this will be press button and then 4 way scrolling with the trackball?

yes, if you look at the libinput man page you'll see what the values represent.

> Thanks for this. Is there some documentation I can read up on the LibInput
> things I can do with xinput. Seems like it would make sense for me to go off
> and do some reading, instead of picking your brain.

man libinput is for the xorg driver which exposes most of libinput's settings as properties that can be changed with xinput. and it has a link to the actual libinput doc page in there too.
Comment 8 Mal Haak 2015-04-28 11:56:27 UTC
(In reply to Peter Hutterer from comment #7)
 
> man libinput is for the xorg driver which exposes most of libinput's
> settings as properties that can be changed with xinput. and it has a link to
> the actual libinput doc page in there too.

Here is me looking for documentation online when I should have gone back to basics and RTFMP

Thanks man! You've got a new fan here. Keep up the being awesome!
Comment 9 Peter Hutterer 2015-04-28 23:52:19 UTC
http://patchwork.freedesktop.org/patch/48173/
Comment 10 Peter Hutterer 2015-04-30 01:35:28 UTC
commit d6ce065cea25785a8d03d27d723846e583c55e3b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Apr 29 09:30:14 2015 +1000

    Add option "ButtonMapping" (#90206)


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.