Can we map 'events' to specific mouse controls?

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

Can we map 'events' to specific mouse controls?

#1 Post by Mike Walsh »

Evening, all.

Now then, boys & girls; got a bit of a 'poser' for y'all.

Uncle Mike's treated himself to yet another mouse. (God, not another one....) Yes, another one.

This one is from a relative newcomer to this market, a Taiwanese company called VicTsing. Although I don't have especially large hands - distinctly average, in fact - I do like a large, chunky mouse.....and this is something VicTsing specialise in.

This is a Bluetooth-enabled/2.4 GHz wireless model, capable of controlling 3 devices at a time; one via standard dongle, + 2 via built-in Bluetooth.....switchable via a control underneath. Anyways; I'm getting away from the object of this post.

----------------------------------

This particular model has a 'thumb-wheel', for horizontal scrolling, OK? VicTsing say it only works in Macs; sure enough, OOTB, it does nothing in Linux (at least, not in Sailor's Slacko 571 're-spin', although the kernel I'm using may be too old to recognise it). However; I bought this because it's a good alternative to the Logitech MX Master 3, which costs around a ton....and I am not spending that much on a mouse.

There's enough web-sites around with wider-than-average pages that horizontal scrolling becomes tedious after a while. (Hell, it even happens here on the Forum, when somebody posts from a monster huge display, and for some reason the Forum software can't translate that to smaller screens...)

Anyways:-

In the Chromium-based browsers, horizontal (or "sideways") scrolling can be achieved, relatively easily, by holding Shift down while using your scroll-wheel. What I'm wondering is how to find out the "access" to the mouse's thumb-wheel, and to achieve the objective permanently by "mapping" the Shift+scroll command to it. Obviously, this would have to be the standard 'scroll' command, but with a 'modifier'.....or so I'm guessing.

Is it even possible? Is it 'do-able'? Any & all sensible suggestions will be much appreciated, as always.

TIA!


Mike. :wink:
Last edited by Mike Walsh on Fri 29 May 2020, 01:36, edited 1 time in total.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#2 Post by disciple »

If you run xev in a terminal it tells you what inputs your mouse and keyboard are producing. If the horizontal wheel doesn't produce any events I think you will need to write or find another driver for your mouse. Presumably it won't because otherwise why would they say it doesn't work?

Or maybe you just need to mess with the "protocol" or remap the "buttons" with xmodmap. We do have howtos related to this here, but I'm going to provide this link instead of looking for them: https://www.google.com/amp/s/www.howtof ... linux/amp/
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#3 Post by Mike Walsh »

disciple wrote:If you run xev in a terminal it tells you what inputs your mouse and keyboard are producing. If the horizontal wheel doesn't produce any events I think you will need to write or find another driver for your mouse. Presumably it won't because otherwise why would they say it doesn't work?
@ disciple:-

Thanks for the link.

It's a known fact that the Apple 'Magic Mouse' handles horizontal scrolling by default. My guess is that VicTsing have simply set the mouse up to reproduce the Mac input codes.

MacOS and Linux share many common areas 'under the hood'. It's also my guess that there ought to be a way to 'recognise' the thumb-wheel and assign codes to it.....

Everything else on the mouse - left/right/centre click, & thumb buttons (back/forth, etc) works as expected. It's not a deal-breaker - I'm happy with the mouse if I can't get the thumb-wheel to work - but it would be nice (and satisfying!) to achieve the 'impossible'..... :lol:


Mike. :wink:

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#4 Post by jafadmin »

Mike, I seem to recall there is a CL utility you can run that will display event codes of keyboard and mouse clicks that you press.

I think it is one of the X utilities .. :?

Edit: https://unix.stackexchange.com/question ... dmap#49651

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#5 Post by Mike Walsh »

@ jafa:-

Thanks for chiming in.

As far as xmodmap's 'keysyms' go, back when Mochi assisted me with re-mapping some keys on the old Dell (after spilling half-a-mug of coffee down the right-hand side!), I used this page from the LQwiki:-

http://wiki.linuxquestions.org/wiki/Lis ... by_Xmodmap

