View Single Post
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#4
The values are in a binary format.
Look for input event struct.
A simple python script to read and decode the data:
Code:
import struct
tsdevice = "/dev/input/ts"
format = "iihhi"

file = open(tsdevice,"rb")
event = file.read(16)
x = 0
y = 0

while True:
        (time1, time2, type, code, value) = struct.unpack(format,event)
        if type == 3:
                if code == 0:
                        x = value
                if code == 1:
                        y = value
        if type == 0:
                print x, ":", y
        event = file.read(16)
Nicolai
 

The Following 6 Users Say Thank You to nicolai For This Useful Post: