Controlling Bluetooth mouse gestures that register keyboard events

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:

  1. disable these gestures
  2. 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:

  1. left click
  2. middle click
  3. right click
  4. scroll up
  5. scroll down
  6. scroll left
  7. scroll right
  8. swipe edge left
  9. swipe edge right
  10. two finger swipe left
  11. two finger swipe right
  12. double tap
  13. 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:

touch gestures

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:

  1. 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:

    ⎡ Virtual core pointer                          id=2    [master pointer  (3)]
    ...
    ⎜   ↳ Ultrathin Touch Mouse                     id=11   [slave  pointer  (2)]
    ⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    
    ...
        ↳ AT Translated Set 2 keyboard              id=12   [slave  keyboard (3)]
    

    on the other hand you can use lsinput from input-utils to find the correct id:

    lsinput 2>&1|grep -B5 "Ultrathin Touch Mouse"
    /dev/input/event12
       bustype : BUS_BLUETOOTH
       vendor  : 0x46d
       product : 0xb00d
       version : 1792
       name    : "Ultrathin Touch Mouse"
    
  2. 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.

  3. 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):

    0x700e3 = KEY_UNKNOWN
    0x700e0 = KEY_LEFTCTRL
    0x7002b = KEY_F8
    0x700e2 = KEY_LEFTALT
    0x70072 = KEY_F2
    0x70004 = KEY_UNKNOWN
    0x70005 = KEY_UNKNOWN
    0x70006 = KEY_UNKNOWN
    0x70007 = KEY_UNKNOWN
    0x70008 = KEY_UNKNOWN
    0x70009 = KEY_UNKNOWN
    0x7000a = KEY_UNKNOWN
    0x7000b = KEY_UNKNOWN
    0x7000c = KEY_UNKNOWN
    0x7000d = KEY_UNKNOWN
    0x7000e = KEY_UNKNOWN
    0x7000f = KEY_UNKNOWN
    0x70010 = KEY_UNKNOWN
    0x70011 = KEY_UNKNOWN
    0x70012 = KEY_UNKNOWN
    0x70013 = KEY_UNKNOWN
    0x70014 = KEY_UNKNOWN
    0x70015 = KEY_UNKNOWN
    0x70016 = KEY_UNKNOWN
    0x70017 = KEY_UNKNOWN
    0x70018 = KEY_UNKNOWN
    0x70019 = KEY_UNKNOWN
    0x7001a = KEY_UNKNOWN
    0x7001b = KEY_UNKNOWN
    0x7001c = KEY_UNKNOWN
    0x7001d = KEY_UNKNOWN
    0x7001e = KEY_UNKNOWN
    0x7001f = KEY_UNKNOWN
    0x70020 = KEY_UNKNOWN
    0x70021 = KEY_UNKNOWN
    0x70022 = KEY_UNKNOWN
    0x70023 = KEY_UNKNOWN
    0x70024 = KEY_UNKNOWN
    0x70025 = KEY_UNKNOWN
    0x70026 = KEY_UNKNOWN
    0x70027 = KEY_UNKNOWN
    0x70028 = KEY_UNKNOWN
    0x70029 = KEY_UNKNOWN
    0x7002a = KEY_UNKNOWN
    0x7002c = KEY_UNKNOWN
    0x7002d = KEY_UNKNOWN
    0x7002e = KEY_UNKNOWN
    0x7002f = KEY_UNKNOWN
    0x70030 = KEY_UNKNOWN
    0x70031 = KEY_UNKNOWN
    0x70032 = KEY_UNKNOWN
    0x70033 = KEY_UNKNOWN
    0x70034 = KEY_UNKNOWN
    0x70035 = KEY_UNKNOWN
    0x70036 = KEY_UNKNOWN
    0x70037 = KEY_UNKNOWN
    0x70038 = KEY_UNKNOWN
    0x70039 = KEY_UNKNOWN
    0x7003a = KEY_UNKNOWN
    0x7003b = KEY_UNKNOWN
    0x7003c = KEY_UNKNOWN
    0x7003d = KEY_UNKNOWN
    0x7003e = KEY_UNKNOWN
    0x7003f = KEY_UNKNOWN
    0x70040 = KEY_UNKNOWN
    0x70041 = KEY_UNKNOWN
    0x70042 = KEY_UNKNOWN
    0x70043 = KEY_UNKNOWN
    0x70044 = KEY_UNKNOWN
    0x70045 = KEY_UNKNOWN
    0x70046 = KEY_UNKNOWN
    0x70047 = KEY_UNKNOWN
    0x70048 = KEY_UNKNOWN
    0x70049 = KEY_UNKNOWN
    0x7004a = KEY_UNKNOWN
    0x7004b = KEY_UNKNOWN
    0x7004c = KEY_UNKNOWN
    0x7004d = KEY_UNKNOWN
    0x7004e = KEY_UNKNOWN
    0x7004f = KEY_UNKNOWN
    0x70050 = KEY_UNKNOWN
    0x70051 = KEY_UNKNOWN
    0x70052 = KEY_UNKNOWN
    0x70053 = KEY_UNKNOWN
    0x70054 = KEY_UNKNOWN
    0x70055 = KEY_UNKNOWN
    0x70056 = KEY_UNKNOWN
    0x70057 = KEY_UNKNOWN
    0x70058 = KEY_UNKNOWN
    0x70059 = KEY_UNKNOWN
    0x7005a = KEY_UNKNOWN
    0x7005b = KEY_UNKNOWN
    0x7005c = KEY_UNKNOWN
    0x7005d = KEY_UNKNOWN
    0x7005e = KEY_UNKNOWN
    0x7005f = KEY_UNKNOWN
    0x70060 = KEY_UNKNOWN
    0x70061 = KEY_UNKNOWN
    0x70062 = KEY_UNKNOWN
    0x70063 = KEY_UNKNOWN
    0x70064 = KEY_UNKNOWN
    0x70065 = KEY_UNKNOWN
    0x70066 = KEY_UNKNOWN
    0x70067 = KEY_UNKNOWN
    0x70068 = KEY_UNKNOWN
    0x70069 = KEY_UNKNOWN
    0x7006a = KEY_UNKNOWN
    0x7006b = KEY_UNKNOWN
    0x7006c = KEY_UNKNOWN
    0x7006d = KEY_UNKNOWN
    0x7006e = KEY_UNKNOWN
    0x7006f = KEY_UNKNOWN
    0x70070 = KEY_UNKNOWN
    0x70071 = KEY_UNKNOWN
    0x70073 = KEY_UNKNOWN
    0x70074 = KEY_UNKNOWN
    0x70075 = KEY_UNKNOWN
    0x70076 = KEY_UNKNOWN
    0x70077 = KEY_UNKNOWN
    0x70078 = KEY_UNKNOWN
    0x70079 = KEY_UNKNOWN
    0x7007a = KEY_UNKNOWN
    0x7007b = KEY_UNKNOWN
    0x7007c = KEY_UNKNOWN
    0x7007d = KEY_UNKNOWN
    0x7007e = KEY_UNKNOWN
    0x7007f = KEY_UNKNOWN
    0x70080 = KEY_UNKNOWN
    0x70081 = KEY_UNKNOWN
    0x70082 = KEY_UNKNOWN
    0x70083 = KEY_UNKNOWN
    0x70084 = KEY_UNKNOWN
    0x70085 = KEY_UNKNOWN
    0x70086 = KEY_UNKNOWN
    0x70087 = KEY_UNKNOWN
    0x70088 = KEY_UNKNOWN
    0x70089 = KEY_UNKNOWN
    0x7008a = KEY_UNKNOWN
    0x7008b = KEY_UNKNOWN
    0x7008c = KEY_UNKNOWN
    0x7008d = KEY_UNKNOWN
    0x7008e = KEY_UNKNOWN
    0x7008f = KEY_UNKNOWN
    0x70090 = KEY_UNKNOWN
    0x70091 = KEY_UNKNOWN
    0x70092 = KEY_UNKNOWN
    0x70093 = KEY_UNKNOWN
    0x70094 = KEY_UNKNOWN
    0x70095 = KEY_UNKNOWN
    0x70096 = KEY_UNKNOWN
    0x70097 = KEY_UNKNOWN
    0x70098 = KEY_UNKNOWN
    0x70099 = KEY_UNKNOWN
    0x7009a = KEY_UNKNOWN
    0x7009b = KEY_UNKNOWN
    0x7009c = KEY_UNKNOWN
    0x7009d = KEY_UNKNOWN
    0x7009e = KEY_UNKNOWN
    0x7009f = KEY_UNKNOWN
    0x700a0 = KEY_UNKNOWN
    0x700a1 = KEY_UNKNOWN
    0x700a2 = KEY_UNKNOWN
    0x700a3 = KEY_UNKNOWN
    0x700a4 = KEY_UNKNOWN
    0x700a5 = KEY_UNKNOWN
    0x700a6 = KEY_UNKNOWN
    0x700a7 = KEY_UNKNOWN
    0x700a8 = KEY_UNKNOWN
    0x700a9 = KEY_UNKNOWN
    0x700aa = KEY_UNKNOWN
    0x700ab = KEY_UNKNOWN
    0x700ac = KEY_UNKNOWN
    0x700ad = KEY_UNKNOWN
    0x700ae = KEY_UNKNOWN
    0x700af = KEY_UNKNOWN
    0x700b0 = KEY_UNKNOWN
    0x700b1 = KEY_UNKNOWN
    0x700b2 = KEY_UNKNOWN
    0x700b3 = KEY_UNKNOWN
    0x700b4 = KEY_UNKNOWN
    0x700b5 = KEY_UNKNOWN
    0x700b6 = KEY_UNKNOWN
    0x700b7 = KEY_UNKNOWN
    0x700b8 = KEY_UNKNOWN
    0x700b9 = KEY_UNKNOWN
    0x700ba = KEY_UNKNOWN
    0x700bb = KEY_UNKNOWN
    0x700bc = KEY_UNKNOWN
    0x700bd = KEY_UNKNOWN
    0x700be = KEY_UNKNOWN
    0x700bf = KEY_UNKNOWN
    0x700c0 = KEY_UNKNOWN
    0x700c1 = KEY_UNKNOWN
    0x700c2 = KEY_UNKNOWN
    0x700c3 = KEY_UNKNOWN
    0x700c4 = KEY_UNKNOWN
    0x700c5 = KEY_UNKNOWN
    0x700c6 = KEY_UNKNOWN
    0x700c7 = KEY_UNKNOWN
    0x700c8 = KEY_UNKNOWN
    0x700c9 = KEY_UNKNOWN
    0x700ca = KEY_UNKNOWN
    0x700cb = KEY_UNKNOWN
    0x700cc = KEY_UNKNOWN
    0x700cd = KEY_UNKNOWN
    0x700ce = KEY_UNKNOWN
    0x700cf = KEY_UNKNOWN
    0x700d0 = KEY_UNKNOWN
    0x700d1 = KEY_UNKNOWN
    0x700d2 = KEY_UNKNOWN
    0x700d3 = KEY_UNKNOWN
    0x700d4 = KEY_UNKNOWN
    0x700d5 = KEY_UNKNOWN
    0x700d6 = KEY_UNKNOWN
    0x700d7 = KEY_UNKNOWN
    0x700d8 = KEY_UNKNOWN
    0x700d9 = KEY_UNKNOWN
    0x700da = KEY_UNKNOWN
    0x700db = KEY_UNKNOWN
    0x700dc = KEY_UNKNOWN
    0x700dd = KEY_UNKNOWN
    0x700de = KEY_UNKNOWN
    0x700df = KEY_UNKNOWN
    0x700e1 = KEY_UNKNOWN
    0x700e4 = KEY_UNKNOWN
    0x700e5 = KEY_UNKNOWN
    0x700e6 = KEY_UNKNOWN
    0x700e7 = KEY_UNKNOWN
    0x700e8 = KEY_UNKNOWN
    0x700e9 = KEY_UNKNOWN
    0x700ea = KEY_UNKNOWN
    0x700eb = KEY_UNKNOWN
    0x700ec = KEY_UNKNOWN
    0x700ed = KEY_UNKNOWN
    0x700ee = KEY_UNKNOWN
    0x700ef = KEY_UNKNOWN
    0x700f0 = KEY_UNKNOWN
    0x700f1 = KEY_UNKNOWN
    0x700f2 = KEY_UNKNOWN
    0x700f3 = KEY_UNKNOWN
    0x700f4 = KEY_UNKNOWN
    0x700f5 = KEY_UNKNOWN
    0x700f6 = KEY_UNKNOWN
    0x700f7 = KEY_UNKNOWN
    0x700f8 = KEY_UNKNOWN
    0x700f9 = KEY_UNKNOWN
    0x700fa = KEY_UNKNOWN
    0x700fb = KEY_UNKNOWN
    0x700fc = KEY_UNKNOWN
    0x700fd = KEY_UNKNOWN
    0x700fe = KEY_UNKNOWN
    0x700ff = KEY_UNKNOWN
    0x90001 = 272  # BTN_LEFT
    0x90002 = 273  # BTN_RIGHT
    0x90003 = 274  # BTN_MIDDLE
    0x90004 = 275  # BTN_SIDE
    0x90005 = 276  # BTN_EXTRA
    

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:

  1. I sorted the map entries, cleaned up the duplicates, and noticed that it comprises 252 symbols (plus 5 buttons).

  2. 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.

  3. I perform the gestures in a text windows (or you can use "xbindkeys -mk") and take note of the letters produced.

  4. 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.

  5. 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.


You could try to use input-kbd from the input-utils package:

$ apropos input-kbd
input-kbd (8)        - print or modify keyboard maps for input devices

Using the input device index (e.g. 4 for /dev/input/event4, which can be found via lsinput which is necessarily different than the id used in xinput), you can reconfigure the keyboard map by feeding it a file with the -f switch, e.g.

$ sudo input-kbd -f some-file 4

where the some-file takes the form of scancode = keycode|keyname, where the following are equivalent:

0x0001 = KEY_F9
0x0001 = 67

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.