![]() |
2011-01-25
, 14:49
|
Posts: 58 |
Thanked: 8 times |
Joined on Aug 2010
|
#1
|
![]() |
2011-01-26
, 07:38
|
Posts: 58 |
Thanked: 8 times |
Joined on Aug 2010
|
#2
|
cat /dev/input/event3
The Following User Says Thank You to justforfun For This Useful Post: | ||
![]() |
2011-01-26
, 10:18
|
|
Posts: 3,159 |
Thanked: 2,023 times |
Joined on Feb 2008
@ Finland
|
#3
|
But why they look garbled。I tried several characters encoding but failed to show them clearly. Does anyone know the right way?
cat /dev/input/event3 > events.log
![]() |
2011-01-26
, 11:14
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#4
|
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)
The Following 6 Users Say Thank You to nicolai For This Useful Post: | ||
![]() |
2011-01-29
, 08:05
|
Posts: 58 |
Thanked: 8 times |
Joined on Aug 2010
|
#5
|
you should cat 'em into a file and open the file with a program that can handle correct encoding.... xterm isn't such a program..... (it gets messed pretty easily when outputting anything except standard text files)
e:
for example
Code:cat /dev/input/event3 > events.log
![]() |
2011-01-29
, 08:08
|
Posts: 58 |
Thanked: 8 times |
Joined on Aug 2010
|
#6
|
The values are in a binary format.
Look for input event struct.
A simple python script to read and decode the data:
NicolaiCode: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)
![]() |
2011-01-31
, 08:30
|
Posts: 1,522 |
Thanked: 392 times |
Joined on Jul 2010
@ São Paulo, Brazil
|
#7
|
![]() |
2011-02-14
, 02:35
|
Posts: 58 |
Thanked: 8 times |
Joined on Aug 2010
|
#8
|
Does that report the calibrated or the raw coordinates? (I've read that the N900 watches where you click and notices when you click near but not exactly on a GUI element and then actually hits it and uses that data to correct for any deformations in the input)