PDA

View Full Version : [ubuntu] Ubuntu control bottom two buttons on Thinkpad t410 touchpad?



dutchg
March 17th, 2021, 04:12 PM
I'm a new Linux user running Ubuntu 20.04 on a Lenovo Thinkpad t410. I'm looking to change the behavior of the two buttons below the thinkpad's touchpad (https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.notebookcheck.net%2Ffileadmin% 2F_migrated%2Fpics%2Flenovo_thinkpad_t410_touchpad 0.jpg&f=1&nofb=1). I'd like them to match the functions of the upper two buttons and basically operate as left/right mouse buttons. The Ubuntu settings don't address those bottom buttons. Someone on another forum suggested I try gnome tweaks, but that didn't provide any controls for those buttons either. If anyone can point me in the right direction for a solution, I'd appreciate it.

Holger_Gehrke
March 18th, 2021, 01:24 AM
With Ubuntu 20.04 you have the choice between running with the newer, supposedly faster Wayland or the older X11, which has a lot more features (which is the reason Wayland is supposed to be faster, it leaves out everything that isn't used by the majority of modern applications). You should be able to choose the kind of graphical session you want to run on the login screen.

If you're using Wayland, I believe (but can't be sure, I'm using XUbuntu and the XFCE Desktop doesn't yet run on Wayland) the graphical setting utilities are all there is and if there are no options for your buttons then that's it.

If you're running in X11 there are things you can try outside of the graphical tools. Open a terminal (either from 'Activities' or with the key combination ctrl-alt-t) and enter
xinput --listYou should get output similar to this


⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ ETPS/2 Elantech Touchpad id=13 [slave pointer (2)]
⎜ ↳ USB Optical Mouse id=9 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]

The interesting thing is obviously the line for your touchpad (mine is an 'ETPS/2 Elantech Touchpad', a simple pad with just two hardware buttons)
So let's get some details about the pad
xinput --list 'ETPS/2 Elantech Touchpad'Substitute the name of your pad as given by the previous command for 'ETPS/2 Elantech Touchpad'. The quotes around the name are important, otherwise the shell will split the name into separate words and xinput will not find the device. You will get output that starts similar to this:


ETPS/2 Elantech Touchpad id=13 [slave pointer (2)]
Reporting 7 classes:
Class originated from: 13. Type: XIButtonClass
Buttons supported: 7
Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"
Button state:

There's a lot more after that part, but it's not relevant to what we're trying to do. So my simple two buttons 'magically' turn into seven ... actually the "Button Middle" is left and right together and presses of all the "Wheel"-buttons are generated by the scrolling gestures. If the additional buttons on your pad can be seen by libinput, your 'Buttons supported:'-line should give 9 or possibly more and you should have some additional 'Button labels', too. If that's the case, let's find out the numbers for those buttons. Hold one of the buttons and repeat the previous command (you can use the "cursor up" and "cursor down" keys to go through old commands in the shell; press 'cursor up' once then hit enter). The output should be the same except for the 'Button state:' line. The number for any buttons on the pad held during the execution of the command should be printed there. Remember that number and repeat the procedure with the other button. So now you have numbers for lower left and lower right buttons (probably 8 and 9).

You can now remap those buttons with


xinput --set-button-map 'ETPS/2 Elantech Touchpad' 1 2 3 4 5 6 7 1 3

Remember to replace the name of your touchpad for the name of mine in that command. The list of numbers at the end is one number for each button the pad has. So button 1 through 7 produce their actual button but button 8 should be considered the same as 1 and button 9 is the same as 3. Since my pad doesn't have additional buttons I could only test it on my mouse - which has - and there it worked. Change that list as needed depending on the numbers reported for your additional buttons.

Once you've got a command that works, you'll need to make this command run automatically after you log in. There are multiple way to do this depending on the Desktop Environment you use. In XFCE I can just go into "Settings"->"Startup and Session" and add the command to run. I'm not sure how Gnome handles this. In the worst case you'll have to write a .desktop file and put it in ~/.config/autostart/.

Holger

dutchg
March 18th, 2021, 02:31 PM
Holger,

Thank you so much for the detailed post and the help. I just read it, and I'm going to embark on following the instructions. I'm VERY new to the linux world, so much of what you're talking about it going over my head--for now--but I'm going to give it a close read and learn what I can. I may be back with more questions! But really, thanks for taking the time.

