从 ubuntu 下的 USB 2.0 触摸屏监视器获取坐标。

Get coordinates from USB 2.0 TouchScreen Monitor under ubuntu.

我有一个触摸屏面板在 Ubuntu 下工作,我需要找出这个设备在触摸面板时写入坐标的位置。 缓冲? DMA 寄存器? USB 寄存器?我在哪里可以获得这些信息?如何在 linux consol 下获取此信息?如何获取物理内存位置/缓冲区地址?! ... 有人有想法吗?

通常,您可以使用 evtest 工具获取坐标,该工具读取输入事件,即在 /dev/input/event 中,请参阅 <- 非常好的答案

尽管如此,获取数据的其他方式取决于您的触摸屏(reading/writing /dev/ttySx ,...)。触摸屏通常实现为 USB HID 设备或模拟串行连接 (https://wiki.ubuntu.com/Touchscreen)

Checking for touchscreen connectivity

When encountering a new device, the first order of business is to determine how the touchscreen is connected to your computer. If the touchscreen produces no events out of the box, check to see if it's an USB device or not:

lsusb

USB connection

Check the output for any reference to a touchscreen. If your touchscreen has an USB interface, and it isn't working, then you may need to blacklist the usbtouchscreen driver for it to work:

sudo modprobe -r usbtouchscreen

If your touchscreen begins to produce events, then you can permanently blacklist the usbtouchscreen driver:

echo "blacklist usbtouchscreen" | sudo tee -a /etc/modprobe.d/blacklist.conf

Some touchscreens might already have good or perfect calibrations, otherwise you'll need to continue to the calibration section.

Serial connection

If there is no reference to a touchscreen device in your lsusb output, the connection is most likely through one of your serial ports. The actual IRQ mapping varies between manufacturers. In the case of Itronix devices, the default is /dev/ttyS3. A simple way to check for connections is to check each one for events:

screen /dev/ttyS0

Touch anywhere on your screen to check for any character output. If nothing happens, quit screen by pressing Ctrl+A and then the \ key to quit. Continue with /dev/ttyS1, etc. until you get a response. Once you've determined the device, we can try a few different drivers. In the case of Itronix (and most other devices using the Touchkit driver), the correct driver is touchit213.

sudo inputattach --touchit213 /dev/ttyS3

Will work for most touchkit screens. The calibration or one or more axes may be swapped, but if the calibration is approximate then it's probably the correct driver. Press Ctrl+C to try a new mode. inputattach supports any of the following modes, which includes external touchscreens which may attach through a physical serial port:

  • --h3600ts -ipaq Ipaq h3600 touchscreend
  • --elotouch -elo ELO touchscreen, 10-byte mode
  • --elo4002 -elo6b ELO touchscreen, 6-byte mode
  • --elo271-140 -elo4b ELO touchscreen, 4-byte mode
  • --elo261-280 -elo3b ELO Touchscreen, 3-byte mode
  • --mtouch -mtouch MicroTouch (3M) touchscreen
  • --touchit213 -t213 Sahara Touch-iT213 Tablet PC
  • --touchright -tr Touchright serial touchscreen
  • --touchwin -tw Touchwindow serial touchscreen
  • --penmount -pm Penmount touchscreen
  • --fujitsu -fjt Fujitsu serial touchscreen

If your device is built into a laptop, you'll have the best luck with the mtouch, touchright, touchwin, or touchit213 drivers. Likewise, non-Elo external touchscreens will most likely use touchit213. If your device is a tablet with stylus-only input, fujitsu is a popular maker of embedded tablet devices.

To attach the touchscreen at startup, edit your /etc/rc.local to look like the following:

/usr/bin/inputattach --daemon --always -t213 /dev/ttyS3 exit 0

Replace -t213 with your appropriate driver and /dev/ttyS3 with the correct device.

Again, don't worry if the calibration isn't perfect, or if an axis is inverted or reversed - this will be addressed in the calibration section.

https://wiki.ubuntu.com/Touchscreen