on my Linux box I have 2 DELL touch display of the exact same type. One is connected on HDMI-2, the other on DP-1. To map the touch display I use

sudo xinput --map-to-output _ID1_ HDMI-2
sudo xinput --map-to-output _ID2_ DP-2

problem is every time I disconnect and reconnect the USB of touch device the ID changes...typically it inverts between ID1 and ID2 thus inverting touch on the two display. I need a way to be sure of the ID assigned to each monitor. Is there a way to track some property unique to the monitor to recognize them ? Thanks


1 Answer 1


If you always use the same usb socket for a touchscreen, you might be able to convert the id used by xinput for a device to the fixed "path" of the device on the usb bus. Use xinput list to find the 2 ids of the touchscreens by name. Then use xinput list-props on each id and look for the Device Node, eg:

$ xinput list-props 12 | grep 'Device Node'
        Device Node (282):      "/dev/input/event6"

Then use udevadm info on that path /dev/input/event6 and look for the DEVPATH or some line that is different between the 2 touchscreens and does not change, eg:


This path shows where on the bus the events come from. Just some part, such as 2-1.4.3 should be unique enough to identify the usb socket. (If you are lucky, the touchscreens might have some unique serial number that could be shown in this output). Here's a few lines of bash to experiment with:

name='The Touchscreen Name'
ids=$(xinput --list |awk -Fid= "/$name/"'{print $2+0}')
for id in $ids
do event=$(xinput list-props "$id" | awk -F'"' '/Device Node/{print $2}')
   path=$(udevadm info "$event" | 
          awk -F/ '/DEVPATH=/{printf "%s %s %s\n",$7,$8,$9}')
   echo "$id  $path"
  • Hi, thanks very much for your code, it solved my problem. Actually it is not the way I was planning to do it, but it works OK. Thanks again !
    – l.raimondi
    Commented Oct 13, 2022 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .