tl;dr
I just bought a Logitech T630. It's a Bluetooth mouse that supports several keyboard events via gestures (PDF). These gestures are fine and dandy but I have little use for them. I'm having a terrible time getting rid of them.
I want to do the following, in order of decreasing priority:
- disable these gestures
- remap the gestures (I think that without hacking the firmware or reverse engineering the Windows/OS X device drivers, this is not possible)
I don't want to:
- use Windows
- disable all gestures
For more info, read on…
buttons and gestures
The thirteen possible mouse events are:
- left click
- middle click
- right click
- scroll up
- scroll down
- scroll left
- scroll right
- swipe edge left
- swipe edge right
- two finger swipe left
- two finger swipe right
- double tap
- two finger double tap
The first seven are in order of how the OS maps them.
Only the first three are mechanical— all the other ones use the touch surface:
GUI options
Set up in Kubuntu Trusty was a breeze, but it offers little support for configuring these other gestures.
These gestures are not related to:
- touchpad (
synaptics
is not running) - accessibility
- hot corners
- standard mouse gestures
All of the settings related to those have been checked and they're all off.
command line settings
lomoco
The lomoco
utility to help configure special features of Logitech USB mice is not applicable.
xinput
I thought xinput
might offer some help:
$ xinput --list | grep pointer
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Ultrathin Touch Mouse id=13 [slave pointer (2)]
$ xinput --list-props 13
Device 'Ultrathin Touch Mouse':
Device Enabled (144): 1
Coordinate Transformation Matrix (146): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (266): 0
Device Accel Constant Deceleration (267): 1.000000
Device Accel Adaptive Deceleration (268): 1.000000
Device Accel Velocity Scaling (269): 10.000000
Device Product ID (261): 1133, 45069
Device Node (262): "/dev/input/event11"
Evdev Axis Inversion (270): 0, 0
Evdev Axes Swap (272): 0
Axis Labels (273): "Rel X" (154), "Rel Y" (155), "Rel Horiz Wheel" (746), "Rel Vert Wheel" (265)
Button Labels (274): "Button Left" (147), "Button Middle" (148), "Button Right" (149), "Button Wheel Up" (150), "Button Wheel Down" (151), "Button Horiz Wheel Left" (152), "Button Horiz Wheel Right" (153), "Button Side" (1032), "Button Extra" (1033), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264)
Evdev Middle Button Emulation (275): 0
Evdev Middle Button Timeout (276): 50
Evdev Third Button Emulation (277): 0
Evdev Third Button Emulation Timeout (278): 1000
Evdev Third Button Emulation Button (279): 3
Evdev Third Button Emulation Threshold (280): 20
Evdev Wheel Emulation (281): 0
Evdev Wheel Emulation Axes (282): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (283): 10
Evdev Wheel Emulation Timeout (284): 200
Evdev Wheel Emulation Button (285): 4
Evdev Drag Lock Buttons (286): 0
Note the 13 button labels:
$ xinput --get-button-map "Ultrathin Touch Mouse"
1 2 3 4 5 6 7 8 9 10 11 12 13
Turning them off didn't help:
$ xinput --set-button-map "Ultrathin Touch Mouse" 1 2 3 4 5 6 7 0 0 0 0 0 0
Even though, e.g., it can turn the middle mouse button into a left click:
$ xinput --set-button-map "Ultrathin Touch Mouse" 1 1 3 4 5 6 7 0 0 0 0 0 0
xmodmap
Similar to xinput
, same results:
$ xmodmap -e "pointer = 1 2 3 4 5 6 7 0 0 0 0 0 0"
inputkbd
Suggested by elmicha below, this is working at the kernel level, trying to make the gestures result in null keyboard events. Should work, but no luck here, either, with the following process:
$ sudo input-kbd 4 > keymap # note the 4 is from /dev/input/event4
# edit the keymap to map any combination of keys to either 0 or 240 (KEY_UNKNOWN)
# e.g. change this:
# 0x700e0 = 29 # KEY_LEFTCTRL
# to this:
# 0x700e0 = 0 # KEY_LEFTCTRL
# or this:
# 0x700e0 = 240 # KEY_LEFTCTRL
$ sudo input-kbd -f keymap 4
$ sudo input-kbd 4 # should return the updated keymap
After doing this, the keymap shows no change.
xkbcomp
This was suggested by X
input hacker Peter Hutterer, certainly a man who should know what he was doing. Still, no luck:
$ xkbcomp -xkb $DISPLAY t630.xkb
# edit the keyboard description and replace the definition of any key to NoSymbol or VoidSymbol
# e.g. change this:
# key <LCTL> { [ Control_L ] };
# to this:
# key <LCTL> { [ NoSymbol ] };
# or this:
# key <LCTL> { [ VoidSymbol ] };
$ sudo xkbcomp -i 8 t630.xkb $DISPLAY # here the 8 is the id in xinput, names don't work
$ xkbcomp -xkb -i 8 $DISPLAY - # should return the updated keyboard description
After doing this, the keyboard description shows no change.
Peter felt that this was likely due to the fact that X
is confused as to the nature of the device as a keyboard or a mouse, kind of like this bug that has the opposite problem. This may explain why all the other expected items don't work. However, he also said that using evdev
should not work for the same reason.
evdev
It seemed at first to work, but it doesn't either. This attempts to leverage the generic input driver for X
to set the button mapping by appending the following to /usr/share/X11/xorg.conf.d/10-evdev.conf
or /etc/X11/xorg.conf.d/10-evdev.conf
:
# custom for Logitech Ultrathin Touch mouse
Section "InputDevice"
Identifier "Logitech bluetooth Touch Mouse"
Driver "evdev"
Option "Name" "Ultrathin Touch Mouse"
Option "ButtonMapping" "1 2 3 4 5 6 7 0 0 0 0 0 0"
EndSection
Section "InputClass"
Identifier "Ultrathin Touch Mouse"
Option "ButtonMapping" "1 2 3 4 5 6 7 0 0 0 0 0 0"
EndSection
This seems to work without errors in /var/log/Xorg.0.log
(using grep EE
), and xinput
confirms the button mapping, but it doesn't result in the desire effect.
This is known to work for the T631, however.
keyboard events
The problem lies, I think, in the fact that these gestures generate keyboard events:
$ sudo evemu-record /dev/input/event4 | grep "E: "
# swipe edge right
E: 0.000000 0004 0004 458976 # EV_MSC / MSC_SCAN 458976
E: 0.000000 0001 001d 0001 # EV_KEY / KEY_LEFTCTRL 1
E: 0.000000 0004 0004 458979 # EV_MSC / MSC_SCAN 458979
E: 0.000000 0001 007d 0001 # EV_KEY / KEY_LEFTMETA 1
E: 0.000000 0004 0004 458795 # EV_MSC / MSC_SCAN 458795
E: 0.000000 0001 000f 0001 # EV_KEY / KEY_TAB 1
E: 0.000000 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 0.002980 0004 0004 458976 # EV_MSC / MSC_SCAN 458976
E: 0.002980 0001 001d 0000 # EV_KEY / KEY_LEFTCTRL 0
E: 0.002980 0004 0004 458979 # EV_MSC / MSC_SCAN 458979
E: 0.002980 0001 007d 0000 # EV_KEY / KEY_LEFTMETA 0
E: 0.002980 0004 0004 458795 # EV_MSC / MSC_SCAN 458795
E: 0.002980 0001 000f 0000 # EV_KEY / KEY_TAB 0
E: 0.002980 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
# swipe edge left
E: 3.306977 0004 0004 458978 # EV_MSC / MSC_SCAN 458978
E: 3.306977 0001 0038 0001 # EV_KEY / KEY_LEFTALT 1
E: 3.306977 0004 0004 458979 # EV_MSC / MSC_SCAN 458979
E: 3.306977 0001 007d 0001 # EV_KEY / KEY_LEFTMETA 1
E: 3.306977 0004 0004 458866 # EV_MSC / MSC_SCAN 458866
E: 3.306977 0001 00c1 0001 # EV_KEY / KEY_F23 1
E: 3.306977 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 3.310979 0004 0004 458978 # EV_MSC / MSC_SCAN 458978
E: 3.310979 0001 0038 0000 # EV_KEY / KEY_LEFTALT 0
E: 3.310979 0004 0004 458979 # EV_MSC / MSC_SCAN 458979
E: 3.310979 0001 007d 0000 # EV_KEY / KEY_LEFTMETA 0
E: 3.310979 0004 0004 458866 # EV_MSC / MSC_SCAN 458866
E: 3.310979 0001 00c1 0000 # EV_KEY / KEY_F23 0
E: 3.310979 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
# two finger double tap
E: 10.225976 0004 0004 458983 # EV_MSC / MSC_SCAN 458983
E: 10.225976 0001 007e 0001 # EV_KEY / KEY_RIGHTMETA 1
E: 10.225976 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 10.229986 0004 0004 458983 # EV_MSC / MSC_SCAN 458983
E: 10.229986 0001 007e 0000 # EV_KEY / KEY_RIGHTMETA 0
E: 10.229986 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
# two finger swipe left
E: 27.934977 0004 0004 589828 # EV_MSC / MSC_SCAN 589828
E: 27.934977 0001 0113 0001 # EV_KEY / BTN_SIDE 1
E: 27.934977 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 27.937983 0004 0004 589828 # EV_MSC / MSC_SCAN 589828
E: 27.937983 0001 0113 0000 # EV_KEY / BTN_SIDE 0
E: 27.937983 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
# two finger swipe right
E: 32.513990 0004 0004 589829 # EV_MSC / MSC_SCAN 589829
E: 32.513990 0001 0114 0001 # EV_KEY / BTN_EXTRA 1
E: 32.513990 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 32.516994 0004 0004 589829 # EV_MSC / MSC_SCAN 589829
E: 32.516994 0001 0114 0000 # EV_KEY / BTN_EXTRA 0
E: 32.516994 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
As far as the keymap is concerned, these refer to:
$ sudo input-kbd 4 | grep -e KEY_LEFTCTL -e KEY_LEFTMETA -e KEY_TAB -e KEY_LEFTALT -e KEY_F23 -e KEY_RIGHTMETA -e BTN_SIDE -e BTN_EXTRA
0x700e2 = 56 # KEY_LEFTALT
0x700e3 = 125 # KEY_LEFTMETA
0x700e7 = 126 # KEY_RIGHTMETA
0x7002b = 15 # KEY_TAB
0x70072 = 193 # KEY_F23
0x700e2 = 56 # KEY_LEFTALT
0x700e3 = 125 # KEY_LEFTMETA
0x700e7 = 126 # KEY_RIGHTMETA
0x90004 = 275 # BTN_SIDE
0x90005 = 276 # BTN_EXTRA
Double tap doesn't seem to do anything.
other references
It may also help to point out a reference to similar issues in a bug with the aforementioned mouse not being in the gnome-bluetooth
pincode database. Needless to say, further commentary on the subject is officially offtopic on that bug report, but the references may help add some perspective on the nature of this issue.
Here's the output of evemu-describe /dev/input/event4
FWIW.
Bluetooth adapters
FWIW I've used two different USB Bluetooth adapters:
$ lsusb | grep Bluetooth
Bus 007 Device 010: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
$ lsusb | grep Bluetooth
Bus 007 Device 011: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
After a lot of pain, I managed to create a key map that does something useful.
First a couple of notes (I cannot comment yet) on the previous answer:
the fixMouse script provided by Mr back-up does not work, because sometimes the Keyboard entry of the mouse appears with the wrong name in xinput, i.e. in my case it shows:
on the other hand you can use lsinput from input-utils to find the correct id:
for some reason when dumping the map for the mouse, some codes are duplicated (those between 0x700e0 and 0x700e7), be careful to find and eliminate them, or you wil go crazy.
replacing all the keycodes with KEY_UNKNOWN prevents the bursts of random characters, but renders the special touch actions useless. I found instead that you can remap some of the gestures to useful combinations. In particular the "swipe in from left" sends the codes 0x700e0+0x700e3+0x7002b, while the "swipe in from right" sends 0x700e3+0x700e3+0x70072. I mapped 0x700e3, which is common to both gestures, to KEY_UNKNOW, to get it out of the way. Then I used the remaining key codes to make CTRL+F8 (desktop grid) and ALT-F2 (runner), but of course you can generate any combination of any two keys. Here is my map, be careful when copy/pasting to leave no empty lines and no initial blank spaces (they break input-kbd):
I was not able to get proper codes for the two-finger swipes, but again I do not care because those gestures are impossible to perform.
P.S. In case you want to try to customize other gestures, here is how I proceeded:
I sorted the map entries, cleaned up the duplicates, and noticed that it comprises 252 symbols (plus 5 buttons).
I set the first ten symbols to KEY_A, the following ten to KEY_B and so on until the last 2 which became KEY_Z; then I loaded this map.
I perform the gestures in a text windows (or you can use "xbindkeys -mk") and take note of the letters produced.
In the map I change all the letters NOT produced to KEY_UNKNOWN, the three remaining to KEY_A, KEY_B, KEY_C.. KEY_Z, KEY_1,.., KEY_4, then I load this new MAP.
I perform the gesture again, take note of the letters/numbers produced: this are the codes that can be defined to whatever you need to make a specific key combination.
To disable the gestures, you can change the button mapping with the
evdev
driver so that the last 6 "buttons" are all disabled like so:appending the following to
/usr/share/X11/xorg.conf.d/10-evdev.conf
or/etc/X11/xorg.conf.d/10-evdev.conf
depending on what you have:restarting the
X
server withsudo service lightdm restart
xinput --get-button-map "Ultrathin Touch Mouse"
You can change the value of the
InputDevice Identifier
if you want, but it's important to keep the value forInputDevice Name
andInputClass Identifier
as "Ultrathin Touch Mouse," since this is howxinput
recognizes it.Tested with the Mac version, T631.
If you want a little more information on
evdev
, this blog post by Joe Shaw is particularly insightful about how it fits into the whole input stack.You could try to use
input-kbd
from theinput-utils
package:Using the input device index (e.g. 4 for
/dev/input/event4
, which can be found vialsinput
which is necessarily different than the id used inxinput
), you can reconfigure the keyboard map by feeding it a file with the-f
switch, e.g.where the
some-file
takes the form ofscancode = keycode|keyname
, where the following are equivalent:You can find the current map with
sudo input-kbd 4
. Since you need to open a file from/dev
, you do need to use superuser to event read this.Also note despite it's apparently misleading name, it does work with mice, too.
I managed to configure the "left edge swipe" and "right edge swipe" gestures using xbindkeys; this can probably apply also to the two finger swipes, but I did not bother with those as I find them difficult to perform anyway.
This is my .xbindkeysrc
I've mapped them to useful KDE shortcuts, of course you can do anything else. You need to run xbindkeys at login, I've created a .desktop file as explained in any xbindkeys tutorials:
HTH
I got frustrated at this thing because I never could get it to work, despite all the solutions provided, including those provided by someone who actually writes
X
input code. That said, I walked away from it and just used a normal, corded mouse.Yesterday I found the Ultrathin and decided to try it out again and it Just Works™. This is true at least in the sense that the reason for this question is that these gestures were being interpreted in strange ways and messing with my workflow. Now they seem to have no real effect, except that the left edge swipe allows me to swap between last used tabs in Firefox.
What's odd is that in no way are the gestures actually disabled. All 13 "buttons" are returned by
xinput --get-button-map "Ultrathin Touch Mouse"
. Alsogrep Ultrathin /usr/share/X11/xorg.conf.d
returns nothing. There's no relevantNoSymbol
s (and noVoidSymbol
s at all) found withxkbcomp
nor any relevantKEY_UNKNOWN
s withinput-kbd
.On the other hand, everything looks the same in
evemu-record
except for the fact that the double tap gestures are just taken as simpleBTN_LEFT
events.That said, something has changed in relation to this, but I'm not sure what.
Also, I haven't tested remapping things, but that wasn't really in the scope of the original question.
I've read all the answers, and I've written a script around input-kbd (part of input-utils) to auto-fix this issue.
You should run fixMouse from this repository once every login. It will:
Standard mouse features (left button; scroll; etc.) still work fine. Only the weird keyboard keys are stopped.
It survives suspend, bluetooth sleep, mouse on-off, etc.
It works for me.