.....which proved invaluable. Reverting to the 'project' at hand, and following the tutorial disciple linked me to, xev gives me the following:-

-------------------------------

Left-click:-

Press - button 1, state 272
Release - button 1, state 16

Middle-click:-

Press - button 2, state 528
Release - button, state 16

Right-click:-

Press - button 3, state 1040
Release - button 3, state 16

Thumb-button forward:-

Press - button 2, state 528
Release - button 2, state 16

Thumb-button back:-

Press - button 3, state 1040
Release - button 3, state 16

~~~~~~~~~

Scroll up - button 4, state 16
Scroll down - button 5, state 16


-------------------------------------

Which goes to prove two things (I've edited most of the extraneous crap out here, 'cos xev produces a lot of it). 'State 16' appears to be a general button-release code.....and the thumb-buttons correspond to middle-click/right-click actions. Exactly as predicted, 'cos they do in every Pup.

Entering

Code: Select all

xmodmap -pp
.....into the terminal gives the following:-

Code: Select all

# xmodmap -pp
There are 10 pointer buttons defined.

    Physical        Button
     Button          Code
        1              1
        2              2
        3              3
        4              4
        5              5
        6              6
        7              7
        8              8
        9              9
       10             10

#
All well & good. I can see where buttons 1 thru 5 are used.....but what on earth do buttons 6 thru 10 refer to?

And finally:-

