0

How to distinguish two usb touchscreen devices with same pid/vid in linux I have two same usb touchscreen devices. I want to use them without errors when I start the computer. So I need to use “xinput map-to-output ” to distinguish them. However, They are almost the same. They have the same PID/VID, same vendor, same manufacture and same names.

Xinput map-to-output .XID sometimes changes, and a shell can not be always useful. I don’t know how to solve it when the XIDs exchange. Any suggestions on how to solve this are appreciated.

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
C.Roy
  • 1
  • 1

1 Answers1

0

Apologies for the short answer. I will try to find time to update it with some comments on what I actually do.

I had this exact problem today (came across your question when searching for info).

This is how I tested one solution.

#!/bin/sh

TOUCH_XINPUT_NAME=ET2494
export DISPLAY=:0

FIRST_ID=$(xinput | grep $TOUCH_XINPUT_NAME | sed -n '1s/.*id=\([0-9]*\).*/\1 /p')
SECOND_ID=$(xinput | grep $TOUCH_XINPUT_NAME | sed -n '2s/.*id=\([0-9]*\).*/\1 /p')

echo First id >> touch-sysfs-node.log
echo $FIRST_ID >> touch-sysfs-node.log
udevadm info -q property -n $(xinput --list-props $FIRST_ID | grep 260 | 
awk '{print substr($4, 2, length($4) - 2);}') | grep ID_PATH= | sed -n 's/ID_PATH=\(.*\)/\1/ ; p' >> touch-sysfs-node.log

echo Second id >> touch-sysfs-node.log
echo $SECOND_ID >> touch-sysfs-node.log
udevadm info -q property -n $(xinput --list-props $SECOND_ID | grep 260 | 
awk '{print substr($4, 2, length($4) - 2);}') | grep ID_PATH= | sed -n 's/ID_PATH=\(.*\)/\1/ ; p' >> touch-sysfs-node.log

echo ----------------------- >> touch-sysfs-node.log