From ba936eddbf88b6d8f650082f6e7d2694f8addac4 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Mon, 21 Jun 2010 22:43:58 +0200 Subject: Unused slot is denoted by MT_TRACKING_ID == -1 The current MT slot protocol allows any tracking id outside the range specified by the device to denote an unused slot. This is difficult to handle in userspace, since the valid range is unknown. This patch tightens the definition of a valid tracking id to always lie in the range [0, MT_ID_MAX], and uses the value -1 to denote an unused slot. Acked-by: Chase Douglas Signed-off-by: Henrik Rydberg --- src/caps.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/caps.c') diff --git a/src/caps.c b/src/caps.c index 1821bd7..0788acf 100644 --- a/src/caps.c +++ b/src/caps.c @@ -83,8 +83,10 @@ static int read_caps(struct mtdev_caps *cap, int fd) cap->has_mtdata = has_mt_data(cap); - if (cap->has_abs[MTDEV_TRACKING_ID]) - cap->nullid = cap->abs[MTDEV_TRACKING_ID].minimum - 1; + if (!cap->has_abs[MTDEV_TRACKING_ID]) { + cap->abs[MTDEV_TRACKING_ID].minimum = MT_ID_MIN; + cap->abs[MTDEV_TRACKING_ID].maximum = MT_ID_MAX; + } default_fuzz(cap, MTDEV_POSITION_X, SN_COORD); default_fuzz(cap, MTDEV_POSITION_Y, SN_COORD); -- cgit v1.2.3