diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-01-26 18:21:43 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-01-26 18:21:43 +0200 |
| commit | 66e522e26549afab26d032e900ae9f6576c83b9d (patch) | |
| tree | 273ab042080b42f273d9a5f6bff9e7273daf076c /src/tmt300rs | |
| parent | 816a23aa8f6924517bf784f3d72fbae42f100493 (diff) | |
| download | hid-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/tmt300rs')
| -rw-r--r-- | src/tmt300rs/hid-tmt300rs.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tmt300rs/hid-tmt300rs.c b/src/tmt300rs/hid-tmt300rs.c index 689466f..00eecee 100644 --- a/src/tmt300rs/hid-tmt300rs.c +++ b/src/tmt300rs/hid-tmt300rs.c @@ -1287,26 +1287,31 @@ static int t300rs_send_close(struct t300rs_device_entry *t300rs) return t300rs_send_int(t300rs); } -void t300rs_open(void *data, int open_mode) +int t300rs_open(void *data, int open_mode) { struct t300rs_device_entry *t300rs = data; if (!t300rs) - return; + return -ENODEV; if (open_mode && t300rs_send_open(t300rs)) hid_warn(t300rs->hdev, "failed sending open command\n"); + + return t300rs->open(t300rs->input_dev); } -void t300rs_close(void *data, int open_mode) +int t300rs_close(void *data, int open_mode) { struct t300rs_device_entry *t300rs = data; int ret = 0; if (!t300rs) - return; + return -ENODEV; if (open_mode && (ret = t300rs_send_close(t300rs))) hid_warn(t300rs->hdev, "failed sending close command\n"); + + t300rs->close(t300rs->input_dev); + return ret; } static int t300rs_check_firmware(struct t300rs_device_entry *t300rs) @@ -1464,6 +1469,9 @@ static int t300rs_wheel_init(struct tmff2_device_entry *tmff2, int open_mode) t300rs->report = list_entry(report_list->next, struct hid_report, list); t300rs->ff_field = t300rs->report->field[0]; + t300rs->open = t300rs->input_dev->open; + t300rs->close = t300rs->input_dev->close; + /* TODO: PS4 advanced mode? */ alt_mode = (t300rs->mode = (t300rs->hdev->product == TMT300RS_PS3_ADV_ID)); if ((t300rs->attachment = t300rs_get_attachment(t300rs)) < 0) |
