diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-21 11:17:20 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-31 14:56:47 +1000 |
commit | e686362276d8471c434acf3a84cdb4e1e5656667 (patch) | |
tree | ca2cc6d06db5b65c73770d07bbf389feab2e3424 | |
parent | ac585d7a4f893c109cd1ff5266fe93ea49564788 (diff) |
eventcomm: pass the fd's down instead of accessing priv->fd
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/eventcomm.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index 4ac3ec2..8f13b18 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -369,7 +369,7 @@ event_get_abs(SynapticsPrivate *priv, int fd, int code, /* Query device for axis ranges */ static void -event_query_axis_ranges(SynapticsPrivate * priv) +event_query_axis_ranges(SynapticsPrivate * priv, int fd) { struct eventcomm_proto_data *proto_data = priv->proto_data; unsigned long absbits[NBITS(ABS_MAX)] = { 0 }; @@ -379,15 +379,15 @@ event_query_axis_ranges(SynapticsPrivate * priv) /* The kernel's fuzziness concept seems a bit weird, but it can more or * less be applied as hysteresis directly, i.e. no factor here. */ - event_get_abs(priv, priv->fd, ABS_X, &priv->minx, &priv->maxx, + event_get_abs(priv, fd, ABS_X, &priv->minx, &priv->maxx, &priv->synpara.hyst_x, &priv->resx); - event_get_abs(priv, priv->fd, ABS_Y, &priv->miny, &priv->maxy, + event_get_abs(priv, fd, ABS_Y, &priv->miny, &priv->maxy, &priv->synpara.hyst_y, &priv->resy); priv->has_pressure = FALSE; priv->has_width = FALSE; - SYSCALL(rc = ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits)); + SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits)); if (rc >= 0) { priv->has_pressure = (TEST_BIT(ABS_PRESSURE, absbits) != 0); priv->has_width = (TEST_BIT(ABS_TOOL_WIDTH, absbits) != 0); @@ -397,11 +397,11 @@ event_query_axis_ranges(SynapticsPrivate * priv) strerror(errno)); if (priv->has_pressure) - event_get_abs(priv, priv->fd, ABS_PRESSURE, &priv->minp, &priv->maxp, + event_get_abs(priv, fd, ABS_PRESSURE, &priv->minp, &priv->maxp, NULL, NULL); if (priv->has_width) - event_get_abs(priv, priv->fd, ABS_TOOL_WIDTH, + event_get_abs(priv, fd, ABS_TOOL_WIDTH, &priv->minw, &priv->maxw, NULL, NULL); if (priv->has_touch) { @@ -410,9 +410,9 @@ event_query_axis_ranges(SynapticsPrivate * priv) int st_miny = priv->miny; int st_maxy = priv->maxy; - event_get_abs(priv, priv->fd, ABS_MT_POSITION_X, &priv->minx, + event_get_abs(priv, fd, ABS_MT_POSITION_X, &priv->minx, &priv->maxx, &priv->synpara.hyst_x, &priv->resx); - event_get_abs(priv, priv->fd, ABS_MT_POSITION_Y, &priv->miny, + event_get_abs(priv, fd, ABS_MT_POSITION_Y, &priv->miny, &priv->maxy, &priv->synpara.hyst_y, &priv->resy); proto_data->st_to_mt_offset[0] = priv->minx - st_minx; @@ -423,7 +423,7 @@ event_query_axis_ranges(SynapticsPrivate * priv) (priv->maxy - priv->miny) / (st_maxy - st_miny); } - SYSCALL(rc = ioctl(priv->fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits)); + SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits)); if (rc >= 0) { priv->has_left = (TEST_BIT(BTN_LEFT, keybits) != 0); priv->has_right = (TEST_BIT(BTN_RIGHT, keybits) != 0); @@ -719,7 +719,7 @@ EventDevOnly(const struct dirent *dir) } static void -event_query_touch(SynapticsPrivate *priv) +event_query_touch(SynapticsPrivate *priv, int fd) { SynapticsParameters *para = &priv->synpara; struct eventcomm_proto_data *proto_data = priv->proto_data; @@ -732,7 +732,7 @@ event_query_touch(SynapticsPrivate *priv) priv->num_mt_axes = 0; #ifdef EVIOCGPROP - SYSCALL(rc = ioctl(priv->fd, EVIOCGPROP(sizeof(prop)), &prop)); + SYSCALL(rc = ioctl(fd, EVIOCGPROP(sizeof(prop)), &prop)); if (rc >= 0 && BitIsOn(&prop, INPUT_PROP_SEMI_MT)) { SynapticsMsg(priv, MSG_INFO, "ignoring touch events for semi-multitouch device\n"); @@ -745,7 +745,7 @@ event_query_touch(SynapticsPrivate *priv) } #endif - mtdev = mtdev_new_open(priv->fd); + mtdev = mtdev_new_open(fd); if (!mtdev) { SynapticsMsg(priv, MSG_WARN, "failed to open mtdev when querying touch capabilities\n"); @@ -856,8 +856,8 @@ EventQueryHardware(SynapticsPrivate *priv) if (!event_query_is_touchpad(priv->fd, (proto_data) ? proto_data->need_grab : TRUE)) return FALSE; - event_query_touch(priv); - event_query_axis_ranges(priv); + event_query_touch(priv, priv->fd); + event_query_axis_ranges(priv, priv->fd); event_query_model(priv->fd, &priv->model, &priv->id_vendor, &priv->id_product); |