Skip to content

Commit

Permalink
Input: add INPUT_PROP_POINTING_STICK property
Browse files Browse the repository at this point in the history
It is useful for userspace to know that there not dealing with a regular
mouse but rather with a pointing stick (e.g. a trackpoint) so that
userspace can e.g. automatically enable middle button scrollwheel
emulation.

It is impossible to tell the difference from the evdev info without
resorting to putting a list of device / driver names in userspace, this is
undesirable.

Add a property which allows userspace to see if a device is a pointing
stick, and set it on all the pointing stick drivers.

Signed-off-by: Hans de Goede <[email protected]>
Acked-by: Benjamin Tissoires <[email protected]>
Acked-by: Peter Hutterer <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
jwrdegoede authored and dtor committed Sep 8, 2014
1 parent 271329b commit 7611392
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/input/mouse/alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,9 @@ int alps_init(struct psmouse *psmouse)
dev2->keybit[BIT_WORD(BTN_LEFT)] =
BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);

if (priv->flags & ALPS_DUALPOINT)
__set_bit(INPUT_PROP_POINTING_STICK, dev2->propbit);

if (input_register_device(priv->dev2))
goto init_fail;

Expand Down
3 changes: 3 additions & 0 deletions drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,9 @@ int elantech_init(struct psmouse *psmouse)
tp_dev->keybit[BIT_WORD(BTN_LEFT)] =
BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) |
BIT_MASK(BTN_RIGHT);

__set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit);

error = input_register_device(etd->tp_dev);
if (error < 0)
goto init_fail_tp_reg;
Expand Down
1 change: 1 addition & 0 deletions drivers/input/mouse/synaptics_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ static int synusb_probe(struct usb_interface *intf,
__set_bit(EV_REL, input_dev->evbit);
__set_bit(REL_X, input_dev->relbit);
__set_bit(REL_Y, input_dev->relbit);
__set_bit(INPUT_PROP_POINTING_STICK, input_dev->propbit);
input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0);
} else {
input_set_abs_params(input_dev, ABS_X,
Expand Down
2 changes: 2 additions & 0 deletions drivers/input/mouse/trackpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
if ((button_info & 0x0f) >= 3)
__set_bit(BTN_MIDDLE, psmouse->dev->keybit);

__set_bit(INPUT_PROP_POINTING_STICK, psmouse->dev->propbit);

trackpoint_defaults(psmouse->private);

error = trackpoint_power_on_reset(&psmouse->ps2dev);
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ struct input_keymap_entry {
#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */

#define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
Expand Down

0 comments on commit 7611392

Please sign in to comment.