From 2a1f7f59d37ed178796b921efbab3dfae33ddfce Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 29 Sep 2024 17:27:04 +0300 Subject: add tspc mode switch for testing --- src/tmtspc/hid-tmtspc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/tmtspc/hid-tmtspc.c b/src/tmtspc/hid-tmtspc.c index 3f85ba7..caaa378 100644 --- a/src/tmtspc/hid-tmtspc.c +++ b/src/tmtspc/hid-tmtspc.c @@ -301,6 +301,22 @@ static __u8 *tspc_wheel_fixup(struct hid_device *hdev, __u8 *rdesc, return rdesc; } +static ssize_t tspc_alt_mode_store(void *data, const char *buf, size_t count) +{ + struct t300rs_device_entry *tspc = data; + if (!tspc) + return -ENODEV; + + /* blindly trusting that this works for now */ + usb_control_msg(tspc->usbdev, + usb_sndctrlpipe(tspc->usbdev, 0), + 83, 0x41, 0xb, 0, 0, 0, + USB_CTRL_SET_TIMEOUT + ); + + return count; +} + int tspc_populate_api(struct tmff2_device_entry *tmff2) { tmff2->play_effect = t300rs_play_effect; @@ -317,6 +333,8 @@ int tspc_populate_api(struct tmff2_device_entry *tmff2) tmff2->open = tspc_open; tmff2->close = tspc_close; + tmff2->alt_mode_store = tspc_alt_mode_store; + tmff2->wheel_init = tspc_wheel_init; tmff2->wheel_destroy = tspc_wheel_destroy; -- cgit v1.3