On Thu, Mar 29, 2012 at 10:21:09AM -0700, Chase Douglas wrote: > On 03/29/2012 05:12 AM, Leon Shaw wrote: > > From: Leon Shaw <shaw.l...@gmail.com> > > Hi Leon, > > Please include a description of the problem and how this fix addresses > it in the commit message. If there is a bug in the bug tracker, please > include the url too. > > What device are you seeing this issue on?
unless my maths yesterday was out, any device where st_min != mt_min could trigger this bug. try it with st ranges [2...8], mt ranges [-1...11] before and after. either way, Leon, it should be easy to write up something in test/eventcomm-test.c that tests a number of ranges before/after for correctness. > > Signed-off-by: Leon Shaw <shaw.l...@gmail.com> > > --- > > src/eventcomm.c | 16 +++++++++------- > > 1 file changed, 9 insertions(+), 7 deletions(-) > > > > diff --git a/src/eventcomm.c b/src/eventcomm.c > > index 28d034f..2d03743 100644 > > --- a/src/eventcomm.c > > +++ b/src/eventcomm.c > > @@ -71,7 +71,7 @@ struct eventcomm_proto_data > > * exists for readability of the code. > > */ > > BOOL need_grab; > > - int st_to_mt_offset[2]; > > + int st_min[2]; > > double st_to_mt_scale[2]; > > #ifdef HAVE_MULTITOUCH > > struct mtdev *mtdev; > > @@ -396,6 +396,8 @@ event_query_axis_ranges(InputInfoPtr pInfo) > > event_get_abs(pInfo, pInfo->fd, ABS_Y, &priv->miny, &priv->maxy, > > &priv->synpara.hyst_y, &priv->resy); > > > > + proto_data->st_min[0] = priv->minx; > > + proto_data->st_min[1] = priv->miny; > > priv->has_pressure = FALSE; > > priv->has_width = FALSE; > > SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), > > absbits)); > > @@ -429,10 +431,8 @@ event_query_axis_ranges(InputInfoPtr pInfo) > > event_get_abs(pInfo, pInfo->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; > > proto_data->st_to_mt_scale[0] = > > (priv->maxx - priv->minx) / (st_maxx - st_minx); > > - proto_data->st_to_mt_offset[1] = priv->miny - st_miny; > > proto_data->st_to_mt_scale[1] = > > (priv->maxy - priv->miny) / (st_maxy - st_miny); > > } > > @@ -641,9 +641,11 @@ static int count_fingers(InputInfoPtr pInfo, const > > struct CommData *comm) > > > > > > static inline double > > -apply_st_scaling(struct eventcomm_proto_data *proto_data, int value, int > > axis) > > +apply_st_scaling(SynapticsPrivate *priv, int value, int axis) > > { > > - return value * proto_data->st_to_mt_scale[axis] + > > proto_data->st_to_mt_offset[axis]; > > + struct eventcomm_proto_data *proto_data = priv->proto_data; > > + return (value - proto_data->st_min[axis]) * > > proto_data->st_to_mt_scale[axis] + > > + (axis ? priv->miny : priv->minx); > > proto_data->st_min[0] == priv->minx, so we can get rid of > proto_daata->st_min. This would then become: Check the previous hunk, it overwrites priv->minx with the ABS_MT_POSITION_X data. Cheers, Peter > if (axis == 0) > return (value - priv->minx) * proto_data->st_to_mt_scale[axis] + > priv->minx; > else > return (value - priv->miny) * proto_data->st_to_mt_scale[axis] + > priv->miny; > > I don't think this is correct. priv->min* are in mt coordinates, but > value is in st coordinates. You're subtracting two values in different > coordinate systems, which won't work. > > I'm not real sure what the bug you're seeing is, please provide more > information so we can tell what's wrong. > > > } > > > > Bool > > @@ -738,10 +740,10 @@ EventReadHwState(InputInfoPtr pInfo, > > if (ev.code < ABS_MT_SLOT) { > > switch (ev.code) { > > case ABS_X: > > - hw->x = apply_st_scaling(proto_data, ev.value, 0); > > + hw->x = apply_st_scaling(priv, ev.value, 0); > > break; > > case ABS_Y: > > - hw->y = apply_st_scaling(proto_data, ev.value, 1); > > + hw->y = apply_st_scaling(priv, ev.value, 1); > > break; > > case ABS_PRESSURE: > > hw->z = ev.value; _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel