Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touchpad inputs are treated as touchscreen inputs on Linux under some unknown conditions #54

Open
felurx opened this issue Aug 17, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@felurx
Copy link

felurx commented Aug 17, 2024

Describe the Bug
Sideband or Kivy seem to partially treat inputs from a touchpad as if they were coming from a touchscreen on my system, which results in the GUI being pretty much unusable via touchpad.

For example, moving a finger up and down on a scrollable view results in its contents moving up and down (instead of just moving the mouse pointer). Also, tapping on the touchpad seems to sometimes click on things corresponding to where the touchpad was tapped, instead of where the mouse pointer is.
There is a screencast below.

Using a regular mouse works fine, even without closing and reopening Sideband.

To Reproduce
I don't know which pieces of my system cause the bug to surface. A possible starting point might be to live-boot Manjaro with KDE from a USB stick on a laptop and install Sideband on that (via pipx).
After that, just opening Sideband and using the touchpad should be enough to see the bug in action.

Expected Behavior
Sideband should treat touchpads like other mouse input devices.

Logs & Screenshots

Sideband log file with -v

[INFO   ] Logger: Record log in /home/felix/.kivy/logs/kivy_24-08-17_4.txt
[INFO   ] Kivy: v2.3.0
[INFO   ] Kivy: Installed at "/home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/kivy/__init__.py"
[INFO   ] Python: v3.12.4 (main, Jun  7 2024, 06:33:07) [GCC 14.1.1 20240522]
[INFO   ] Python: Interpreter at "/home/felix/.local/share/pipx/venvs/sbapp/bin/python"
[INFO   ] Logger: Purge log fired. Processing...
[INFO   ] Logger: Purge finished!
[INFO   ] KivyMD: 1.2.0.dev0 (installed at "/home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/sbapp/kivymd/__init__.py")
[INFO   ] Factory: 195 symbols loaded
[DEBUG  ] Cache: register <kv.resourcefind> with limit=None, timeout=60
[DEBUG  ] Cache: register <kv.image> with limit=None, timeout=60
[DEBUG  ] Cache: register <kv.atlas> with limit=None, timeout=None
[INFO   ] ImageLoaderFFPy: Using ffpyplayer 4.5.1
[INFO   ] Image: Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer 
[DEBUG  ] Cache: register <kv.texture> with limit=1000, timeout=60
[DEBUG  ] Cache: register <kv.shader> with limit=1000, timeout=3600
[DEBUG  ] Cache: register <kv.graphics.texture> with limit=None, timeout=None
[INFO   ] Text: Provider: sdl2
[DEBUG  ] Cache: register <kv.lang> with limit=None, timeout=None
[INFO   ] Window: Provider: sdl2
[INFO   ] GL: Using the "OpenGL" graphics system
[INFO   ] GL: Backend used <sdl2>
[INFO   ] GL: OpenGL version <b'4.6 (Compatibility Profile) Mesa 24.1.5-manjaro1.1'>
[INFO   ] GL: OpenGL vendor <b'AMD'>
[INFO   ] GL: OpenGL renderer <b'AMD Radeon 760M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.54, 6.6.44-1-MANJARO)'>
[INFO   ] GL: OpenGL parsed version: 4, 6
[INFO   ] GL: Shading version <b'4.60'>
[INFO   ] GL: Texture max size <16384>
[INFO   ] GL: Texture max units <32>
[DEBUG  ] Shader: Fragment compiled successfully
[DEBUG  ] Shader: Vertex compiled successfully
[DEBUG  ] ImageSDL2: Load </home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/kivy/data/glsl/default.png>
[INFO   ] Window: auto add sdl2 input provider
[INFO   ] Window: virtual keyboard not allowed, single mode, not docked
[INFO   ] Clipboard: Provider: xclip
[INFO   ] CutBuffer: cut buffer support enabled
[INFO   ] SoundFFPy: Using ffpyplayer 4.5.1
[DEBUG  ] Audio: register SoundFFPy
[DEBUG  ] Audio: register SoundSDL2
[DEBUG  ] Audio: register MusicSDL2
[INFO   ] Audio: Providers: audio_ffpyplayer, audio_sdl2 
[DEBUG  ] Cache: register <textinput.label> with limit=None, timeout=60.0
[DEBUG  ] Cache: register <textinput.width> with limit=None, timeout=60.0
[DEBUG  ] App: Loading kv </home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/sbapp/sideband.kv>
[DEBUG  ] App: kv </home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/sbapp/sideband.kv> not found
[DEBUG  ] Resource: add </usr/share/fonts> in path list
[DEBUG  ] Resource: add </usr/share/fonts/cantarell> in path list
[DEBUG  ] Resource: add </usr/share/fonts/noto> in path list
[DEBUG  ] Resource: add </usr/share/fonts/gsfonts> in path list
[DEBUG  ] Resource: add </usr/share/fonts/rnote-fonts> in path list
[DEBUG  ] Resource: add </usr/share/fonts/adobe-source-code-pro> in path list
[DEBUG  ] Resource: add </usr/share/fonts/adobe-source-han-sans> in path list
[DEBUG  ] Resource: add </usr/share/fonts/encodings> in path list
[DEBUG  ] Resource: add </usr/share/fonts/encodings/large> in path list
[DEBUG  ] Resource: add </usr/share/fonts/liberation> in path list
[DEBUG  ] Resource: add </usr/share/fonts/TTF> in path list
[DEBUG  ] Resource: add </usr/share/fonts/adobe-source-sans> in path list
[DEBUG  ] Resource: add </usr/share/fonts/droid> in path list
[DEBUG  ] Resource: add </usr/share/fonts/misc> in path list
[DEBUG  ] Resource: add </usr/local/share/fonts> in path list
[DEBUG  ] Resource: add </usr/local/share/fonts/c> in path list
[DEBUG  ] Resource: add </home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/kivy/data/fonts> in path list
[DEBUG  ] Shader: Fragment compiled successfully
[INFO   ] GL: NPOT texture support is available
[DEBUG  ] Base: Create provider from mouse,disable_multitouch
[DEBUG  ] Base: Create provider from probesysfs
[DEBUG  ] ProbeSysfs: using probesysfs!
[DEBUG  ] ProbeSysfs: found device: Wacom Bamboo 16FG 4x5 Finger at /dev/input/event9
[INFO   ] ProbeSysfs: device match: /dev/input/event9
[INFO   ] MTD: Read event from </dev/input/event9>
[DEBUG  ] ProbeSysfs: found device: PIXA3854:00 093A:0274 Touchpad at /dev/input/event18
[INFO   ] ProbeSysfs: device match: /dev/input/event18
[INFO   ] MTD: Read event from </dev/input/event18>
[INFO   ] Base: Start application main loop
[INFO   ] MTD: </dev/input/event9> range position X is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range position X is 0 - 1337
[INFO   ] MTD: </dev/input/event9> range position Y is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range position Y is 0 - 876
[INFO   ] MTD: </dev/input/event9> range touch major is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range touch major is 0 - 0
[INFO   ] MTD: </dev/input/event9> range touch minor is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range touch minor is 0 - 0
[INFO   ] MTD: </dev/input/event9> range pressure is 0 - 255
[INFO   ] MTD: </dev/input/event18> range pressure is 0 - 255
[INFO   ] MTD: </dev/input/event9> axes inversion: X is 0, Y is 0
[INFO   ] MTD: </dev/input/event18> axes inversion: X is 0, Y is 0
[INFO   ] MTD: </dev/input/event9> rotation set to 0
[INFO   ] MTD: </dev/input/event18> rotation set to 0
[DEBUG  ] Atlas: Load </home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/kivy/data/images/defaulttheme.atlas>
[DEBUG  ] Atlas: Need to load 1 images
[DEBUG  ] Atlas: Load </home/felix/.local/share/pipx/venvs/sbapp/lib/python3.12/site-packages/kivy/data/images/defaulttheme-0.png>
[WARNING] Deprecated property "<NumericProperty name=width_mult>" of object "<kivymd.uix.toolbar.toolbar.OverFlowMenu object at 0x7f5784d740c0>" has been set, it will be removed in a future version
[INFO   ] Base: Leaving application in progress...

