aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-03-28 13:29:51 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-04-15 06:10:07 +0200
commit2dd36313731773cfd96e41ef6b086bf6a9e5dd20 (patch)
tree2423e2a15def0ca92dab67ba41e55a11af3b9044
parentc25354f13a345a374585688d7ca7a7791fea1d9e (diff)
downloadxorg-input-kobomultitouch-2dd36313731773cfd96e41ef6b086bf6a9e5dd20.tar.gz
xorg-input-kobomultitouch-2dd36313731773cfd96e41ef6b086bf6a9e5dd20.tar.bz2
xorg-input-kobomultitouch-2dd36313731773cfd96e41ef6b086bf6a9e5dd20.zip
Use the event source time instead of the arrival time
The SYN_REPORT event time is equal to the time when the collective event was produced in the kernel driver, and thus better represents the actual device timings than the current arrival time. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--src/hwdata.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/hwdata.c b/src/hwdata.c
index f204884..d696e07 100644
--- a/src/hwdata.c
+++ b/src/hwdata.c
@@ -26,14 +26,6 @@ void init_hwdata(struct HWData *hw)
memset(hw, 0, sizeof(struct HWData));
}
-static mstime_t get_mstime()
-{
- static const mstime_t ms = 1000;
- struct timeval now;
- gettimeofday(&now, NULL);
- return now.tv_usec / ms + now.tv_sec * ms;
-}
-
static void set_value(struct HWData *hw, int code, int value)
{
if (hw->nread < DIM_FINGER) {
@@ -54,11 +46,12 @@ static void accept_finger(struct HWData *hw)
hw->mread[hw->nread] = 0;
}
-static void accept_packet(struct HWData *hw)
+static void accept_packet(struct HWData *hw, const struct timeval* tv)
{
+ static const mstime_t ms = 1000;
hw->nread = 0;
hw->mread[hw->nread] = 0;
- hw->evtime = get_mstime();
+ hw->evtime = tv->tv_usec / ms + tv->tv_sec * ms;
}
int read_hwdata(struct HWData *hw, const struct input_event* ev)
@@ -67,7 +60,7 @@ int read_hwdata(struct HWData *hw, const struct input_event* ev)
case EV_SYN:
switch (ev->code) {
case SYN_REPORT:
- accept_packet(hw);
+ accept_packet(hw, &ev->time);
return 1;
case SYN_MT_REPORT:
accept_finger(hw);