All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Input: set INPUT_PROP_POINTING_STICK in hid-lenovo
@ 2015-04-08  9:36 Andreas Fleig
  2015-04-13 17:23 ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Fleig @ 2015-04-08  9:36 UTC (permalink / raw)
  To: linux-input

Set flags INPUT_PROP_POINTER and INPUT_PROP_POINTING_STICK for the
trackpoint integrated in Lenovo USB and Bluetooth keyboards. Libinput 
checks
these flags to enable features such as middle-button-scrolling by 
default.

Signed-off-by: Andreas Fleig <andreasfleig@gmail.com>

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index c4c3f09..c4da65d 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -762,6 +762,16 @@ static void lenovo_remove(struct hid_device *hdev)
 	hid_hw_stop(hdev);
 }

+static void lenovo_input_configured(struct hid_device *hdev,
+		struct hid_input *hi)
+{
+	if (test_bit(EV_REL, hi->input->evbit)) {
+		/* set only for trackpoint device */
+		__set_bit(INPUT_PROP_POINTER, hi->input->propbit);
+		__set_bit(INPUT_PROP_POINTING_STICK, hi->input->propbit);
+	}
+}
+
 static const struct hid_device_id lenovo_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) 
},
@@ -774,6 +784,7 @@ MODULE_DEVICE_TABLE(hid, lenovo_devices);
 static struct hid_driver lenovo_driver = {
 	.name = "lenovo",
 	.id_table = lenovo_devices,
+	.input_configured = lenovo_input_configured,
 	.input_mapping = lenovo_input_mapping,
 	.probe = lenovo_probe,
 	.remove = lenovo_remove,




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Input: set INPUT_PROP_POINTING_STICK in hid-lenovo
  2015-04-08  9:36 [PATCH v2] Input: set INPUT_PROP_POINTING_STICK in hid-lenovo Andreas Fleig
@ 2015-04-13 17:23 ` Benjamin Tissoires
  2015-04-14  9:40   ` Andreas Fleig
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2015-04-13 17:23 UTC (permalink / raw)
  To: Andreas Fleig; +Cc: linux-input, Jiri Kosina

Hi Andreas,

[please do not forget to CC Jiri when submitting to HID, or your patch
will get lost]

On Wed, Apr 8, 2015 at 5:36 AM, Andreas Fleig <andreasfleig@gmail.com> wrote:
> Set flags INPUT_PROP_POINTER and INPUT_PROP_POINTING_STICK for the
> trackpoint integrated in Lenovo USB and Bluetooth keyboards. Libinput checks
> these flags to enable features such as middle-button-scrolling by default.
>
> Signed-off-by: Andreas Fleig <andreasfleig@gmail.com>
>
> diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
> index c4c3f09..c4da65d 100644
> --- a/drivers/hid/hid-lenovo.c
> +++ b/drivers/hid/hid-lenovo.c
> @@ -762,6 +762,16 @@ static void lenovo_remove(struct hid_device *hdev)
>         hid_hw_stop(hdev);
> }
>
> +static void lenovo_input_configured(struct hid_device *hdev,
> +               struct hid_input *hi)
> +{
> +       if (test_bit(EV_REL, hi->input->evbit)) {

Are we sure that there is no other integrated mouse than the track point?
I would not like us to set INPUT_PROP_POINTING_STICK to other input
devices that should not have them.

If you are not sure, maybe test with the product ID so that we know
which ones are enabled/tested.

If there won't be any problem, then the patch is Reviewed-by: Benjamin
Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> +               /* set only for trackpoint device */
> +               __set_bit(INPUT_PROP_POINTER, hi->input->propbit);
> +               __set_bit(INPUT_PROP_POINTING_STICK, hi->input->propbit);
> +       }
> +}
> +
> static const struct hid_device_id lenovo_devices[] = {
>         { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD)
> },
>         { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD)
> },
> @@ -774,6 +784,7 @@ MODULE_DEVICE_TABLE(hid, lenovo_devices);
> static struct hid_driver lenovo_driver = {
>         .name = "lenovo",
>         .id_table = lenovo_devices,
> +       .input_configured = lenovo_input_configured,
>         .input_mapping = lenovo_input_mapping,
>         .probe = lenovo_probe,
>         .remove = lenovo_remove,
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Input: set INPUT_PROP_POINTING_STICK in hid-lenovo
  2015-04-13 17:23 ` Benjamin Tissoires
@ 2015-04-14  9:40   ` Andreas Fleig
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Fleig @ 2015-04-14  9:40 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: linux-input

On Mon, Apr 13, 2015 at 7:23 , Benjamin Tissoires 
<benjamin.tissoires@gmail.com> wrote:
> Are we sure that there is no other integrated mouse than the track 
> point?
> I would not like us to set INPUT_PROP_POINTING_STICK to other input
> devices that should not have them.
> 
> If you are not sure, maybe test with the product ID so that we know
> which ones are enabled/tested.

Thanks! Currently, the driver is only for three devices which all have 
a trackpoint. But since lenovo_input_mapping is also testing for 
product ids, I'll add the same test and send in a v3.

Andreas


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-14  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08  9:36 [PATCH v2] Input: set INPUT_PROP_POINTING_STICK in hid-lenovo Andreas Fleig
2015-04-13 17:23 ` Benjamin Tissoires
2015-04-14  9:40   ` Andreas Fleig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.