Screencast_20240817_124228.webm
The window on the right is the libinput debug-gui, in which the blue rectangle shows touchpad inputs. The blue circle always shows the last finger position, the number 0 means that a finger is currently on the touchpad.

System Information

  • OS
    • Up-to-date Manjaro (based on Arch Linux)
    • Running on Wayland
    • KDE Plasma 6.0.5
    • Linux 6.6.44
  • Sideband
    • Installed via pipx
    • Python 3.12.4
    • Sideband 0.9.1
    • Kivy 2.3.0
  • Hardware
    • Framework Laptop 13 (AMD, x86_64)
    • Bug occurs with built-in touchpad (PixArt PCT3854QR) and external Wacom Bamboo Pen&Touch (CTH-470), no other touchpads tested

Additional context

libinput list-devices

I removed irrelevant devices.

Device:           Wacom Bamboo 16FG 4x5 Pen
Kernel:           /dev/input/event6
Group:            5
Seat:             seat0, default
Size:             147x92mm
Capabilities:     tablet 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   none
Rotation:         n/a

Device:           Wacom Bamboo 16FG 4x5 Finger
Kernel:           /dev/input/event9
Group:            5
Seat:             seat0, default
Size:             146x91mm
Capabilities:     pointer gesture
Tap-to-click:     enabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   *two-finger edge 
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   flat *adaptive custom
Rotation:         n/a

