So I've come up with a solution on my own.
Problem: a touch digitizer is connected to USB and looks like just any other input device, and therefore the system is not able to determine if it belongs to any particular screen, you have to determine that yourself and tell the system.
End goal: mapping a digitizer input to a specific monitor, like so
xinput map-to-output <input_id> <monitor_port>
for each of your touchscreens.
To accomplish this in my case I wrote an ugly script that is run by the login greeter during login init. The script is ugly so instead I will describe the approach.
So if you have more than one touchscreen of the same model, which is my situation, the only way to differentiate the touch inputs is by the physical USB port they are plugged into, otherwise you have no way to tell which one is which. This, I have to determine the xinput id by looking for the known port location.
To accomplish that I did:
cat /proc/bus/input/devices
and find your touch controllers, and note the USB ports they're plugged into. Mine were 6 and 9 (I chose the string "6-1" and "9-1"). Next time your machine is powered on you will grep the output for those ports. You will then grep for the input event handlers assigned to those touch controllers (may look something like /dev/input/eventX). Depending on other input devices and the order of device initialization those handlers can change, so you should bind them dynamically. Record the event handler into a variable for later use.
Then grep the output of xinput for the touch controllers to get their xinput numeric ids.* Record them into a variable.
Then grep the output of xinput list-props <id> with each of the numeric xinput ids for your touch controllers, looking for the event handler(s) you have previously stored in variables. This will allow you to establish the correlation between a physical USB port (where you know which touchscreen is plugged into) and the xinput numeric id.
Get your monitor ports from xrandr, these will not change between reboots as long as you keep your touchscreen monitors plugged in the same way, so you can keep these static. For example mine were DP3 for left and DP1 for right.
Finally map the xinput ids to the monitor ports... For example mine were like:
xinput map-to-output 12 DP3
xinput map-to-output 13 DP1
if you treat them as static, but like I said, you should have a script that dynamically determines the xinput numeric id for each.
That's the recipe. Hope it helps someone in the future, as you will not find a complete set of information for this scenario elsewhere.
Last edited by rootbeer666; 03-10-2020 at 07:00 PM.
|