linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: alps: allow incoming reports when only the trackstick is opened
@ 2018-10-12 14:05 Benjamin Tissoires
  2018-10-26 15:27 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Tissoires @ 2018-10-12 14:05 UTC (permalink / raw)
  To: Jiri Kosina, Masaki Ota; +Cc: linux-input, linux-kernel, Benjamin Tissoires

If userspace only reads the trackstick node, and no one is listening to
the touchpad nor the hidraw node then, the device is not powered on.

Add open/close callbacks to allow users to disable the touchpad in Gnome
while keeping the trackstick active.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1559632
Link: https://gitlab.gnome.org/GNOME/mutter/issues/128
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/hid-alps.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
index aec253b44156..3cd7229b6e54 100644
--- a/drivers/hid/hid-alps.c
+++ b/drivers/hid/hid-alps.c
@@ -660,6 +660,20 @@ static int T4_init(struct hid_device *hdev, struct alps_dev *pri_data)
 	return ret;
 }
 
+static int alps_sp_open(struct input_dev *dev)
+{
+	struct hid_device *hid = input_get_drvdata(dev);
+
+	return hid_hw_open(hid);
+}
+
+static void alps_sp_close(struct input_dev *dev)
+{
+	struct hid_device *hid = input_get_drvdata(dev);
+
+	hid_hw_close(hid);
+}
+
 static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
 {
 	struct alps_dev *data = hid_get_drvdata(hdev);
@@ -733,6 +747,10 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
 		input2->id.version = input->id.version;
 		input2->dev.parent = input->dev.parent;
 
+		input_set_drvdata(input2, hdev);
+		input2->open = alps_sp_open;
+		input2->close = alps_sp_close;
+
 		__set_bit(EV_KEY, input2->evbit);
 		data->sp_btn_cnt = (data->sp_btn_info & 0x0F);
 		for (i = 0; i < data->sp_btn_cnt; i++)
-- 
2.14.3


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

* Re: [PATCH] HID: alps: allow incoming reports when only the trackstick is opened
  2018-10-12 14:05 [PATCH] HID: alps: allow incoming reports when only the trackstick is opened Benjamin Tissoires
@ 2018-10-26 15:27 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2018-10-26 15:27 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Masaki Ota, linux-input, linux-kernel

On Fri, 12 Oct 2018, Benjamin Tissoires wrote:

> If userspace only reads the trackstick node, and no one is listening to
> the touchpad nor the hidraw node then, the device is not powered on.
> 
> Add open/close callbacks to allow users to disable the touchpad in Gnome
> while keeping the trackstick active.
> 
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=1559632
> Link: https://gitlab.gnome.org/GNOME/mutter/issues/128
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2018-10-26 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12 14:05 [PATCH] HID: alps: allow incoming reports when only the trackstick is opened Benjamin Tissoires
2018-10-26 15:27 ` Jiri Kosina

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).