From: pgf@laptop.org
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] forced recalibration for the OLPC hgpk touchpad
Date: Tue, 02 Jun 2009 15:47:59 -0400 [thread overview]
Message-ID: <3026.1243972079@foxharp.boston.ma.us> (raw)
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
next reply other threads:[~2009-06-02 20:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-02 19:47 pgf [this message]
2009-06-03 15:04 ` [PATCH] forced recalibration for the OLPC hgpk touchpad 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3026.1243972079@foxharp.boston.ma.us \
--to=pgf@laptop.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).