When scrolling or using touchpad on the K400, heat of fingers, or accidental grazing occurs quite often, activating the Pinch and Zoom functions. However these functions are tied to keycode 37 (Usually Control. I've swapped Control_L with Super_L). Need to make touchpad stop Pinch and Zoom functions all together as to no longer be tied to keycode 37. Ubuntu 14.04. Thank you.

xinput list-props 9

Device 'Logitech K400':
Device Enabled (151):   1
Coordinate Transformation Matrix (153): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (278): 0
Device Accel Constant Deceleration (279):   1.000000
Device Accel Adaptive Deceleration (280):   1.000000
Device Accel Velocity Scaling (281):    10.000000
Device Product ID (267):    1133, 16459
Device Node (268):  "/dev/input/event12"
Evdev Axis Inversion (282): 0, 0
Evdev Axes Swap (284):  0
Axis Labels (285):  "Rel X" (161), "Rel Y" (162), "Rel Horiz Wheel" (276), "Rel Dial" (301), "Rel Vert Wheel" (277)
Button Labels (286):    "Button Left" (154), "Button Middle" (155), "Button Right" (156), "Button Wheel Up" (157), "Button Wheel Down" (158), "Button Horiz Wheel Left" (159), "Button Horiz Wheel Right" (160), "Button Side" (271), "Button Extra" (272), "Button Forward" (273), "Button Back" (274), "Button Task" (275), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270), "Button Unknown" (270)
Evdev Scrolling Distance (287): 1, 1, 1
Evdev Middle Button Emulation (288):    0
Evdev Middle Button Timeout (289):  50
Evdev Third Button Emulation (290): 0
Evdev Third Button Emulation Timeout (291): 0
Evdev Third Button Emulation Button (292):  3
Evdev Third Button Emulation Threshold (293):   0
Evdev Wheel Emulation (294):    0
Evdev Wheel Emulation Axes (295):   0, 0, 4, 5
Evdev Wheel Emulation Inertia (296):    10
Evdev Wheel Emulation Timeout (297):    200
Evdev Wheel Emulation Button (298): 4
Evdev Drag Lock Buttons (299):  0

xinput test 9

key release 37 
key press   37 


KeyRelease event, serial 37, synthetic NO, window 0x6000001,
    root 0x2a4, subw 0x0, time 79761120, (368,436), root:(368,488),
    state 0x840, keycode 37 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

What I believe happens here, is that the keyboard sends mouse events on motion axis #4 which are then interpreted as wheel events. The left control key is inserted to distinguish two-finger scroll from two-finger pinch (without control key it scrolls, and with control key it will zoom).

Of course, all of that is completely useless and quite annoying, when you have web pages zooming in and out all over the place as those two-finger events fire off by accident all the time. Fortunately ... Linux can simply be told to ignore events on motion axis #4 and that's the end of that. I believe this will work on all systems, including Ubuntu ... but if anyone wants to test, by all means update me.


DEV1="pointer:Logitech USB Receiver"
DEV2="pointer:Logitech K400"

for DEV in "$DEV1" "$DEV2"
    MOUSEID=$($XIN --list --id-only "$DEV" 2>/dev/null)
    if [ -n "$MOUSEID" ]
        echo "ID $MOUSEID is $DEV"

        # This disables the button 4 and button 5 which emulate scroll wheel.
        $XIN set-button-map "$MOUSEID" 1 2 3 0 0 0 0 0

        # This disables the translation from motion a[4] events into Wheel emulation.
        $XIN set-prop "$MOUSEID" --type=int --format=8 "Evdev Wheel Emulation Axes" 0, 0, 0, 0

Take note, that if you unplug the Logitech USB dongle and plug it back in again then settings will reset back to default and you need to run the script again. I'm sure there is a way to get these changes into the system defaults but this is sufficient for my purposes. For some reason my device has a different name to the original question, mine has wireless dongle with "Device Product ID (272): 1133, 50475" in the props so perhaps there are a bunch of similar devices out there.

  • Just to be clear; if I implement this code, I will no longer be able to scroll or zoom using k400 touchpad? Do they use axis 4 and 5 as shown?
    – Seek Truth
    Oct 5 '20 at 13:12
  • Yes, it will disable pinch zoom and scroll on the touchpad. That's what happened for me when I tested on my Logitech K400+ unit. It goes back to normal after you unplug the USB and plug back in again ... so it is fairly safe to try it out. Of course you can still scroll by other means (e.g. scrollbar, etc) The script does NOT require root or sudo or anything dangerous like that. If you want to checkout the various motion axis events then something like xinput --test might help. You can still see the motion events regardless of whether scroll emulation is enabled.
    – Tel
    Oct 26 '20 at 20:59

Does this page answer your question? there are some special functions on K400 that can be used with FN + touchpad

  • That is only to disable tapping. Nothing to do with programming/tweaks in Ubuntu to stop pinch. Also... I don't want to disable tapping. Thank you.
    – Seek Truth
    May 18 '17 at 17:22

To provide some help for others, I have found that (FN + Right Click) disables additional swipe options on the touch pad. Remember this needs to be re-set every time you manually turn off the keyboard. This seems to be a helpful workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.