Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20359
b: refs/heads/master
c: b8044c7
h: refs/heads/master
i:
  20357: 64fb800
  20355: 6753e2c
  20351: 090d2ac
v: v3
  • Loading branch information
Dmitry Torokhov committed Feb 15, 2006
1 parent 68a1c33 commit 282d6c7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 50f6dde0ad05ee4ee8450feb731b15b716115c4d
refs/heads/master: b8044c74bcd64bd1a9d2e8cec58fdcd40f16f5a4
20 changes: 14 additions & 6 deletions trunk/drivers/input/mouse/trackpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,19 @@ struct trackpoint_attr_data {
size_t field_offset;
unsigned char command;
unsigned char mask;
unsigned char inverted;
};

static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf)
{
struct trackpoint_data *tp = psmouse->private;
struct trackpoint_attr_data *attr = data;
unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset);
unsigned char value = *(unsigned char *)((char *)tp + attr->field_offset);

if (attr->inverted)
value = !value;

return sprintf(buf, "%u\n", *field);
return sprintf(buf, "%u\n", value);
}

static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
Expand Down Expand Up @@ -120,6 +124,9 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
if (*rest || value > 1)
return -EINVAL;

if (attr->inverted)
value = !value;

if (*field != value) {
*field = value;
trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask);
Expand All @@ -129,11 +136,12 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
}


#define TRACKPOINT_BIT_ATTR(_name, _command, _mask) \
#define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv) \
static struct trackpoint_attr_data trackpoint_attr_##_name = { \
.field_offset = offsetof(struct trackpoint_data, _name), \
.command = _command, \
.mask = _mask, \
.inverted = _inv, \
}; \
PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \
&trackpoint_attr_##_name, \
Expand All @@ -150,9 +158,9 @@ TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH);
TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME);
TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV);

TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON);
TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK);
TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV);
TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0);
TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0);
TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1);

static struct attribute *trackpoint_attrs[] = {
&psmouse_attr_sensitivity.dattr.attr,
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/input/mouse/trackpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

#define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */
#define TP_MASK_MB 0x01
#define TP_TOGGLE_EXT_DEV 0x23 /* Toggle external device */
#define TP_TOGGLE_EXT_DEV 0x23 /* Disable external device */
#define TP_MASK_EXT_DEV 0x02
#define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */
#define TP_MASK_DRIFT 0x80
Expand Down Expand Up @@ -125,7 +125,7 @@
#define TP_DEF_MB 0x00
#define TP_DEF_PTSON 0x00
#define TP_DEF_SKIPBACK 0x00
#define TP_DEF_EXT_DEV 0x01
#define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */

#define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd))

Expand Down

0 comments on commit 282d6c7

Please sign in to comment.