aboutsummaryrefslogtreecommitdiff
path: root/hid-tmff2.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-02-09 11:46:32 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2023-02-09 11:46:32 +0200
commit3953b2e7a24e2cf3926a0038a91acf8d9f9ee887 (patch)
tree3c60298711629fd1e3a6857537b705574baa9576 /hid-tmff2.c
parentae9c87774836124e6303b5a7321d9ea0ddf5ab85 (diff)
downloadhid-tmff2-3953b2e7a24e2cf3926a0038a91acf8d9f9ee887.tar.gz
hid-tmff2-3953b2e7a24e2cf3926a0038a91acf8d9f9ee887.zip
add open_mode module parameter
+ open_mode = 1 (default) sends out mode switch commands on open/close, open_mode = 0 sets the wheel into 'open' mode once at init
Diffstat (limited to 'hid-tmff2.c')
-rw-r--r--hid-tmff2.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hid-tmff2.c b/hid-tmff2.c
index e726123..f53a34a 100644
--- a/hid-tmff2.c
+++ b/hid-tmff2.c
@@ -5,6 +5,11 @@
#include "hid-tmff2.h"
+int open_mode = 1;
+module_param(open_mode, int, 0660);
+MODULE_PARM_DESC(open_mode,
+ "Whether to send mode change commands on open/close");
+
int timer_msecs = DEFAULT_TIMER_PERIOD;
module_param(timer_msecs, int, 0660);
MODULE_PARM_DESC(timer_msecs,
@@ -439,7 +444,7 @@ static int tmff2_open(struct input_dev *dev)
return -ENODEV;
if (tmff2->open)
- return tmff2->open(tmff2->data);
+ return tmff2->open(tmff2->data, open_mode);
hid_err(tmff2->hdev, "no open callback set\n");
return -EINVAL;
@@ -456,7 +461,7 @@ static void tmff2_close(struct input_dev *dev)
cancel_delayed_work_sync(&tmff2->work);
if (tmff2->close) {
- tmff2->close(tmff2->data);
+ tmff2->close(tmff2->data, open_mode);
return;
}
@@ -538,7 +543,7 @@ static int tmff2_wheel_init(struct tmff2_device_entry *tmff2)
INIT_DELAYED_WORK(&tmff2->work, tmff2_work_handler);
/* get parameters etc from backend */
- if ((ret = tmff2->wheel_init(tmff2)))
+ if ((ret = tmff2->wheel_init(tmff2, open_mode)))
goto err;