Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Disable input device in X
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tot-to
n00b
n00b


Joined: 09 Apr 2008
Posts: 21

PostPosted: Sun Mar 24, 2019 12:11 pm    Post subject: [Solved] Disable input device in X Reply with quote

I have 3 input devices for mouse pointer: touchpad, trackpoint and bluetooth mouse:
Code:

$ cat /sys/class/input/mouse*/device/name
AlpsPS/2 ALPS DualPoint Stick
AlpsPS/2 ALPS DualPoint TouchPad
CM 530BT BLACK


I would like to completely disable the first two and use only the bluetooth mouse.
A typical suggestion found online is to use xinput utility. Here is what it shows in my case:

Code:

$ xinput --list
⎡ Virtual core pointer                       id=2   [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                 id=4   [slave  pointer  (2)]
⎜   ↳ <default pointer>                          id=6   [slave  pointer  (2)]
⎣ Virtual core keyboard                      id=3   [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                id=5   [slave  keyboard (3)]
    ↳ <default keyboard>                         id=7   [slave  keyboard (3)]


If I try to disable id 2 or 4, I get the following error message:

Code:

$ xinput --disable 2
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  131 (XInputExtension)
  Minor opcode of failed request:  57 ()
  Serial number of failed request:  20
  Current serial number in output stream:  21


And if I try to disable id 6, it succeeds, but it disables everything, so I can't control the pointer at all, which is apparently not what I want.

Additional info:
I use a simple window manager with no DE, in my make.conf I have the following input devices:
INPUT_DEVICES="mouse keyboard"


Last edited by tot-to on Thu Apr 04, 2019 7:25 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7081
Location: Saint Amant, Acadiana

PostPosted: Sun Mar 24, 2019 12:55 pm    Post subject: Reply with quote

Code:
INPUT_DEVICES="mouse keyboard"

Have you tried with libinput instead?
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
tot-to
n00b
n00b


Joined: 09 Apr 2008
Posts: 21

PostPosted: Sun Mar 24, 2019 6:54 pm    Post subject: Reply with quote

Thank you for your suggestion.

I have tried to migrate to libinput, but it doesn't seem to work for some reason.

Since the Gentoo wiki says libinput is the default input driver, I've commented out the INPUT_DEVICES in my make.conf, which resulted in the following default:

Code:

$ portageq envvar INPUT_DEVICES
libinput keyboard mouse


Then I reemerged xorg-drivers, which installed several packages:
sys-libs/mtdev-1.1.5
dev-libs/libevdev-1.6.0
dev-libs/libinput-1.12.6
x11-drivers/xf86-input-libinput-0.28.2

Then I copied the configuration file and made sure, the kernel module is loaded:
Code:

$ cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
$ lsmod | grep evdev
evdev                  10692  13


After restarting the X session, nothing has changed. The Xorg.0.log doesn't mention 'libinput' at all, but loads 'mouse' driver as usual:

Code:

[122140.316] (II) LoadModule: "mouse"
[122140.316] (II) Loading /usr/lib64/xorg/modules/input/mouse_drv.so
[122140.316] (II) Module mouse: vendor="X.Org Foundation"
[122140.316]    compiled for 1.20.4, module version = 1.9.3
[122140.316]    Module class: X.Org XInput Driver
[122140.316]    ABI class: X.Org XInput driver, version 24.1


So, I tried to explicitly set INPUT_DEVICES='libinput' in my make.conf, reemerge xorg-drivers again and un-merge x11-drivers/xf86-input-mouse and x11-drivers/xf86-input-keyboard packages. Then after the restart of X session none of the devices control the pointer and the keyboard also stopped working. Here is what I found in the Xorg.0.log:

Code:

[121589.927] (II) LoadModule: "mouse"
[121589.927] (WW) Warning, couldn't open module mouse
[121589.927] (EE) Failed to load module "mouse" (module does not exist, 0)
[121589.927] (EE) No input driver matching `mouse'
[121589.927] (II) Falling back to input driver `libinput'
[121589.927] (II) LoadModule: "libinput"
[121589.927] (II) Loading /usr/lib64/xorg/modules/input/libinput_drv.so
[121589.940] (II) Module libinput: vendor="X.Org Foundation"
[121589.940]    compiled for 1.20.4, module version = 0.28.2
[121589.940]    Module class: X.Org XInput Driver
[121589.940]    ABI class: X.Org XInput driver, version 24.1
[121589.940] (II) Using input driver 'libinput' for '<default pointer>'
[121589.940] (**) Option "CorePointer" "on"
[121589.940] (**) <default pointer>: always reports core events
[121589.940] (EE) PreInit returned 2 for "<default pointer>"
[121589.940] (II) UnloadModule: "libinput"
[121589.941] (WW) Warning, couldn't open module kbd
[121589.941] (EE) Failed to load module "kbd" (module does not exist, 0)
[121589.941] (EE) No input driver matching `kbd'
[121589.941] (II) Falling back to input driver `libinput'
[121589.941] (II) Using input driver 'libinput' for '<default keyboard>'
[121589.941] (**) Option "CoreKeyboard" "on"
[121589.941] (**) <default keyboard>: always reports core events
[121589.941] (EE) PreInit returned 2 for "<default keyboard>"
[121589.941] (II) UnloadModule: "libinput"
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5733

PostPosted: Sun Mar 24, 2019 7:15 pm    Post subject: Reply with quote

Code:
Markers: (--) probed, (**) from config file, (==) default setting

This:
Quote:
Code:
[121589.940] (**) Option "CorePointer" "on"

is not part of any default config file shipped with Xorg or libinput.
Back to top
View user's profile Send private message
tot-to
n00b
n00b


Joined: 09 Apr 2008
Posts: 21

PostPosted: Thu Apr 04, 2019 7:26 pm    Post subject: Reply with quote

Thank you for pointing this out for me.

I don't have an option CorePointer in my config, however, by playing with the options, I found that theese 3 options under the section "ServerFlags" somehow affect the behaviour.

Code:

Option  "AllowEmptyInput"       "false"
Option  "AutoAddDevices"        "false"
Option  "AutoEnableDevices"     "false"


Without this options in my initial configuration (i.e.
INPUT_DEVICES="mouse keyboard") any input devices are simply not working at all, that's why I have this options for many years.

So, I've tried to remove these options with libinput and it worked!

Now xinput --list shows all the input devices separately:

Code:

⎡ Virtual core pointer                       id=2   [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                 id=4   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS DualPoint Stick              id=10   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS DualPoint TouchPad           id=11   [slave  pointer  (2)]
⎜   ↳ CM 530BT BLACK                             id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                      id=3   [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                id=5   [slave  keyboard (3)]
    ↳ Power Button                               id=6   [slave  keyboard (3)]
    ↳ Power Button                               id=7   [slave  keyboard (3)]
    ↳ Sleep Button                               id=8   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard               id=9   [slave  keyboard (3)]
    ↳ Dell WMI hotkeys                           id=12   [slave  keyboard (3)]


By executing xinput --disable 'AlpsPS/2 ALPS DualPoint Stick'; xinput --disable 'AlpsPS/2 ALPS DualPoint TouchPad' I am able to disable only the trackpoint and touchpad, but keep the bluetooth mouse enabled, which is exactly what I wanted!
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5733

PostPosted: Fri Apr 05, 2019 2:38 pm    Post subject: Reply with quote

For libinput you can also do:
Code:
       Option "SendEventsMode" "disabled-on-external-mouse"

as per the manpage. This might work better as it enables and disables the device automatically depending on when a mouse is available.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum