nexus511 / gpd-ubuntu-packages

This repository shall provide the base for building ubuntu packages from most of the patches currently used to get linux on the gpd-pocket.
GNU General Public License v3.0
73 stars 4 forks source link

input properties forgotten (trackpoint setup) after lock screen or console switch #29

Closed sobukus closed 6 years ago

sobukus commented 7 years ago

I use the xubuntu 17.04 image and configure the trackpoint as follows:

#!/bin/sh
gpddev='SINO WEALTH Gaming Keyboard'
if xinput --list | grep -q "$gpddev"; then
  xinput --set-prop "pointer:$gpddev" 'libinput Middle Emulation Enabled' 1
  xinput --set-prop "pointer:$gpddev" 'libinput Scroll Method Enabled' 0 0 1
  xinput --set-prop "pointer:$gpddev" 'libinput Button Scrolling Button' 3
fi

(Strange that there is no option for this stuff in the mouse/pointer settings, only double click speed … but whatever, I'm normally not using fancy desktop environments anyway.)

These settings get lost when I lock the screen or switch the console (Ctrl+Alt+F1). Does the libinput driver need fixing to restore this state? I do not remember this problem from my Thinkpads.

nexus511 commented 7 years ago

Well, I don't think this is more a question related to xinput. I would guess that the xinput settings just get bound to the session and reloiaded when the xinput is reinitialized.

Maybe you should write those settings to the xorg-configuration instead of using xinput on each start of your x-server. Please see https://wiki.ubuntuusers.de/xorg.conf.d/ for more information. That is at least the way I would do this and I already used to fix the touch-rotation.

sobukus commented 7 years ago

Well, I am not ending any session, I am even just locking the screen! I can try if those settings persist when in an Xorg config fragment, but I would be surprised. The X server is not restarted, is it? Maybe this is part of the new world with logind session management … I am normally not using a standard distro on my laptop, not even a graphical login manager. I'll report back once I tested this.

nexus511 commented 7 years ago

As even scaling is not applied to the "lock screen" I would suggest that it is not handled by the actual window manager and thus there is something changing the current session.

I would guess that it is related to the normal fckp introduced by some of the broken systemd junk (sorry for my harsh opinion, but I do not like that stuff at all).

Anyway. As rotation is handled by xinput and using the xinput command to setup the rotation results in exactly the same behavior about options that get lost on screen locking or suspend, I would guess that the same solutions works here.

Please let me know, if it works out. By the way: I would also guess that it does not work for wayland. So if you are using gdm3, updating the Xorg configuration will of course not work.

sobukus commented 7 years ago

I can imagine that the session handling could play a role … attempting to give each user her preference and thus expecting the desktop environment to reload the settings on each change of virtual console. Maybe it is a wayland thing and this is normal expected behaviour. I use Xorg, but libinput comes from the other camp. Anyhow, I tried to put my settings into an xorg.conf fragment:

Section "InputClass"
    Identifier  "trackpoint setup"
    Driver  "libinput"
    MatchIsPointer   "on"
    MatchProduct    "SINO WEALTH Gaming Keyboard"
    Option  "libinput Middle Emulation Enabled" "1"
    Option  "libinput Scroll Method Enabled" "0 0 1"
    Option  "libinput Button Scrolling Button" "3"
EndSection

This is the result:

[  6861.295] (II) input device 'SINO WEALTH Gaming Keyboard', /dev/input/event5 is tagged by udev as: Keyboard Mouse
[  6861.295] (II) input device 'SINO WEALTH Gaming Keyboard', /dev/input/event5 is a pointer caps
[  6861.295] (II) input device 'SINO WEALTH Gaming Keyboard', /dev/input/event5 is a keyboard
[  6861.297] (II) config/udev: Adding input device SINO WEALTH Gaming Keyboard (/dev/input/mouse0)
[  6861.297] (**) SINO WEALTH Gaming Keyboard: Applying InputClass "trackpoint setup"
[  6861.297] (II) Using input driver 'libinput' for 'SINO WEALTH Gaming Keyboard'
[  6861.297] (**) SINO WEALTH Gaming Keyboard: always reports core events
[  6861.297] (**) Option "Device" "/dev/input/mouse0"
[  6861.298] (**) Option "_source" "server/udev"
[  6861.332] (II) failed to create input device '/dev/input/mouse0'.
[  6861.332] (EE) libinput: SINO WEALTH Gaming Keyboard: Failed to create a device for /dev/input/mouse0
[  6861.332] (EE) PreInit returned 2 for "SINO WEALTH Gaming Keyboard"
[  6861.332] (II) UnloadModule: "libinput"

Should I specify a device? How should I know if this ends up as /dev/input/event5 or /dev/input/event42? This mouse0 is odd.

nexus511 commented 7 years ago

I am pretty sure your option names are completely bogus.

As I also have to read the documentation and dig around the proper device names, I would need some spare time I could sacrifice on that. So I can currently not help you with digging out the details of this but if you find a solution it would of course be great if we could share this.

So for now I can just keep this open and hope that someone comes along and helps you out.

sobukus commented 7 years ago

Well, the option names are mentioned in the libinput man page, but details may be confused … I'd expect the xorg.conf nams to relate to the names I give xinput on the command line. Perhaps someone else with more experience on modern standard Linux desktops can chime in and tell us if it is normal that the properties are forgotten after a screen lock, even. Perhaps there is something in Xfce actively clearing the settings …

Heck, I am not even able to figure out how to start a second X11 session right now (startx -- :1 as a different user is apparently blocked by logind/pty permissions).

nexus511 commented 6 years ago

@sobukus Well, you are putting runtime-variables and configuration-variables under the same umbrella.

Please read the manual carefully. Variables in xorg.conf would not start with "libinput" and do not contain spaces.

Instead of

Option  "libinput Middle Emulation Enabled" "1"

you should rather have something like

Option "MiddleEmulation" "true" 
sobukus commented 6 years ago

Ah, of course. I wondered about these strange option names but thought that that is some new style. Also expected consistency in config file and xinput parameters.

I can confirm now that the settings persist over console switches and suspend/resume (to idle) with this config fragment:

Section "InputClass"
    Identifier  "trackpoint setup"
    Driver  "libinput"
    MatchIsPointer   "on"
    MatchProduct    "SINO WEALTH Gaming Keyboard"
    Option  "MiddleEmulation" "on"
    Option  "ScrollMethod" "button"
    Option  "ScrollButton" "3"
EndSection

Thanks for your pointers.