Skip to content

Commit 7dd8db6

Browse files
bentissJiri Kosina
authored andcommitted
HID: alps: allow incoming reports when only the trackstick is opened
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> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 6298944 commit 7dd8db6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/hid/hid-alps.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,20 @@ static int T4_init(struct hid_device *hdev, struct alps_dev *pri_data)
660660
return ret;
661661
}
662662

663+
static int alps_sp_open(struct input_dev *dev)
664+
{
665+
struct hid_device *hid = input_get_drvdata(dev);
666+
667+
return hid_hw_open(hid);
668+
}
669+
670+
static void alps_sp_close(struct input_dev *dev)
671+
{
672+
struct hid_device *hid = input_get_drvdata(dev);
673+
674+
hid_hw_close(hid);
675+
}
676+
663677
static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
664678
{
665679
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)
733747
input2->id.version = input->id.version;
734748
input2->dev.parent = input->dev.parent;
735749

750+
input_set_drvdata(input2, hdev);
751+
input2->open = alps_sp_open;
752+
input2->close = alps_sp_close;
753+
736754
__set_bit(EV_KEY, input2->evbit);
737755
data->sp_btn_cnt = (data->sp_btn_info & 0x0F);
738756
for (i = 0; i < data->sp_btn_cnt; i++)

0 commit comments

Comments
 (0)