This is the relevant section of xorg.conf (I'm using Sailor's Slacko 5.7.1 tonight, enhanced with battleshooter's Glibc-2.20 'upgrade', and running DPup 'Stretch's' k4.1.48 kernel, because Slacko's original 3-series was too old to recognise the audio hardware on this brand-new HP Pavilion!)

Code: Select all

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option      "Protocol" "IMPS/2" #mouse0protocol
	Option      "Device" "/dev/mouse"
	#Option     "Emulate3Buttons"
	#Option     "Emulate3Timeout" "50"
	Option      "ZAxisMapping" "4 5" #scrollwheel
EndSection
Which goes to prove that since all buttons are working A-OK, I don't need to change the "Protocol", and the scroll-wheel 'buttons', as expected, refer to the 'ZAxisMapping' entry line.

Now if I could get that 'thumb-wheel' recognised, and determine the button codes that are being assigned to it - and figure out a way to add a new "....AxisMapping" line for a second wheel, we'd be in business.....

Yeah; and pigs may yet figure out a way to fly..! I've a nasty feeling I'm on a hiding to nothing..... I reckon I need to boot into Bionicpup64, the kennel's 'youngest' inhabitant, and see if owt's recognised there.


Mike. :wink:
Last edited by Mike Walsh on Fri 29 May 2020, 00:32, edited 1 time in total.

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

#6 Post by enrique »

Wao god stuff I have no Idea we have. Thanks for the opportunity to let me learn.

Edit;
I found this php script to capture and display

https://stackoverflow.com/questions/596 ... ck-in-bash

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#7 Post by Mike Walsh »

Well, it's obviously another of those kernel-related issues.

Just booted into Bionicpup64. Here, in the browser, the 'thumb-wheel' just works, OOTB!

Interestingly, there is no mention of the mouse in Bionic's xorg.conf at all. Only the keyboard.... It appears the "evdev" driver is in use here, although taking a nose-around in /dev/input/by-id & /dev/input/by-path, the new mouse's wireless dongle is definitely recognised by the kernel.

So; if xorg.conf hasn't been re-written to take account of it, how the hell is it functioning.....bearing in mind that xorg.conf is what tells the X-server both how to recognise it, and what to do with those inputs?

Be interesting to see if this will survive a re-boot...

EDIT:- Whoo; it does. Well, I ain't complaining; it's in the browser where I need it.....and certainly, in Opera at least, it just works. And (takes a deep breath)

Vivaldi.....and Chrome.....and Yandex.....and Iron.....and Brave. Also Quantum.....FF68esr.....and even Pale Moon. (The last 3 surprised me; somewhere, earlier on, I read that the Mozilla-based browsers need tweaking in about:config to be able to use horizontal scrolling.....)

Hell. I'd say that's pretty comprehensive proof. That'll do me..! :D


Mike. :wink:

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

#8 Post by enrique »

mike you are on the right track. In just hours you fond a working Poppy.

Lets assume is a driver issue. And that you want to used it in a previous kernel. Then you need to find your drivers sources, so that you can compiler it for the kernel you intend it to used. Well Assuming it will be your future mouse then having that source will prove to be useful in the future.

If vendor does not provide it, then you can grab it from working kernel.

Now try to identify your drivers, run working Puppy
remove the USB adapter and replug then
#dmesg
and Identify USB.

Now let get driver info
#lsusb -t

Then see how it relate to other drivers on Puppy
#lsmod | grep hid

Then is an issue of searching working kernel sources from that driver. The objective is to find how to enable kernel config for the mouse.
Finally trying to enable that config on old kernel. If that fail, then try insert those sources on old kernel. This is called backporting

Yes it seems long procedure but you will do it to save you honor and be able to used your new affordable mouse. Again you are in the right track.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#9 Post by Mike Walsh »

I gave this a try in Xenialpup64, out of curiosity, but it's a no-go. Tried changing up to Bionicpup's kernel, but that then threw up problems with the Nvidia driver, 'cos it wasn't the kernel it was compiled against.....everything dropped back to low-res VESA. Re-compiling would have been a waste of time, since neither the Xenial devx or the Bionic one would actually be 'correct' any longer, nor the 'headers'......Auggh. Not going there.

So; the only Pup this thumb-wheel will behave in is Bionicpup64. 'Sokay; it's still a darned smart mouse without it. (I suspect there's more to it than just the kernel; I'm guessing that newer versions of OpenGL and Mesa probably have summat to do with it as well...)

I can live with that.


Mike. :wink:

User avatar
666philb
Posts: 3615
Joined: Sun 07 Feb 2010, 12:27
Location: wales ... by the sea

#10 Post by 666philb »

hi Mike Walsh,

in xenial you could try editing /etc/X11/xorg.conf change this line to true

Code: Select all

	Option "AutoAddDevices" "true"
or try using xenials /etc/X11/xorg.conf.udev (rename to xorg.conf) not sure this works in xenial though.
Bionicpup64 built with bionic beaver packages http://murga-linux.com/puppy/viewtopic.php?t=114311
Xenialpup64, built with xenial xerus packages http://murga-linux.com/puppy/viewtopic.php?t=107331

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#11 Post by Mike Walsh »

666philb wrote:hi Mike Walsh,

in xenial you could try editing /etc/X11/xorg.conf change this line to true

Code: Select all

	Option "AutoAddDevices" "true"
or try using xenials /etc/X11/xorg.conf.udev (rename to xorg.conf) not sure this works in xenial though.
Hallo, Phil. How's everything down in 'the valleys'?

Umm. O-kay. So.....Edit; save; restart 'X', yes? I backed her up just a couple of hours ago, so I sha'n't need to do that again....


Mike. :wink:

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#12 Post by Mike Walsh »

Now, then:-

Changing that line from "false" to "true" has indeed 'done the trick'. Horizontal scrolling now works in all the browsers. (Upon re-starting "X", all I got was a dead mouse & dead keyboard. Stirred the old grey cells a bit.....of course, this is kernel-related stuff. Needs a re-boot, so..... Bingo. Sorted..?)

Well, not quite. I had to unplug/re-plug the mouse & keyboard receiver dongles to create new inodes, obviously. But this needs to be re-done at every boot, 'cos otherwise it doesn't seem to 'see' them. Do we need to force-load a new kernel module here?

(And the keyboard reverts to US settings, and I've got the 'up arrow' mtPaint thing back. Again!)

EDIT:- Fixed the mtPaint thing (I never use it) by commenting it out in /root/.jwm/jwmrc-personal. Sooo.....how do we "force" it to start up with the GB layout rather than the "default" US one? :?:


Mike. :?

Post Reply