View Single Post
Posts: 58 | Thanked: 8 times | Joined on Aug 2010
#6
Originally Posted by nicolai View Post
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

Hi Nicolai, thank you! Now I can show it correctly. Although I am not familiar with python, but I got hint from your code.