Device:           Wacom Bamboo 16FG 4x5 Pad
Kernel:           /dev/input/event10
Group:            5
Seat:             seat0, default
Capabilities:     tablet-pad
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         n/a
Pad:
        Rings:   0
        Strips:  0
        Buttons: 4
        Mode groups: 1 (1 modes)

Device:           PIXA3854:00 093A:0274 Mouse
Kernel:           /dev/input/event17
Group:            9
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   flat *adaptive custom
Rotation:         n/a

Device:           PIXA3854:00 093A:0274 Touchpad
Kernel:           /dev/input/event18
Group:            9
Seat:             seat0, default
Size:             111x73mm
Capabilities:     pointer gesture
Tap-to-click:     disabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *two-finger edge 
Click methods:    *button-areas clickfinger 
Disable-w-typing: enabled
Disable-w-trackpointing: enabled
Accel profiles:   flat *adaptive custom
Rotation:         n/a

@felurx
Copy link
Author

felurx commented Aug 17, 2024

In Kivy on Linux, multitouch devices (= touchscreens) seem to be handled by kivy.input.providers.mtdev, which in the default config is configured by kivy.input.providers.probesysfs.

This lead me to a workaround:
Commenting out line 49 %(name)s = probesysfs under [input] in ~/.kivy/config.ini (which is auto-created by Kivy) disables that behaviour, the touchpads are no longer treated as multitouch devices and everything is fine for me.
(This would probably break actual touchscreens, however.)

I'll investigate further, but I suspect that this is a problem with ProbeSysfs' logic for how to detect touchscreens and should be fixed upstream in Kivy. Or does Sideband do anything unusual regarding input devices?


EDIT: This matches with the following lines in the log I posted, which I think are ProbeSysfs recognizing the touchpads as touchscreens and configuring them:

Log snippet

[DEBUG  ] Base: Create provider from mouse,disable_multitouch
[DEBUG  ] Base: Create provider from probesysfs
[DEBUG  ] ProbeSysfs: using probesysfs!
[DEBUG  ] ProbeSysfs: found device: Wacom Bamboo 16FG 4x5 Finger at /dev/input/event9
[INFO   ] ProbeSysfs: device match: /dev/input/event9
[INFO   ] MTD: Read event from </dev/input/event9>
[DEBUG  ] ProbeSysfs: found device: PIXA3854:00 093A:0274 Touchpad at /dev/input/event18
[INFO   ] ProbeSysfs: device match: /dev/input/event18
[INFO   ] MTD: Read event from </dev/input/event18>
[INFO   ] Base: Start application main loop
[INFO   ] MTD: </dev/input/event9> range position X is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range position X is 0 - 1337
[INFO   ] MTD: </dev/input/event9> range position Y is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range position Y is 0 - 876
[INFO   ] MTD: </dev/input/event9> range touch major is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range touch major is 0 - 0
[INFO   ] MTD: </dev/input/event9> range touch minor is 0 - 4096
[INFO   ] MTD: </dev/input/event18> range touch minor is 0 - 0
[INFO   ] MTD: </dev/input/event9> range pressure is 0 - 255
[INFO   ] MTD: </dev/input/event18> range pressure is 0 - 255
[INFO   ] MTD: </dev/input/event9> axes inversion: X is 0, Y is 0
[INFO   ] MTD: </dev/input/event18> axes inversion: X is 0, Y is 0
[INFO   ] MTD: </dev/input/event9> rotation set to 0
[INFO   ] MTD: </dev/input/event18> rotation set to 0

@felurx
Copy link
Author

felurx commented Aug 17, 2024

To be more precise and correct:
The term "multitouch device" seems to apply to all devices that can track multiple touch points, which includes both touchscreens and touchpads. Also, both have the properties that ProbeSysfs checks for.

The problem seems to be that all multitouch devices are treated as touchscreens, where device coordinates map to screen coordinates somehow and a contact moving corresponds to the user dragging UI elements.
Touchpads should probably just be ignored, since Kivy already deals with mouse events just fine and the OS does everything to create these from touchpad input.

I don't know where that conflation of touchscreens and touchpads happens and how it should be fixed. Also, the question remains why this didn't cause any trouble for other users.

@markqvist
Copy link
Owner

Thanks for collecting all the information and posting detailed logs and info. I agree with your observations and initial conclusions here. Unfortunately, Sideband doesn't do anything non-standard in regards to input, so this may be an issue that has it's root in Kivy itself. Regardless, we'll need to find some sort of tenable workaround as well, until it can be identified and potentially fixed in Kivy.

I'll start looking into this, and seeing if I can track down where the issue might occur exactly, but it might be hard for me to debug, since I doubt I have any hardware where I can replicate. Therefore, any additional information and input you can come up with in the meantime is highly appreciated!

@markqvist markqvist added the bug Something isn't working label Aug 17, 2024
@markqvist markqvist self-assigned this Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants