aboutsummaryrefslogtreecommitdiff
path: root/src/tmt248/hid-tmt248.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2026-01-26 18:21:43 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2026-01-26 18:21:43 +0200
commit66e522e26549afab26d032e900ae9f6576c83b9d (patch)
tree273ab042080b42f273d9a5f6bff9e7273daf076c /src/tmt248/hid-tmt248.c
parent816a23aa8f6924517bf784f3d72fbae42f100493 (diff)
downloadhid-tmff2-66e522e26549afab26d032e900ae9f6576c83b9d.tar.gz
hid-tmff2-66e522e26549afab26d032e900ae9f6576c83b9d.zip
Revert "use on_hid_hw_open instead of input_dev->open"
This reverts commit c26573d77369c042dc2b9a881a7f2ff88ddc0dd9. + `on_hid_hw_open` is apparently new enough that common distros don't have it yet, so let's wait a few years and try again. The old method works well enough and if not, just set `open_mode=0`.
Diffstat (limited to 'src/tmt248/hid-tmt248.c')
-rw-r--r--src/tmt248/hid-tmt248.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tmt248/hid-tmt248.c b/src/tmt248/hid-tmt248.c
index 4c42264..9ac43d9 100644
--- a/src/tmt248/hid-tmt248.c
+++ b/src/tmt248/hid-tmt248.c
@@ -208,15 +208,17 @@ static int t248_send_open(struct t300rs_device_entry *t248)
return 0;
}
-static void t248_open(void *data, int open_mode)
+static int t248_open(void *data, int open_mode)
{
struct t300rs_device_entry *t248 = data;
if (!t248)
- return;
+ return -ENODEV;
if (open_mode)
t248_send_open(t248);
+
+ return t248->open(t248->input_dev);
}
static int t248_send_close(struct t300rs_device_entry *t248)
@@ -235,14 +237,18 @@ static int t248_send_close(struct t300rs_device_entry *t248)
return 0;
}
-static void t248_close(void *data, int open_mode)
+static int t248_close(void *data, int open_mode)
{
struct t300rs_device_entry *t248 = data;
+
if (!t248)
- return;
+ return -ENODEV;
if (open_mode)
t248_send_close(t248);
+
+ t248->close(t248->input_dev);
+ return 0;
}
static int t248_wheel_init(struct tmff2_device_entry *tmff2, int open_mode)
@@ -273,6 +279,9 @@ static int t248_wheel_init(struct tmff2_device_entry *tmff2, int open_mode)
t248->report = list_entry(report_list->next, struct hid_report, list);
t248->ff_field = t248->report->field[0];
+ t248->open = t248->input_dev->open;
+ t248->close = t248->input_dev->close;
+
if ((ret = t248_interrupts(t248)))
goto interrupt_err;