Dutch

mastablasta
March 18th, 2021, 03:08 PM
well first thing is - identify you touchpad

mine is synaptics and at first tehre seems like no further settings are available. but only a small package is then added and suddenly all touchpad settings are available in system settings and they kind of look like in windows. so first things first - identify, then we might find a GUI and if there really is no GUI one can edit config files.

once my Fn key was acting up so i set my windows key as FN key. problem solved.

dutchg
March 18th, 2021, 03:17 PM
Holger, I got pretty far with your instructions, but I hit a snag. When I select buttons and re-execute the list command (which, in my case reads: "xinput --list 'SynPS/2 Synaptics TouchPad'), only two of the buttons return a number--it's those bottom two buttons I'm trying to alter, and they both register as "2." None of the other buttons show any button state when I try it with them. So I'm not sure where to go next. Any thoughts would be appreciated!

Thanks
Dutch

dutchg
March 18th, 2021, 03:22 PM
well first thing is - identify you touchpad

mine is synaptics and at first tehre seems like no further settings are available. but only a small package is then added and suddenly all touchpad settings are available in system settings and they kind of look like in windows. so first things first - identify, then we might find a GUI and if there really is no GUI one can edit config files.

once my Fn key was acting up so i set my windows key as FN key. problem solved.

Thanks for your note. My touch pad is 'SynPS/2 Synaptics TouchPad'.

Holger_Gehrke
March 19th, 2021, 12:57 PM
Please run this command


dpkg -l 'xserver-xorg-input-*'|grep '^ii'

to check what driver for the touchpad is installed on your system. There are two, the newer libinput and the older synaptics. 'libinput' was written from the ground up as a framework for all kinds of input devices with extensibility as one goal and I assumed you were using this since it's the default on all newer versions of Ubuntu. 'synaptics' started out as a driver for one specific touchpad and was extended over a long time to cover a lot more. It still has quite a few options that libinput doesn't have yet, but I can't find an option to remap buttons for a device. If you're using synaptic, we might end up remapping the buttons using 'xmodmap --pointer', which will remap the buttons of all pointing devices. Not a problem if you're only using the touchpad, but if you're also using a mouse with additional buttons it would remap those, too.

Holger

dutchg
March 19th, 2021, 02:27 PM
Hi Holger,

Here's the output of that command:


ii xserver-xorg-input-all 1:7.7+19unbuntu14 amd64 X.Org X server -- input driver metapackage
ii xserver-xorg-input-libinput 0.29.0-1 amd64 X.Org X server -- libinput driver metapackage
ii xserver-xorg-input-wacom 1:0.39.0-0ubuntu1 amd64 X.Org X server -- Wacom input driver

Holger_Gehrke
March 19th, 2021, 09:45 PM
The Wacom driver is for graphic tablets made by Wacom and possibly some other similar devices, so if you've got one of those connected that would explain why it's installed. Otherwise you do seem to be using libinput. I don't understand why the '--list' option prints the state for both the additional buttons as '2' (middle button, normally). Perhaps it's not printing physical buttons but the logical buttons assigned to them ? Let's check:


xinput --get-button-map 'SynPS/2 Synaptics TouchPad'

This should print a list of the all logical button numbers for each physical button, so for my pad it prints '1 2 3 4 5 6 7'.

Holger

dutchg
March 20th, 2021, 12:24 AM
That command returns the same for me: '1 2 3 4 5 6 7'.

I don't use a Wacom tablet, so I'm not sure why that's installed. I most often use the laptop without a mouse, but sometimes I do have a mouse connected. As far as I know this is a stock install of Ubuntu 20.04. I'm a real beginner with Linux. Overall, it's running great on the old Thinkpad, though, which I use mostly as a writing machine. Anyway, it'll be great if I can get control of these touchpad buttons. Thanks again for your help.

mastablasta
March 22nd, 2021, 07:04 AM
you need to use x.org, then installing xserver-xorg-input-synaptics would add additional options for synaptics in system settings as this would install the old driver. at least that's how it is in Kubuntu where you get additional panel for settings like turning off the touch pad when the mouse is plugged in and similar.

if it causes any issues, it can be uninstalled.

dutchg
March 22nd, 2021, 08:37 PM
Thanks for the thoughts, mastablasta. I'll check out x.org.

dutchg
March 24th, 2021, 12:38 PM
The Wacom driver is for graphic tablets made by Wacom and possibly some other similar devices, so if you've got one of those connected that would explain why it's installed. Otherwise you do seem to be using libinput. I don't understand why the '--list' option prints the state for both the additional buttons as '2' (middle button, normally). Perhaps it's not printing physical buttons but the logical buttons assigned to them ? Let's check:


xinput --get-button-map 'SynPS/2 Synaptics TouchPad'

This should print a list of the all logical button numbers for each physical button, so for my pad it prints '1 2 3 4 5 6 7'.

Holger


Holger, do you have any thoughts about next steps I should try? That command returns the same for me: '1 2 3 4 5 6 7'.

Holger_Gehrke
March 25th, 2021, 01:06 AM
If the 'Button Labels' list in "xinput --list 'SynPS/2 Synaptics TouchPad' " is the same as mine in my original post (https://ubuntuforums.org/showthread.php?t=2459371&p=14026804#post14026804) then the xinput driver doesn't handle the additional buttons. If that's the case, then mastablasta's idea of installing the old synaptics driver might be the best bet especially since your pad actually is identified as a Synaptics pad. The only problems I see is that the manual pages for the driver and the utility 'synclient' don't make any mention of additional buttons except as emulated button that are actually mapped to tapping in the corners of the pad.

Holger

dutchg
March 25th, 2021, 09:51 AM
If the 'Button Labels' list in "xinput --list 'SynPS/2 Synaptics TouchPad' " is the same as mine in my original post (https://ubuntuforums.org/showthread.php?t=2459371&p=14026804#post14026804) then the xinput driver doesn't handle the additional buttons. If that's the case, then mastablasta's idea of installing the old synaptics driver might be the best bet especially since your pad actually is identified as a Synaptics pad. The only problems I see is that the manual pages for the driver and the utility 'synclient' don't make any mention of additional buttons except as emulated button that are actually mapped to tapping in the corners of the pad.

Holger

Thank again, Holger. I'll investigate the x.org solution again. I'm such a newbie that the instructions for going that direction were kind of baffling me, but I'll give it some more study and see if I can figure out how to implement it. One thing that's making me hesitate is that other than this one snag, my system's running great, and I'm a little wary of screwing it up with my experimentation. :)

mastablasta
March 25th, 2021, 12:13 PM
You probably need to move to xorg first (in login screen there should be an option to switch to xorg session)

To install the old Synaptics driver:


sudo apt install xserver-xorg-input-synaptics

if it doesn't work or is causing trouble uninstall it with:


sudo apt remove xserver-xorg-input-synaptics

If you don't like to mess with command line, then open software center find a program called Synaptic package manager and then manage packages in there. Here is a short youtube video showing how to do it: https://www.youtube.com/watch?v=9fmjOxZ0t9w

Synaptic package manager is old but still a very useful tool. Kubuntu uses Muon Package manager which looks and acts rather similar.

Holger_Gehrke
March 25th, 2021, 03:22 PM
xinput wouldn't work if you weren't already using X11. X11R7 is a protocol for the communication between applications that need to display graphics and a display server that makes the hardware do that. xorg (or x.org) is one specific implementation of a display server. It happens to be the one that Ubuntu uses ;-) . The only thing left to do is installing the package xserver-xorg-input-synaptics and a simple 'sudo apt install xserver-xorg-input-synaptics' should take care of that. The driver comes with a command line tool named synclient for making a lot of settings which xinput doesn't know about - options to change the curve(s) for pointer acceleration or for changing scrolling speed and more - but I vaguely recall using xinput with the synaptic driver several years ago.

Holger

dutchg
March 25th, 2021, 04:06 PM
Thanks for further information, Mastablasta and Holger. I'm off to experiment with it now, and I'll report results. I appreciate your help.

dutchg
March 25th, 2021, 05:27 PM
OK. I managed to install the xserver-xorg-input-synaptics from the command line. I also installed the synaptics package manager for good measure. My Gnome mouse settings didn't change, and I'm not seeing any controls for remapping the physical buttons at the bottom of the touchpad. I've poked around a little more online and I agree, Holger, I'm not seeing any mention of using it to control the actions of the physical buttons--mostly a lot of variations for reproducing various functions on the touchpad surface itself. Maybe the two buttons I refer to in my original post aren't really part of the "touchpad" set of tools. Hmmm..