You are not logged in.

#1 2023-01-26 11:41:40

michimussato
Member
Registered: 2023-01-26
Posts: 3

Switch between "Trackpad" and "Touchscreen" mode (like TeamViewer)

Hello everybody

I would like to switch the behavior of my touchscreen between "Trackpad" and "Touchscreen" mode easily - similar to how you can change the input modes in TeamViewer.
Currently, I get "Trackpad" behavior by using:

cat /etc/X11/xorg.conf.d/69-touch.conf 
# https://www.oesf.org/forum/index.php?topic=35185.0
# https://github.com/p2rkw/xf86-input-mtrack

Section "InputClass
  Identifier   "touchscreen catchall"
  MatchIsTouchscreen "on"
  MatchDevicePath "/dev/input/event*"
  Driver       "mtrack"
  Option       "ScrollDistance" "40"
  Option       "FingerLow" "1"
  Option       "FingerHigh" "2"
  Option       "Sensitivity" "0.3"
  Option       "BottomEdge" "0"
  Option       "SwipeDistance" "100"
  Option       "ScaleDistance" "40"
  Option       "ButtonMoveEmulate" "false"
  Option       "ClickTime" "25"
  Option       "MaxTapMove" "55"
  Option       "EdgeBottomSize" "0"
EndSection

, and "Touchscreen" behavior by removing that file.

Dynamically enabling/disabling 69-touch.conf is the first thing that comes to my mind and I have found ways to fully restart X without reboot, but this seems too harsh of an approach for my workflow. Is this even possible? Is there a better, more simple approach to switch between touchscreen (driver "wacom") and trackpad (driver "mtrack") mode?

Thank you very much in advance!
Michael

Last edited by michimussato (2023-01-26 11:42:49)

Offline

#2 2023-01-26 16:55:50

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Switch between "Trackpad" and "Touchscreen" mode (like TeamViewer)

I think you might be able to change input methods on-the-fly (ie, without restarting X) with xinput(1) but I have no way of testing.


Jin, Jîyan, Azadî

Offline

#3 2023-01-29 23:06:51

michimussato
Member
Registered: 2023-01-26
Posts: 3

Re: Switch between "Trackpad" and "Touchscreen" mode (like TeamViewer)

Thanks for your suggestion, Head_on_a_Stick. I tried several things but was unable to switch between absolute and relative mode for the touch screen.

The following was using libinput for the touch screen:

[michael@pocket3 ~] $ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ HAILUCK CO.,LTD USB KEYBOARD Mouse      	id=11	[slave  pointer  (2)]
⎜   ↳ GXTP7380:00 27C6:0113 Stylus stylus     	id=14	[slave  pointer  (2)]
⎜   ↳ GXTP7380:00 27C6:0113 Stylus eraser     	id=18	[slave  pointer  (2)]
⎜   ↳ Wacom Intuos PT S 2 Pad pad             	id=22	[slave  pointer  (2)]
⎜   ↳ Wacom Intuos PT S 2 Pen stylus          	id=23	[slave  pointer  (2)]
⎜   ↳ Wacom Intuos PT S 2 Finger touch        	id=24	[slave  pointer  (2)]
⎜   ↳ Apple Inc. Magic Trackpad 2             	id=25	[slave  pointer  (2)]
⎜   ↳ Kanex MultiSync Foldable Keyboard with Numeric Keys Mouse	id=27	[slave  pointer  (2)]
⎜   ↳ GXTP7380:00 27C6:0113                   	id=20	[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=8	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=9	[slave  keyboard (3)]
    ↳ Intel HID events                        	id=16	[slave  keyboard (3)]
    ↳ Intel HID 5 button array                	id=17	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ HAILUCK CO.,LTD USB KEYBOARD System Control	id=12	[slave  keyboard (3)]
    ↳ HAILUCK CO.,LTD USB KEYBOARD            	id=10	[slave  keyboard (3)]
    ↳ HAILUCK CO.,LTD USB KEYBOARD Wireless Radio Control	id=13	[slave  keyboard (3)]
    ↳ GXTP7380:00 27C6:0113 Keyboard          	id=15	[slave  keyboard (3)]
    ↳ HAILUCK CO.,LTD USB KEYBOARD Consumer Control	id=19	[slave  keyboard (3)]
    ↳ SHUNCCM2MP: SHUNCCM2MP                  	id=21	[slave  keyboard (3)]
    ↳ Kanex MultiSync Foldable Keyboard with Numeric Keys Keyboard	id=26	[slave  keyboard (3)]
[michael@pocket3 ~] $ xinput list-props "GXTP7380:00 27C6:0113"
Device 'GXTP7380:00 27C6:0113':
	Device Enabled (184):	1
	Coordinate Transformation Matrix (186):	0.000000, -0.750000, 0.877344, 0.526316, 0.000000, 0.473684, 0.000000, 0.000000, 1.000000
	libinput Calibration Matrix (366):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Calibration Matrix Default (367):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Send Events Modes Available (297):	1, 0
	libinput Send Events Mode Enabled (298):	0, 0
	libinput Send Events Mode Enabled Default (299):	0, 0
	Device Node (300):	"/dev/input/event11"
	Device Product ID (301):	10182, 275
[michael@pocket3 ~] $ xinput set-mode "GXTP7380:00 27C6:0113" "RELATIVE"
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  131 (XInputExtension)
  Minor opcode of failed request:  5 (X_SetDeviceMode)
  Serial number of failed request:  19
  Current serial number in output stream:  19
[michael@pocket3 ~] $ xinput --query-state "GXTP7380:00 27C6:0113"
2 classes :
ButtonClass
	button[1]=up
	button[2]=up
	button[3]=up
	button[4]=up
	button[5]=up
	button[6]=up
	button[7]=up
ValuatorClass Mode=Absolute Proximity=In
	valuator[0]=48837
	valuator[1]=40909
	valuator[2]=0
	valuator[3]=0

Then, this was using the wacom driver for the touch device:

both

xinput set-mode "GXTP7380:00 27C6:0113 touch" "RELATIVE"

and

xsetwacom set "GXTP7380:00 27C6:0113 touch" "Mode" "Relative"

execute successfully without warning, but the behavior does not change.

For the stylus, I can easily switch back and forth with

xsetwacom set "GXTP7380:00 27C6:0113 Stylus stylus" "Mode" "Absolute"
xsetwacom set "GXTP7380:00 27C6:0113 Stylus stylus" "Mode" "Relative"

as well as with

xinput set-mode "GXTP7380:00 27C6:0113 Stylus stylus" "ABSOLUTE"
xinput set-mode "GXTP7380:00 27C6:0113 Stylus stylus" "RELATIVE"

What else can I try?

Last edited by michimussato (2023-01-29 23:11:42)

Offline

Board footer

Powered by FluxBB