* [PATCH] forced recalibration for the OLPC hgpk touchpad @ 2009-06-02 19:47 pgf 2009-06-03 15:04 ` Dmitry Torokhov 2009-07-29 22:08 ` Paul Fox 0 siblings, 2 replies; 8+ messages in thread From: pgf @ 2009-06-02 19:47 UTC (permalink / raw) To: dmitry.torokhov; +Cc: linux-input, linux-kernel The OLPC XO laptop incorporates a combination touchpad/tablet device which unfortunately requires frequent recalibration. The driver will force this automatically when various suspicious behaviors are observed, and the user can recalibrate manually (with a special keyboard sequence). There's currently no way, however, for an external program to cause recalibration. This patch creates a new node in /sys which, when written with '1', will force a touchpad recalibration. No other writes (or reads) of this node are supported. paul -------------------- Signed-off-by: Paul Fox <pgf@foxharp.boston.ma.us> diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index a1ad2f1..e736ebd 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c @@ -369,12 +369,40 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data, __PSMOUSE_DEFINE_ATTR(powered, S_IWUSR | S_IRUGO, NULL, hgpk_show_powered, hgpk_set_powered, 0); +static ssize_t hgpk_trigger_recal_show(struct psmouse *psmouse, + void *data, char *buf) +{ + return -EINVAL; +} + +static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data, + const char *buf, size_t count) +{ + struct hgpk_data *priv = psmouse->private; + unsigned long value; + int err; + + err = strict_strtoul(buf, 10, &value); + if (err || value != 1) + return -EINVAL; + + psmouse_queue_work(psmouse, &priv->recalib_wq, + msecs_to_jiffies(1)); + + return count; +} + +__PSMOUSE_DEFINE_ATTR(recalibrate, S_IWUSR | S_IRUGO, NULL, + hgpk_trigger_recal_show, hgpk_trigger_recal, 0); + static void hgpk_disconnect(struct psmouse *psmouse) { struct hgpk_data *priv = psmouse->private; device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_powered.dattr); + device_remove_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_recalibrate.dattr); psmouse_reset(psmouse); kfree(priv); } @@ -423,8 +451,18 @@ static int hgpk_register(struct psmouse *psmouse) err = device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_powered.dattr); - if (err) - hgpk_err(psmouse, "Failed to create sysfs attribute\n"); + if (err) { + hgpk_err(psmouse, "Failed creating 'powered' sysfs node\n"); + } else { + err = device_create_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_recalibrate.dattr); + if (err) { + hgpk_err(psmouse, + "Failed creating 'recalibrate' sysfs node\n"); + device_remove_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_powered.dattr); + } + } return err; } =--------------------- paul fox, pgf@laptop.org ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] forced recalibration for the OLPC hgpk touchpad 2009-06-02 19:47 [PATCH] forced recalibration for the OLPC hgpk touchpad pgf @ 2009-06-03 15:04 ` Dmitry Torokhov 2009-06-04 3:58 ` Paul Fox 2009-07-29 22:08 ` Paul Fox 1 sibling, 1 reply; 8+ messages in thread From: Dmitry Torokhov @ 2009-06-03 15:04 UTC (permalink / raw) To: pgf; +Cc: linux-input, linux-kernel Hi Paul, On Tuesday 02 June 2009 12:47:59 pgf@laptop.org wrote: > The OLPC XO laptop incorporates a combination touchpad/tablet > device which unfortunately requires frequent recalibration. The > driver will force this automatically when various suspicious > behaviors are observed, and the user can recalibrate manually > (with a special keyboard sequence). There's currently no way, > however, for an external program to cause recalibration. > > This patch creates a new node in /sys which, when written with '1', > will force a touchpad recalibration. No other writes (or reads) > of this node are supported. > Instead of creating a new sysfs attribute maybe we should make the touchpad recalibrate upon resume (reconnect)? Userspace can already request reconnect via sysfs. -- Dmitry ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] forced recalibration for the OLPC hgpk touchpad 2009-06-03 15:04 ` Dmitry Torokhov @ 2009-06-04 3:58 ` Paul Fox 2009-06-04 4:17 ` Andres Salomon 0 siblings, 1 reply; 8+ messages in thread From: Paul Fox @ 2009-06-04 3:58 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, dilinger, dsaxena dmitry wrote: > Hi Paul, > > On Tuesday 02 June 2009 12:47:59 pgf@laptop.org wrote: > > The OLPC XO laptop incorporates a combination touchpad/tablet > > device which unfortunately requires frequent recalibration. The > > driver will force this automatically when various suspicious > > behaviors are observed, and the user can recalibrate manually > > (with a special keyboard sequence). There's currently no way, > > however, for an external program to cause recalibration. > > > > This patch creates a new node in /sys which, when written with '1', > > will force a touchpad recalibration. No other writes (or reads) > > of this node are supported. > > > > > Instead of creating a new sysfs attribute maybe we should make > the touchpad recalibrate upon resume (reconnect)? Userspace can > already request reconnect via sysfs. dmitry -- thanks for the suggestion. i took a look, and tried it. the problem is that doing a full reset of the touchpad takes quite a long time -- 1.1 or 1.2 seconds. recalibration deprives the user of their touchpad for long enough as it is -- i don't think we can afford that time. (remember that this is a workaround for bad hardware -- the XO no longer uses this touchpad at least partly due to this very issue, but there are enough in use that we're still trying to improve things.) paul =--------------------- paul fox, pgf@laptop.org ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] forced recalibration for the OLPC hgpk touchpad 2009-06-04 3:58 ` Paul Fox @ 2009-06-04 4:17 ` Andres Salomon 2009-06-17 20:16 ` Paul Fox 0 siblings, 1 reply; 8+ messages in thread From: Andres Salomon @ 2009-06-04 4:17 UTC (permalink / raw) To: Paul Fox; +Cc: Dmitry Torokhov, linux-input, linux-kernel, dsaxena On Wed, 03 Jun 2009 23:58:33 -0400 Paul Fox <pgf@laptop.org> wrote: > dmitry wrote: > > Hi Paul, > > > > On Tuesday 02 June 2009 12:47:59 pgf@laptop.org wrote: > > > The OLPC XO laptop incorporates a combination touchpad/tablet > > > device which unfortunately requires frequent recalibration. The > > > driver will force this automatically when various suspicious > > > behaviors are observed, and the user can recalibrate manually > > > (with a special keyboard sequence). There's currently no way, > > > however, for an external program to cause recalibration. > > > > > > This patch creates a new node in /sys which, when written with > > > '1', will force a touchpad recalibration. No other writes (or > > > reads) of this node are supported. > > > > > > > > > Instead of creating a new sysfs attribute maybe we should make > > the touchpad recalibrate upon resume (reconnect)? Userspace can > > already request reconnect via sysfs. > > dmitry -- thanks for the suggestion. > > i took a look, and tried it. the problem is that doing a full > reset of the touchpad takes quite a long time -- 1.1 or 1.2 > seconds. recalibration deprives the user of their touchpad for > long enough as it is -- i don't think we can afford that time. > (remember that this is a workaround for bad hardware -- the XO > no longer uses this touchpad at least partly due to this very > issue, but there are enough in use that we're still trying to > improve things.) > I do like the idea of having a sysfs trigger for recalibrations. We've never been successful in having the kernel driver handle recalibrations seamlessly. Perhaps touchpad hardware screwups would be easier to detect in userspace, given a daemon that can keep a history of the last N touchpad coordinates? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] forced recalibration for the OLPC hgpk touchpad 2009-06-04 4:17 ` Andres Salomon @ 2009-06-17 20:16 ` Paul Fox 0 siblings, 0 replies; 8+ messages in thread From: Paul Fox @ 2009-06-17 20:16 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, dsaxena, Andres Salomon hi dmitry -- have you had a chance to think any more about this? i'm open to suggestions on implementation detail, but i think that a full reset of the device won't really work, because of the time it adds to the recalibration. paul andres wrote: > On Wed, 03 Jun 2009 23:58:33 -0400 > Paul Fox <pgf@laptop.org> wrote: > > > dmitry wrote: > > > Hi Paul, > > > > > > On Tuesday 02 June 2009 12:47:59 pgf@laptop.org wrote: > > > > The OLPC XO laptop incorporates a combination touchpad/tablet > > > > device which unfortunately requires frequent recalibration. The > > > > driver will force this automatically when various suspicious > > > > behaviors are observed, and the user can recalibrate manually > > > > (with a special keyboard sequence). There's currently no way, > > > > however, for an external program to cause recalibration. > > > > > > > > This patch creates a new node in /sys which, when written with > > > > '1', will force a touchpad recalibration. No other writes (or > > > > reads) of this node are supported. > > > > > > > > > > > > > Instead of creating a new sysfs attribute maybe we should make > > > the touchpad recalibrate upon resume (reconnect)? Userspace can > > > already request reconnect via sysfs. > > > > dmitry -- thanks for the suggestion. > > > > i took a look, and tried it. the problem is that doing a full > > reset of the touchpad takes quite a long time -- 1.1 or 1.2 > > seconds. recalibration deprives the user of their touchpad for > > long enough as it is -- i don't think we can afford that time. > > (remember that this is a workaround for bad hardware -- the XO > > no longer uses this touchpad at least partly due to this very > > issue, but there are enough in use that we're still trying to > > improve things.) > > > > I do like the idea of having a sysfs trigger for recalibrations. We've > never been successful in having the kernel driver handle recalibrations > seamlessly. Perhaps touchpad hardware screwups would be easier to > detect in userspace, given a daemon that can keep a history of the last > N touchpad coordinates? =--------------------- paul fox, pgf@laptop.org ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] forced recalibration for the OLPC hgpk touchpad 2009-06-02 19:47 [PATCH] forced recalibration for the OLPC hgpk touchpad pgf 2009-06-03 15:04 ` Dmitry Torokhov @ 2009-07-29 22:08 ` Paul Fox 2009-07-30 5:44 ` Dmitry Torokhov 1 sibling, 1 reply; 8+ messages in thread From: Paul Fox @ 2009-07-29 22:08 UTC (permalink / raw) To: linux-input, linux-kernel this is a resubmission, in the hopes of jump-starting the merge discussion. it was last discussed in early june of this year. the OLPC XO laptop incorporates a combination touchpad/tablet device which unfortunately requires frequent recalibration. the driver will force this automatically when various suspicious behaviors are observed, and the user can recalibrate manually (with a special keyboard sequence). there's currently no way, however, for an external program to cause recalibration. this patch creates a new node in /sys which, when written with '1', will force a touchpad recalibration. no other writes (or reads) of this node are supported. during the previous discussion, dmitry suggested that we instead use the reconnect capability which is already available in /sys. i experimented with this, and unfortunately a full reset of the touchpad takes quite a long time -- 1.1 or 1.2 seconds. recalibration deprives the user of their touchpad for long enough as it is -- i don't think we can afford that time. (note that this is a workaround for bad hardware -- the XO no longer uses this touchpad at least partly due to this very issue, but there are enough in use that we're still trying to improve things.) paul Signed-off-by: Paul Fox <pgf@laptop.org> Acked-by: Andres Salomon <dilinger@collabora.co.uk> diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index a1ad2f1..e736ebd 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c @@ -369,12 +369,40 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data, __PSMOUSE_DEFINE_ATTR(powered, S_IWUSR | S_IRUGO, NULL, hgpk_show_powered, hgpk_set_powered, 0); +static ssize_t hgpk_trigger_recal_show(struct psmouse *psmouse, + void *data, char *buf) +{ + return -EINVAL; +} + +static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data, + const char *buf, size_t count) +{ + struct hgpk_data *priv = psmouse->private; + unsigned long value; + int err; + + err = strict_strtoul(buf, 10, &value); + if (err || value != 1) + return -EINVAL; + + psmouse_queue_work(psmouse, &priv->recalib_wq, + msecs_to_jiffies(1)); + + return count; +} + +__PSMOUSE_DEFINE_ATTR(recalibrate, S_IWUSR | S_IRUGO, NULL, + hgpk_trigger_recal_show, hgpk_trigger_recal, 0); + static void hgpk_disconnect(struct psmouse *psmouse) { struct hgpk_data *priv = psmouse->private; device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_powered.dattr); + device_remove_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_recalibrate.dattr); psmouse_reset(psmouse); kfree(priv); } @@ -423,8 +451,18 @@ static int hgpk_register(struct psmouse *psmouse) err = device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_powered.dattr); - if (err) - hgpk_err(psmouse, "Failed to create sysfs attribute\n"); + if (err) { + hgpk_err(psmouse, "Failed creating 'powered' sysfs node\n"); + } else { + err = device_create_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_recalibrate.dattr); + if (err) { + hgpk_err(psmouse, + "Failed creating 'recalibrate' sysfs node\n"); + device_remove_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_powered.dattr); + } + } return err; } =--------------------- paul fox, pgf@laptop.org ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] forced recalibration for the OLPC hgpk touchpad 2009-07-29 22:08 ` Paul Fox @ 2009-07-30 5:44 ` Dmitry Torokhov 2009-07-30 14:37 ` Paul Fox 0 siblings, 1 reply; 8+ messages in thread From: Dmitry Torokhov @ 2009-07-30 5:44 UTC (permalink / raw) To: Paul Fox; +Cc: linux-input, linux-kernel Hi Paul, On Wed, Jul 29, 2009 at 06:08:50PM -0400, Paul Fox wrote: > this is a resubmission, in the hopes of jump-starting the merge > discussion. it was last discussed in early june of this year. > > the OLPC XO laptop incorporates a combination touchpad/tablet > device which unfortunately requires frequent recalibration. the > driver will force this automatically when various suspicious > behaviors are observed, and the user can recalibrate manually > (with a special keyboard sequence). there's currently no way, > however, for an external program to cause recalibration. > > this patch creates a new node in /sys which, when written with '1', > will force a touchpad recalibration. no other writes (or reads) > of this node are supported. > > during the previous discussion, dmitry suggested that we instead > use the reconnect capability which is already available in /sys. > i experimented with this, and unfortunately a full reset of > the touchpad takes quite a long time -- 1.1 or 1.2 seconds. > recalibration deprives the user of their touchpad for long enough > as it is -- i don't think we can afford that time. (note > that this is a workaround for bad hardware -- the XO no longer > uses this touchpad at least partly due to this very issue, but > there are enough in use that we're still trying to improve > things.) > Sorry, I completely forgot about this patch... I am going to apply it, however I think that we should not be creating the attribute if the touchpad does not support recalibration. Also, I don't see the reason why we can't schedule recalibration immediately instead of waiting for 1 msec. Could you please try updated version of the patch below? Thanks! -- Dmitry Input: hgpk - forced recalibration for the OLPC touchpad From: Paul Fox <pgf@laptop.org> The OLPC XO laptop incorporates a combination touchpad/tablet device which unfortunately requires frequent recalibration. The driver will force this automatically when various suspicious behaviors are observed, and the user can recalibrate manually (with a special keyboard sequence). There's currently no way, however, for an external program to cause recalibration. We can not use the reconnect capability which is already available in /sys because full reset of the touchpad takes 1.1 - 1.2 secons which is too long. This patch creates a new node in /sys which, when written with '1', will force a touchpad recalibration; no other writes (or reads) of this node are supported. Signed-off-by: Paul Fox <pgf@laptop.org> Acked-by: Andres Salomon <dilinger@collabora.co.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/input/mouse/hgpk.c | 55 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 52 insertions(+), 3 deletions(-) diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index a1ad2f1..f5aa035 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c @@ -369,12 +369,46 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data, __PSMOUSE_DEFINE_ATTR(powered, S_IWUSR | S_IRUGO, NULL, hgpk_show_powered, hgpk_set_powered, 0); +static ssize_t hgpk_trigger_recal_show(struct psmouse *psmouse, + void *data, char *buf) +{ + return -EINVAL; +} + +static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data, + const char *buf, size_t count) +{ + struct hgpk_data *priv = psmouse->private; + unsigned long value; + int err; + + err = strict_strtoul(buf, 10, &value); + if (err || value != 1) + return -EINVAL; + + /* + * We queue work instead of doing recalibration right here + * to avoid adding locking to to hgpk_force_recalibrate() + * since workqueue provides serialization. + */ + psmouse_queue_work(psmouse, &priv->recalib_wq, 0); + return count; +} + +__PSMOUSE_DEFINE_ATTR(recalibrate, S_IWUSR | S_IRUGO, NULL, + hgpk_trigger_recal_show, hgpk_trigger_recal, 0); + static void hgpk_disconnect(struct psmouse *psmouse) { struct hgpk_data *priv = psmouse->private; device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_powered.dattr); + + if (psmouse->model >= HGPK_MODEL_C) + device_remove_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_recalibrate.dattr); + psmouse_reset(psmouse); kfree(priv); } @@ -423,10 +457,25 @@ static int hgpk_register(struct psmouse *psmouse) err = device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_powered.dattr); - if (err) - hgpk_err(psmouse, "Failed to create sysfs attribute\n"); + if (err) { + hgpk_err(psmouse, "Failed creating 'powered' sysfs node\n"); + return err; + } - return err; + /* C-series touchpads added the recalibrate command */ + if (psmouse->model >= HGPK_MODEL_C) { + err = device_create_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_recalibrate.dattr); + if (err) { + hgpk_err(psmouse, + "Failed creating 'recalibrate' sysfs node\n"); + device_remove_file(&psmouse->ps2dev.serio->dev, + &psmouse_attr_powered.dattr); + return err; + } + } + + return 0; } int hgpk_init(struct psmouse *psmouse) ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] forced recalibration for the OLPC hgpk touchpad 2009-07-30 5:44 ` Dmitry Torokhov @ 2009-07-30 14:37 ` Paul Fox 0 siblings, 0 replies; 8+ messages in thread From: Paul Fox @ 2009-07-30 14:37 UTC (permalink / raw) To: linux-input, linux-kernel hi dmitry -- dmitry wrote: > Sorry, I completely forgot about this patch... I am going to apply > it, however I think that we should not be creating the attribute > if the touchpad does not support recalibration. Also, I don't see > the reason why we can't schedule recalibration immediately instead > of waiting for 1 msec. > > Could you please try updated version of the patch below? looks and works fine. thanks! paul =--------------------- paul fox, pgf@laptop.org ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-07-30 14:37 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-06-02 19:47 [PATCH] forced recalibration for the OLPC hgpk touchpad pgf 2009-06-03 15:04 ` Dmitry Torokhov 2009-06-04 3:58 ` Paul Fox 2009-06-04 4:17 ` Andres Salomon 2009-06-17 20:16 ` Paul Fox 2009-07-29 22:08 ` Paul Fox 2009-07-30 5:44 ` Dmitry Torokhov 2009-07-30 14:37 ` Paul Fox
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).