Skip to content

Commit 2ba3532

Browse files
haarpdtor
authored andcommitted
Input: psmouse - expose drift duration for IBM trackpoints
IBM Trackpoints have a feature to compensate for drift by recalibrating themselves periodically. By default, if for 0.5 seconds there is no change in position, it's used as the new zero. This duration is too low. Often, the calibration happens when the trackpoint is in fact being used. IBM's Trackpoint Engineering Specifications show a configuration register that allows changing this duration, rstdft1. Expose it via sysfs among the other settings. Signed-off-by: Mike Murdoch <main.haarp@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 7c12a5b commit 2ba3532

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎drivers/input/mouse/trackpoint.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ TRACKPOINT_INT_ATTR(thresh, TP_THRESH, TP_DEF_THRESH);
227227
TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH);
228228
TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME);
229229
TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV);
230+
TRACKPOINT_INT_ATTR(drift_time, TP_DRIFT_TIME, TP_DEF_DRIFT_TIME);
230231

231232
TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0,
232233
TP_DEF_PTSON);
@@ -246,6 +247,7 @@ static struct attribute *trackpoint_attrs[] = {
246247
&psmouse_attr_upthresh.dattr.attr,
247248
&psmouse_attr_ztime.dattr.attr,
248249
&psmouse_attr_jenks.dattr.attr,
250+
&psmouse_attr_drift_time.dattr.attr,
249251
&psmouse_attr_press_to_select.dattr.attr,
250252
&psmouse_attr_skipback.dattr.attr,
251253
&psmouse_attr_ext_dev.dattr.attr,
@@ -312,6 +314,7 @@ static int trackpoint_sync(struct psmouse *psmouse, bool in_power_on_state)
312314
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh);
313315
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime);
314316
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks);
317+
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, drift_time);
315318

316319
/* toggles */
317320
TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select);
@@ -332,6 +335,7 @@ static void trackpoint_defaults(struct trackpoint_data *tp)
332335
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh);
333336
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime);
334337
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks);
338+
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, drift_time);
335339
TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia);
336340

337341
/* toggles */

‎drivers/input/mouse/trackpoint.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
#define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */
7171
#define TP_Z_TIME 0x5E /* How sharp of a press */
7272
#define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */
73+
#define TP_DRIFT_TIME 0x5F /* How long a 'hands off' condition */
74+
/* must last (x*107ms) for drift */
75+
/* correction to occur */
7376

7477
/*
7578
* Toggling Flag bits
@@ -120,6 +123,7 @@
120123
#define TP_DEF_UP_THRESH 0xFF
121124
#define TP_DEF_Z_TIME 0x26
122125
#define TP_DEF_JENKS_CURV 0x87
126+
#define TP_DEF_DRIFT_TIME 0x05
123127

124128
/* Toggles */
125129
#define TP_DEF_MB 0x00
@@ -137,6 +141,7 @@ struct trackpoint_data
137141
unsigned char draghys, mindrag;
138142
unsigned char thresh, upthresh;
139143
unsigned char ztime, jenks;
144+
unsigned char drift_time;
140145

141146
/* toggles */
142147
unsigned char press_to_select;

0 commit comments

Comments
 (0)