aboutsummaryrefslogtreecommitdiff
path: root/src/tmtx/hid-tmtx.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/tmtx/hid-tmtx.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/tmtx/hid-tmtx.c')
-rw-r--r--src/tmtx/hid-tmtx.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tmtx/hid-tmtx.c b/src/tmtx/hid-tmtx.c
index f1f1b32..857886c 100644
--- a/src/tmtx/hid-tmtx.c
+++ b/src/tmtx/hid-tmtx.c
@@ -196,15 +196,17 @@ static int tx_send_open(struct t300rs_device_entry *tx)
return 0;
}
-static void tx_open(void *data, int open_mode)
+static int tx_open(void *data, int open_mode)
{
struct t300rs_device_entry *tx = data;
if (!tx)
- return;
+ return -ENODEV;
if (open_mode)
tx_send_open(tx);
+
+ return tx->open(tx->input_dev);
}
static int tx_send_close(struct t300rs_device_entry *tx)
@@ -223,15 +225,18 @@ static int tx_send_close(struct t300rs_device_entry *tx)
return 0;
}
-static void tx_close(void *data, int open_mode)
+static int tx_close(void *data, int open_mode)
{
struct t300rs_device_entry *tx = data;
if (!tx)
- return;
+ return -ENODEV;
if (open_mode)
tx_send_close(tx);
+
+ tx->close(tx->input_dev);
+ return 0;
}
static int tx_wheel_init(struct tmff2_device_entry *tmff2, int open_mode)
@@ -262,6 +267,9 @@ static int tx_wheel_init(struct tmff2_device_entry *tmff2, int open_mode)
tx->report = list_entry(report_list->next, struct hid_report, list);
tx->ff_field = tx->report->field[0];
+ tx->open = tx->input_dev->open;
+ tx->close = tx->input_dev->close;
+
if ((ret = tx_interrupts(tx)))
goto interrupt_err;